90 lines
2.4 KiB
Bash
Executable File
90 lines
2.4 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -x
|
|
|
|
FILE=$(mktemp /tmp/file.XXXXXXXXXXXXXXXXXXXXX)
|
|
|
|
cat <<EOF >$FILE
|
|
|
|
sed -i 's/^#X11Forwarding no/X11Forwarding yes/' /etc/ssh/sshd_config
|
|
|
|
echo "permit nopass keepenv user" > /etc/doas.conf
|
|
echo 'https://cdn.openbsd.org/pub/OpenBSD/' > /etc/installurl
|
|
|
|
if ! grep 'library_aslr=NO' /etc/rc.conf.local >/dev/null
|
|
then
|
|
echo 'library_aslr=NO' >> /etc/rc.conf.local
|
|
fi
|
|
|
|
pkg_add openbox neofetch xneko dillo firefox-esr chromium claws-mail-- thunar keepassxc-- lagrange clic catgirl dino aerc xfce4-terminal stumpwm xclip mousepad
|
|
|
|
# we want sshd to be started by rc.local
|
|
# so copied/mounted /home is ready
|
|
rcctl disable sshd
|
|
|
|
# enable sndiod with a higher buffer to prevent stuttering
|
|
rcctl enable sndiod
|
|
rcctl set sndiod flags -b34000
|
|
|
|
cat <<NESTED >/etc/stumpwmrc
|
|
(setf *startup-message* nil)
|
|
(defun st-kill-empty (a)
|
|
(if (= 0 (length (screen-windows (current-screen))))
|
|
(stumpwm:quit)))
|
|
(stumpwm:add-hook stumpwm:*destroy-window-hook* 'st-kill-empty)
|
|
NESTED
|
|
|
|
cat <<NESTED >/etc/rc.local
|
|
#!/bin/sh
|
|
HOST=\\\$(awk '/^host-name/ { print \\\$2}' /var/db/dhcpleased/vio0)
|
|
hostname "\\\${HOST}.kube"
|
|
|
|
# this triggers in non-templates
|
|
if sysctl hw.disknames | grep sd1 >/dev/null
|
|
then
|
|
mount -o noatime -u /usr/local
|
|
mount -o noatime -u /usr/X11R6
|
|
mount -o noatime -u /usr
|
|
mount -o noatime -u /tmp
|
|
mount -o noatime -u /var
|
|
mount -o noatime -u /
|
|
|
|
if ! dumpfs /dev/rsd1c >/dev/null 2>/dev/null
|
|
then
|
|
echo "Formatting the empty disk"
|
|
fdisk -iy sd1c
|
|
disklabel -d sd1
|
|
newfs /dev/rsd1c
|
|
mount /dev/sd1c /mnt/
|
|
cd /home/ && pax -rw -p e . /mnt && cd -
|
|
umount /mnt
|
|
fi
|
|
echo "fsck and mounting the disk on /home"
|
|
fsck_ffs -y /dev/rsd1c
|
|
|
|
mount -o rw,nodev,noatime,nosuid /dev/sd1c /home
|
|
install -d -o root /home/openkubsd/
|
|
if ! test -f /home/openkubsd/rc.local
|
|
then
|
|
printf '#!/bin/sh\n\n# use this file to add Kube specific boot commands\n' > /home/openkubsd/rc.local
|
|
chmod +x /home/openkubsd/rc.local
|
|
fi
|
|
/home/openkubsd/rc.local
|
|
install -d -o user /shared/
|
|
mount 10.100.0.1:/var/openkubsd/shared/\\\$(hostname -s) /shared/
|
|
fi
|
|
/etc/rc.d/sshd -f start
|
|
NESTED
|
|
chmod +x /etc/rc.local
|
|
|
|
# stop the template
|
|
halt
|
|
EOF
|
|
|
|
./connect.sh openbsd-template "xterm -e /bin/sh -c 'sleep 5 && exit'"
|
|
|
|
cat $FILE | ssh -o StrictHostKeyChecking=no root@openbsd-template.kube "cat >/$FILE"
|
|
ssh -o StrictHostKeyChecking=no root@openbsd-template.kube "sh /$FILE"
|
|
|
|
rm "$FILE"
|