| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #!/bin/bash
- # Licence : GPL v3
- # Author: Laurent HUBERT
- #
- # Executes each script from scripts dir if they are executable
- FIRST_BOOT_BASE_DIR=/etc/first-boot
- FIRST_BOOT_SCRIPTS_DIR=$FIRST_BOOT_BASE_DIR/scripts
- if [ ! -r /etc/first-boot/.mustrun ]
- then
- exit 0
- fi
- cat <<EOF
- ###############################################
- # FIRST BOOT INITIALIZATION SCRIPT #
- ###############################################
- EOF
- if [[ $EUID -ne 0 ]]; then
- echo "This script cannot work if not super-user. Please run as root" 1>&2
- exit 1
- fi
- for f in $(ls $FIRST_BOOT_SCRIPTS_DIR/*)
- do
- if [ -x $f ] ; then
- $f $FIRST_BOOT_BASE_DIR
- status=$?
- if [ 0 -ne "$status" ] ; then
- echo "#ERROR# : script $f did not finish with success status !"
- cat <<EOF
- ###############################################
- ###############################################
- # FIRST BOOT INITIALIZATION : ERROR #
- # Please reboot your system #
- ###############################################
- ###############################################
- EOF
- exit $status
- fi
- fi
- done
- rm $FIRST_BOOT_BASE_DIR/.mustrun
- systemctl disable first-boot-init.service
- cat <<EOF
- ###############################################
- # FIRST BOOT INITIALIZATION : success #
- ###############################################
- EOF
- # Starts tty1 after that script is finished
- systemctl start getty@tty1.service
- exit 0
|