diff --git a/CHANGELOG b/CHANGELOG index 6169ccb82..5d2e59716 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,5 @@ On the road to 2024.09: +- added custom autorun script support --- Highlights 2024.08: - added clean-blockdevice.sh script diff --git a/usr/lib/archboot/cpio/hooks/base_common_system b/usr/lib/archboot/cpio/hooks/base_common_system index d5cf4232f..86b2c422c 100644 --- a/usr/lib/archboot/cpio/hooks/base_common_system +++ b/usr/lib/archboot/cpio/hooks/base_common_system @@ -146,5 +146,9 @@ linux-with-alt-and-altgr,linux-keys-bare}.inc,qwerty/us.map.gz} \ _symlink "/etc/ssl/cert.pem" "../ca-certificates/extracted/tls-ca-bundle.pem" _symlink "/etc/ssl/certs/ca-certificates.crt" "../../ca-certificates/extracted/tls-ca-bundle.pem" _map _file /usr/share/{ca-certificates/trust-source/mozilla.trust.p11-kit,p11-kit/modules/p11-kit-trust.module} + # add custom autrun script + if [[ -f /etc/archboot/run/autorun.sh ]]; then + _file /etc/archboot/run/autorun.sh + fi } diff --git a/usr/lib/archboot/login.sh b/usr/lib/archboot/login.sh index 5e0259826..3642e5f81 100644 --- a/usr/lib/archboot/login.sh +++ b/usr/lib/archboot/login.sh @@ -109,6 +109,35 @@ _run_update_installer() { fi } +_run_autorun() { + if rg -q 'autorun=' /proc/cmdline && [[ ! -e "${_LOCAL_DB}" ]]; then + _REMOTE_AUTORUN="$(rg -o 'autorun=(.*sh)' -r '$1' /proc/cmdline)" + echo -n "Trying 30 seconds to download ${_REMOTE_AUTORUN}..." + _COUNT="" + while true; do + sleep 1 + if ${_DLPROG} -o /etc/archboot/run/autorun.sh "${_REMOTE_AUTORUN}"; then + echo " => Success." + break + fi + _COUNT=$((_COUNT+1)) + if [[ "${_COUNT}" == 30 ]]; then + echo " => Error: Download failed!" + sleep 5 + break + fi + done + fi + if [[ -f /etc/archboot/run/autorun.sh ]]; then + echo + echo "Running custom autorun.sh..." + echo "Waiting for pacman keyring..." + _pacman_keyring + chmod 755 /etc/archboot/run/autorun.sh + ./etc/archboot/run/autorun.sh + fi +} + if [[ "${_TTY}" = "tty1" ]] ; then if ! mount | rg -q 'zram0'; then _TITLE="archboot.com | ${_RUNNING_ARCH} | ${_RUNNING_KERNEL} | Basic Setup | ZRAM" @@ -125,6 +154,7 @@ if [[ "${_TTY}" = "tty1" ]] ; then # initialize pacman keyring [[ -e /etc/systemd/system/pacman-init.service ]] && systemctl start pacman-init fi + _run_autorun fi # start bottom on VC6 while [[ "${_TTY}" = "tty6" ]] ; do