packer/debian/13-trixie-luks/files/90-initial-login-setup.sh

26 lines
730 B
Bash

#! /bin/sed 2,5!d;s/^#.//
# This script must be sourced from within a shell
# and not executed. For instance with:
#
# . /usr/local/bin/initial-setup.sh
# Only run in interactive shells
case $- in
*i*) ;;
*) return ;;
esac
if [ "$EUID" -ne 0 ]; then
if ! command -v sudo >/dev/null 2>&1 || ! sudo -n true >/dev/null 2>&1; then
echo "Error: must be root or have sudo privileges to run initial login setup." >&2
return
fi
fi
SENTINEL="/var/lib/initial-login-setup.done"
if [ ! -f "$SENTINEL" ] && [ -x /usr/local/bin/initial-setup.sh ]; then
#DEBUG touch SENTINEL before running the setup script to prevent infinite loops during development
sudo /usr/local/bin/initial-setup.sh
sudo touch "$SENTINEL"
fi