diff options
-rw-r--r-- | deno.json | 9 | ||||
-rw-r--r-- | src/routes/shared.ts | 43 | ||||
-rw-r--r-- | static/misc/automated-alpine-setup | 118 |
3 files changed, 148 insertions, 22 deletions
@@ -11,5 +11,12 @@ "license": "AGPL-3.0-or-later", "fmt": { "singleQuote": true - } + }, + "compilerOptions": { + "checkJs": true, + "strict": true + }, + "unstable": [ + "sloppy-imports" + ] } diff --git a/src/routes/shared.ts b/src/routes/shared.ts index 0d198bf..e4a3e6d 100644 --- a/src/routes/shared.ts +++ b/src/routes/shared.ts @@ -37,37 +37,37 @@ export type RenderBlock = { italic?: boolean; underlined?: boolean; url?: - | `newtab:${string}` - | `currenttab:${string}` - | ((textObj: TTYText & { kind: 'text' }) => void); + | `newtab:${string}` + | `currenttab:${string}` + | ((textObj: TTYText & { kind: 'text' }) => void); bg?: string; raw?: boolean; dl?: string; }; export type TTYText = | { - kind: 'text'; - renderrestriction?: 'everywhere' | 'js-only' | 'noscript'; - value: RenderBlock[]; - id: string; - classes: string[]; - } + kind: 'text'; + renderrestriction?: 'everywhere' | 'js-only' | 'noscript'; + value: RenderBlock[]; + id: string; + classes: string[]; + } | { - kind: 'removeNode'; - removedId: string; - removedItemClassList: string[]; - } + kind: 'removeNode'; + removedId: string; + removedItemClassList: string[]; + } | { - kind: 'time'; - delay: number; - } + kind: 'time'; + delay: number; + } | { - kind: 'cursorVisibility'; - visible: boolean; - } + kind: 'cursorVisibility'; + visible: boolean; + } | { - kind: 'clear'; - }; + kind: 'clear'; + }; export type Only<Obj, Keys extends keyof Obj> = { [k in Keys]: Obj[k]; }; @@ -231,6 +231,7 @@ export const ttyLines: TTYText[] = (() => { 'overhead: "I don\'t consent" "hey thats my line"', 'uwu', 'i regret making this hellhole of a codebase', + `${(parseInt('0x' + (0x1312 + 0o1312).toString(16)) - 0x96cf).toString(16)}`, ]), { colour: '#777777', diff --git a/static/misc/automated-alpine-setup b/static/misc/automated-alpine-setup new file mode 100644 index 0000000..0d46253 --- /dev/null +++ b/static/misc/automated-alpine-setup @@ -0,0 +1,118 @@ +#!/usr/bin/expect -f +# An IPv6-only-compatible automation routine around `setup-alpine` for building alpine vms +# Replace `user=memdmp` with `user=<output of whoami>` +# Replace `[SSHKEY]` with the desired SSH key +# Replace `/tmp/vm.iso` with the Alpine ISO +# Replace `/tmp/target.qcow2` with the desired qcow2 image to install on +# Replace `-m 8G` with the amount of memory to use +# After setup, change the disk encryption password (will be set to `pass`) via `cryptsetup luksAddKey /dev/sdb3` followed by `crypsetup luksRemoveKey /dev/sdb3` +spawn qemu-system-x86_64 -smp 8 -run-with user=memdmp -drive file=/tmp/vm.iso,format=raw,index=0,media=disk -drive file=/tmp/target.qcow2,format=qcow2,index=1,media=disk -serial stdio -display none -m 8G + +set timeout 240 +expect "login: " +send "root\n" +set timeout 30 + +expect "You may change this message by editing /etc/motd." +sleep 1 +send "PS1=@@\n" +expect "\n@@" +send "echo 'Hi!' > /etc/motd\n" +expect "\n@@" + +send "setup-alpine\n" +expect "Enter system hostname" +sleep 0.1 +send "replaceme.vms.crunchy.estrogen.zone\n" + +expect "eth0" +sleep 0.1 +send "\n" +expect "Ip address for eth0?" +send "none\n" +expect "manual" +send "y\n" +sleep 1 +send ":" +sleep 0.1 +send ":%s/inet manual/inet6 auto/" +sleep 0.1 +send "\n" +sleep 0.3 +send ":wq\n" +expect "DNS domain name" +send "\n" +expect "DNS nameserver" +send "2620:fe::fe 2620:fe::9 9.9.9.9 149.112.112.112\n" + +expect "New password: " +send "\n" +sleep 0.1 +send "\n" + +expect "Which timezone are you in?" +sleep 0.1 +send "Europe/Zurich\n" + +expect "HTTP/FTP proxy URL?" +sleep 0.1 +send "\n" + +expect "Which NTP client to run?" +sleep 0.1 +send "chrony\n" + +expect "Enter mirror number or URL:" +sleep 0.1 +send "e\n" +sleep 1 +send ":ggdG\n" +sleep 1 +send "i" +sleep 1 +send "https://mirror.init7.net/alpinelinux/latest-stable/main\nhttps://mirror.init7.net/alpinelinux/latest-stable/community\n@edge https://mirror.init7.net/alpinelinux/edge/main\n@edge https://mirror.init7.net/alpinelinux/edge/community\n@testing https://mirror.init7.net/alpinelinux/edge/testing\n# " +sleep 1 +send "\x1b" +sleep 1 +send ":wq\n" + +expect "Setup a user?" +send "lain\n" +expect "Full name for user lain" +send "Lain\n" +expect "New password: " +send "\n" +expect "Retype password: " +send "\n" +expect "Enter ssh key or URL for lain" +send "[SSHKEY]\n" +expect "Which ssh server?" +send "\n" + +expect "Which disk(s) would you like to use?" +send "sdb\n" + +expect "How would you like to use it?" +send "cryptsys\n" + +expect "WARNING: Erase the above disk(s) and continue?" +sleep 0.1 +send "y\n" + +expect "Enter passphrase for" +sleep 0.1 +send "pass\n" +expect "Verify passphrase" +sleep 0.1 +send "pass\n" +expect "Enter passphrase for" +sleep 0.1 +send "pass\n" + +set timeout 600 + +expect "Installation is complete. Please reboot." +sleep 1 +set timeout 15 +send "poweroff\n" +expect eof |