1
0

backlog of changes from the uconsole

This commit is contained in:
dtb
2025-03-07 05:36:27 -07:00
parent 55bb27a1de
commit 9846c7ad27
50 changed files with 1207 additions and 726 deletions

View File

@@ -70,13 +70,13 @@ get_memory_usage() {
PUBLIC_IP="$(ifpublic)"
printbar() {
printf "%b" "$(get_current_desktop)"
# printf "%b" "$(get_current_desktop)"
printf "%b" $($DATE)
printf "%b" "$DELIMITER"
printf "%b" "BAT: $(battery)"
printf "%b" "$DELIMITER"
printf "%b" "CPU: $(get_cpu_temp)"
printf "%b" "$DELIMITER"
# printf "%b" "CPU: $(get_cpu_temp)"
# printf "%b" "$DELIMITER"
printf "%b" "PuIP: $PUBLIC_IP"
#printf "%b" "$DELIMITER"
#printf "%b" "MEM: $(get_memory_usage)"

139
niceties/openbsd Normal file
View File

@@ -0,0 +1,139 @@
#!/bin/sh
set -e
# found this here... may auto install openbsd... may not... who knows
prog(){ while test -n "$!" # ask your doctor about progesterone
do if ! command -v "$1" >/dev/null
then printf '%s: %s command not found. Please install it.\n' \
"$0" "$1" 1>&2
false
fi done }
prog curl
if ! prog signify
then if prog signify-openbsd
then alias signify=signify-openbsd
else false
fi fi
OBSD="$HOME"/OpenBSD
REL=7.5
SREL="$(printf '%s\n' "$REL" | tr -d .)"
test -n "$ARCH" \
|| case "$(uname -m)" in
# aarch64) ARCH=arm64 ;;
amd64) ARCH=amd64 ;;
# arm64) ARCH=arm64 ;;
i386) ARCH=i386 ;;
# *) ARCH=riscv64 ;;
*) ARCH=arm64 ;;
esac
test -n "$MIRROR" \
|| MIRROR=ftp://mirrors.mit.edu/pub/OpenBSD
case "$ARCH" in
amd64) QEMU=x86_64 ;;
i386) QEMU=i386 ;;
*) QEMU=aarch64 ;;
esac
printf '%s: enter a public SSH key for accessing the virtual machine.\n:: ' "$0"
PUBSSH="$(head -n 1)"
printf "\
%s: Setting up a virtualized OpenBSD %s (%s) instance from the mirror %s.
%s: Control+C to cancel. Waiting 10s to continue...
" "$0" "$REL" "$ARCH" "$MIRROR" \
"$0" 1>&2
sleep 10
# <https://www.skreutz.com/posts/autoinstall-openbsd-on-qemu/>
mkdir -p "$OBSD"/mirror/pub/OpenBSD/"$REL"/"$ARCH"
curl -O --output-dir "$OBSD"/mirror/pub/OpenBSD/"$REL"/ \
https://ftp.openbsd.org/pub/OpenBSD/"$REL"/openbsd-"$SREL"-base.pub
for f in SHA256.sig bsd bsd.mp bsd.rd pxeboot \
base"$SREL".tgz comp"$SREL".tgz man"$SREL".tgz
do curl -O --output-dir "$OBSD"/mirror/pub/OpenBSD/"$REL"/"$ARCH" \
"$MIRROR"/"$REL"/"$ARCH"/"$f"
done
signify -C -p "$OBSD"/mirror/pub/OpenBSD/"$REL"/openbsd-"$SREL"-base.pub \
-x "$OBSD"/mirror/pub/OpenBSD/"$REL"/"$ARCH"/SHA256.sig \
-- bsd* pxeboot *"$SREL".tgz
printf "\
%s: Using the following autoinstall(8) install.conf:
Change the default console to com0 = yes
Which speed should com0 use = 115200
System hostname = openbsd
Password for root = *************
Allow root ssh login = no
Setup a user = puffy
Password for user = *************
Public ssh key for user = %s
What timezone are you in = UTC
Location of sets = http
HTTP Server = 10.33.2.1
Unable to connect using https. Use http instead = yes
URL to autopartitioning template for disklabel = http://10.33.2.1/disklabel
Set name(s) = site%s.tgz
Checksum test for site%s.tgz failed. Continue anyway = yes
Unverified sets: site%s.tgz. Continue without verification = yes
" "$0" "$PUBSSH" "$SREL" "$SREL" "$SREL" \
| tee -a /dev/stderr \
| sed -e 1d -e 's:^\t::g' \
>"$OBSD"/mirror/install.conf
printf "\
%s: Using the following disklabel(8) template:
/ 8G
swap 256M
" "$0" \
| tee -a /dev/stderr \
| sed -e 1d -e 's:^\t::g' \
>"$OBSD"/mirror/disklabel
mkdir -p site
printf "\
#!/bin/sh
printf 'https://cdn.openbsd.org/pub/OpenBSD\n' \
>/etc/installurl
printf 'permit keepenv nopass :wheel\n' \
>>/etc/doas.conf
" >"$OBSD"/site/install.site
chmod +x "$OBSD"/site/install.site
tar -C site czf "$OBSD"/mirror/pub/OpenBSD/"$REL"/"$ARCH"/site"$SREL".tgz
# probably not necessary
#ls -l "$OBSD"/mirror/pub/OpenBSD/"$REL"/"$ARCH" >"$OBSD"/index.txt
mkdir -p tftp/etc
ln "$OBSD"/mirror/pub/OpenBSD/"$REL"/"$ARCH"/pxeboot "$OBSD"/tftp/auto_install
ln "$OBSD"/mirror/pub/OpenBSD/"$REL"/"$ARCH"/bsd.rd "$OBSD"/tftp/bsd.rd
printf "\
stty com0 115200
set tty com0
boot tftp:/bsd.rd
" >"$OBSD"/tftp/etc/boot.conf
qemu-img create -f qcow2 "$OBSD"/hd0.qcow2 9G
chmod +x
python3 -m http.server --directory "$OBSD"/mirror --bind 127.0.0.1 8080 &
qemu-system-"$QEMU" \
-drive file=\"\$OBSD\"/hd0.qcow2,media=disk,if=virtio \
-device e1000,netdev=n1 \
-m 512M \
-netdev user,id=n1,hostname=openbsd-vm,tftp-server-name=10.0.2.1,tftp=tftp,bootfile=auto_install,hostfwd=tcp::2222-:22,guestfwd=tcp:10.0.2.1:80-cmd:socat STDIO TCP4:127.0.0.1:8080 \
-nographic &
printf "\
%s: ssh into puffy@127.0.0.1:2222 to connect.
%s: press Enter to quit.
" "$0" "$0" 1>&2
head -n 1

View File

@@ -4,7 +4,7 @@
# Not a great use of disk...
dd 2>/dev/null \
| sed \
-e 's/l/w/g' \
-e 's/r/w/g' \
-e 's/smaww/smol/g' \
-e 's/wove/wuv/g'
-e s/l/w/g \
-e s/r/w/g \
-e s/smaww/smol/g \
-e s/wove/wuv/g

View File

@@ -52,7 +52,7 @@ case "$1" in
-) "$0" r -"$2" ;;
a*)
str isvalue $2 && ! str isvalue $3 && str isdigit "$2" \
test -n $2 && ! str isvalue $3 && str isdigit "$2" \
|| usage
"$0".$VOLUME_SYSTEM "$@"
;;