#!/bin/sh -xe # Check root if [ "$(id -u)" -ne "0" ]; then echo "This script must be run as root" exit 1 fi export user="${DOAS_USER:-$SUDO_USER}" if [ -z "$user" ]; then echo "This script must be run as a regular user using sudo or doas" exit 1 fi export homedir="$(getent passwd $user | cut -d ':' -f 6)" # # Install required packages # ========================= echo "Switching release version to edge" cat << EOF > /etc/apk/repositories https://alpinelinux.mirror.garr.it/edge/main https://alpinelinux.mirror.garr.it/edge/community https://alpinelinux.mirror.garr.it/edge/testing EOF echo "Updating system" apk update && apk upgrade echo "Installing packages" for f in pkglist/*; do printf "\tInsalling %s\n" "$f" apk add $(sed -e '/^#.*/d' -e '/^\s*$/d' "$f" | sed ':a;N;$!ba;s/\n/ /g') done # # Setup system # -=========== echo "Setting up system" # shellcheck source=setup_system.sh . setup_system.sh # # Setup services # ============== echo "Setting up system services" # shellcheck source=setup_services.sh . setup_services.sh # # Setup user groups # ================= echo "Setting up user" # shellcheck source=setup_user.sh . setup_user.sh # # Install configs # =============== echo "Installing custom configs" # shellcheck source=setup_config.sh . setup_config.sh # # Start interactive scripts # ========================= echo "Running interactive scripts, pay attention" # shellcheck source=setup_interactive.sh . setup_interactive.sh unset user echo "All done reboot to apply changes"