add custom autorun script support

This commit is contained in:
Tobias Powalowski 2024-08-31 14:56:28 +02:00
parent fdd898d755
commit 9a4e53777c
3 changed files with 35 additions and 0 deletions

View file

@ -1,4 +1,5 @@
On the road to 2024.09: On the road to 2024.09:
- added custom autorun script support
--- ---
Highlights 2024.08: Highlights 2024.08:
- added clean-blockdevice.sh script - added clean-blockdevice.sh script

View file

@ -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/cert.pem" "../ca-certificates/extracted/tls-ca-bundle.pem"
_symlink "/etc/ssl/certs/ca-certificates.crt" "../../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} _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
} }

View file

@ -109,6 +109,35 @@ _run_update_installer() {
fi 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 [[ "${_TTY}" = "tty1" ]] ; then
if ! mount | rg -q 'zram0'; then if ! mount | rg -q 'zram0'; then
_TITLE="archboot.com | ${_RUNNING_ARCH} | ${_RUNNING_KERNEL} | Basic Setup | ZRAM" _TITLE="archboot.com | ${_RUNNING_ARCH} | ${_RUNNING_KERNEL} | Basic Setup | ZRAM"
@ -125,6 +154,7 @@ if [[ "${_TTY}" = "tty1" ]] ; then
# initialize pacman keyring # initialize pacman keyring
[[ -e /etc/systemd/system/pacman-init.service ]] && systemctl start pacman-init [[ -e /etc/systemd/system/pacman-init.service ]] && systemctl start pacman-init
fi fi
_run_autorun
fi fi
# start bottom on VC6 # start bottom on VC6
while [[ "${_TTY}" = "tty6" ]] ; do while [[ "${_TTY}" = "tty6" ]] ; do