void-usb/custom-scripts/server.sh

48 lines
1.2 KiB
Bash

#!/usr/bin/env bash
# NAME: Server Profile
# DESC: Installs an SSH server and adds SSH session friendly configuration
xbps-install -y -S openssh
ln -s /etc/sv/sshd /var/service
sleep 7 # arbitrary number, sv manual mentions taking 7s to check things
sv down sshd
echo '
echo "This file is overridden by /run/void-usb/system-image-auto-confirm-marker, if it exists." > /run/void-usb/system-image-auto-reject-marker' >> /etc/rc.local
echo -e "\033[01mWelcome to Void-USB!\033[0m
\033[93mImportant\033[91m!\033[0m This system was booted off an image. Runtime changes outside
of mounted partitions are made to an ephemeral overlay and \033[93mwill be lost\033[0m
on shutdown/reboot.
If you wish to persist your changes to the image, use \\\`\033[01msave-image\033[0m\\\`.
" > /etc/motd
function yesno {
unset DISCARD_ME
while [ -z "$DISCARD_ME" ]; do
read -p "[y/n] " -n1 DISCARD_ME
case "$DISCARD_ME" in
y)
echo ""
return 0
;;
n)
echo ""
return 1
;;
*)
echo " Please enter y for yes or n for no."
unset DISCARD_ME
;;
esac
done
}
clear
echo "(Re-)Configure network settings?"
if yesno; then
nmtui
fi