#!/bin/sh -e [ "$(id -u)" -eq 0 ] || { echo 'This script must be run as root!'; exit 1; } if [ ! -d /home/cb ] then echo "Adding user cb" adduser cb addgroup cb audio addgroup cb input addgroup cb netdev addgroup cb video addgroup cb wheel sed -in "s/^tty1.*/tty1::respawn:\/bin\/login -f cb/" /etc/inittab fi if ! grep -q sodface.com /etc/apk/repositories then echo "http://www.sodface.com/repo" >> /etc/apk/repositories wget -O - http://www.sodface.com/repo/sodface-pub-key.tar.gz \ | tar xzvf - -C /etc/apk/keys apk update fi if [ ! -x /usr/bin/herbstluftwm ] then apks=" adwaita-icon-theme font-opensans herbstluftwm mesa-dri-gallium mesa-egl picom ttf-dejavu " setup-xorg-base ${apks} apks=" alsa-utils bluez brightnessctl chromium dbus doas feh harfbuzz-utils jivelite libsgestures-hlwm mpv netpbm openresolv pipewire pipewire-alsa pipewire-pulse pipewire-spa-bluez pipewire-tools rng-tools sakura sod-svkbd squeezelite util-linux-misc wireplumber xdotool xlunch xset " apk add ${apks} echo "permit nopass :wheel" >> /etc/doas.d/doas.conf ln -s /usr/bin/herbstclient /usr/bin/hc rc-update add alsa rc-update add bluetooth rc-update add dbus rc-update add iwd rc-update add swclock boot rc-update add rngd boot fi if [ "$1" = "jeep" ] && [ ! -x /usr/sbin/gpsd ] then apks=" gpsd gpsd-clients lms rsync spotty " apk add ${apks} cat <<-EOF >> /etc/conf.d/gpsd GPSD_OPTIONS="-n" DEVICES="/dev/ttyUSB0" EOF rc-update add gpsd echo "permit nopass :wheel" >> /etc/doas.d/doas.conf echo "PARTUUID=478d0316-5a32-a049-bae6-e3af0883fce4 /srv ext4 rw,relatime 0 0" >> /etc/fstab sed -in '/^depend/,+5d' /etc/init.d/squeezelite cat <<-EOF >> /etc/conf.d/squeezelite SL_SERVERIP="-s 127.0.0.1" SL_USER=squeezelite SL_OPTS="-n Jeep -m 00:01:80:8a:45:e4" EOF sed -in '/^depend/,+3d' /etc/init.d/lms cat <<-EOF >> /etc/conf.d/lms LMS_OPTS="--advertiseaddr 127.0.0.1 --httpaddr 127.0.0.1 --cliaddr 127.0.0.1 --playeraddr 127.0.0.1 --nomysqueezebox" EOF sed -in '$d' /etc/conf.d/hwclock echo 'clock_args="--rtc=/dev/rtc"' >> /etc/conf.d/hwclock fi tmp=$(mktemp -td cb.XXXXXX) wget -O - http://www.sodface.com/repo/cb/aopen-veyron/setup-cb.tar.gz \ | tar xzvf - -C ${tmp} install -Dm 644 ${tmp}/files/asound.state -t /var/lib/alsa install -Dm 755 ${tmp}/files/autostart -t /home/cb/.config/herbstluftwm install -Dm 644 ${tmp}/files/dot-profile /home/cb/.profile install -Dm 644 ${tmp}/files/dot-xinitrc /home/cb/.xinitrc install -Dm 644 ${tmp}/files/dot-xserverrc /home/cb/.xserverrc install -Dm 755 ${tmp}/files/hc-gesture -t /usr/bin install -Dm 755 ${tmp}/files/hc-xlunch -t /usr/bin install -Dm 644 ${tmp}/files/sakura.conf -t /home/cb/.config/sakura install -Dm 755 ${tmp}/files/xlunch-fp -t /usr/bin install -Dm 755 ${tmp}/files/xlunch-dt -t /usr/bin install -Dm 755 ${tmp}/files/xlunch-bt -t /usr/bin install -Dm 644 ${tmp}/icons/* -t /home/cb/.config/icons install -Dm 644 ${tmp}/sounds/* -t /home/cb/.config/sounds install -Dm 644 ${tmp}/video/* -t /srv/video install -Dm 644 ${tmp}/wallpaper/* -t /home/cb/.config/wallpaper if [ "$1" = "jeep" ] then install -Dm 644 ${tmp}/files/99-rtc1.rules -t /etc/udev/rules.d install -Dm 644 ${tmp}/files/blacklist_uas.conf -t /etc/modprobe.d install -Dm 644 ${tmp}/files/SlimDiscoveryApplet.lua -t /usr/share/jive/applets/SlimDiscovery install -Dm 644 ${tmp}/files/NowPlayingApplet.lua -t /usr/share/jive/applets/NowPlaying install -Dm 644 ${tmp}/files/JogglerSkinApplet.lua -t /usr/share/jive/applets/JogglerSkin fi chown -R cb:cb /home/cb /srv/video rm -rf ${tmp} echo "Done, please reboot."