| 123456789101112131415161718192021222324252627282930 |
- #!/bin/bash
- # Licence : GPL v3
- # Author: Laurent HUBERT
- #
- # Deploys the first boot initialization scripts on a system
- if [[ $EUID -ne 0 ]]; then
- echo "This script cannot work if not super-user. Please run as root" 1>&2
- exit 1
- fi
- SYSTEMD_DIR=/etc/systemd/system
- FIRST_BOOT_BASE_DIR=/etc/first-boot
- FIRST_BOOT_SCRIPTS_DIR=$FIRST_BOOT_BASE_DIR/scripts
- cp first-boot-init.service ${SYSTEMD_DIR}
- mkdir -p $FIRST_BOOT_SCRIPTS_DIR
- rm $FIRST_BOOT_SCRIPTS_DIR/*
- cp first-boot-script $FIRST_BOOT_BASE_DIR/
- cp scripts/* $FIRST_BOOT_SCRIPTS_DIR
- # Resets the flag file
- touch $FIRST_BOOT_BASE_DIR/.mustrun
- # Deploys
- #https://unix.stackexchange.com/questions/265014/how-to-start-a-script-on-tty-instead-of-asking-for-login-in-systemd
- #https://stackoverflow.com/questions/14152026/how-can-i-automatically-login-on-a-tty-and-execute-a-script
- #https://unix.stackexchange.com/questions/401759/automatically-login-on-debian-9-2-1-command-line
- systemctl enable first-boot-init.service
- echo "You can now run rm -r on this directory"
- echo "e.g. :"
- echo "\$ cd .."
- echo "\$ rm -r $(pwd)"
|