| 1234567891011121314151617181920212223242526272829303132333435 |
- #!/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
- 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
- echo Executing $f $FIRST_BOOT_BASE_DIR
- $f $FIRST_BOOT_BASE_DIR
- status=$?
- if [ 0 -ne "$status" ] ; then
- echo "#ERROR# : script $f did not finish with success status !"
- exit $status
- fi
- fi
- done
- rm $FIRST_BOOT_BASE_DIR/.mustrun
- systemctl disable first-boot-init.service
- exit 0
|