fix ovl file detection again

This commit is contained in:
macmpi 2023-09-20 10:54:22 +02:00
parent 33742dec79
commit e85ef08be2
3 changed files with 9 additions and 4 deletions

Binary file not shown.

View File

@ -51,7 +51,9 @@ install -dm 0700 /tmp/.trash
# grab used ovl filename from dmesg
ovl="$( dmesg | grep -o 'Loading user settings from .*:' | awk '{print $5}' | sed 's/:.*$//' )"
ovlpath="$( dirname "$ovl" )"
ovl="$( basename "${ovl}" )"
# search path again as mountpoint may have been changed later in the boot process...
ovlpath=$( find /media -maxdepth 2 -type d -path '*/.*' -prune -o -type f -name "${ovl}" -exec dirname {} \; | head -1 )
# Help randomness for wpa_supplicant and ssh server
rc-service seedrng start
@ -163,7 +165,7 @@ cat <<-EOF > /tmp/.trash/banner
Alpine Linux headless bootstrap v$VERSION by macmpi
You may want to delete/rename .apkovl file before reboot ${warn}:
$ovl
${ovlpath}/${ovl}
(can be done automatically with unattended script - see sample snippet)

View File

@ -14,13 +14,16 @@ sleep 60
## This snippet removes apkovl file on volume after initial boot
# grab used ovl filename from dmesg
ovl="$( dmesg | grep -o 'Loading user settings from .*:' | awk '{print $5}' | sed 's/:.*$//' )"
ovlpath="$( dirname "$ovl" )"
ovl="$( basename "${ovl}" )"
# search path again as mountpoint may have been changed later in the boot process...
ovlpath=$( find /media -maxdepth 2 -type d -path '*/.*' -prune -o -type f -name "${ovl}" -exec dirname {} \; | head -1 )
# also works in case volume is mounted read-only
grep -q "${ovlpath}.*[[:space:]]ro[[:space:],]" /proc/mounts; RO=$?
[ "$RO" -eq "0" ] && mount -o remount,rw "${ovlpath}"
rm -f "${ovl}"
rm -f "${ovlpath}/${ovl}"
[ "$RO" -eq "0" ] && mount -o remount,ro "${ovlpath}"
########################################################