improve overlay file detection
take name from dmesg add suggestion for removal in banner
This commit is contained in:
parent
6718b1c311
commit
1eca862849
Binary file not shown.
|
@ -11,9 +11,12 @@ exec 1>/dev/console 2>&1
|
||||||
logger -st ${0##*/} "Alpine Linux headless bootstrap v$VERSION by macmpi"
|
logger -st ${0##*/} "Alpine Linux headless bootstrap v$VERSION by macmpi"
|
||||||
|
|
||||||
mkdir /tmp/.trash
|
mkdir /tmp/.trash
|
||||||
ovlpath=$( find /media -maxdepth 2 -type d -path '*/.*' -prune -o -type f -name *.apkovl.tar.gz -exec dirname {} \; | head -1 )
|
|
||||||
|
|
||||||
# Help randomess for wpa_supplicant and ssh server
|
# grab used ovl filename from dmesg
|
||||||
|
ovl="$( dmesg | grep -o 'Loading user settings from .*:' | awk '{print $5}' | sed 's/:.*$//' )"
|
||||||
|
ovlpath="$( dirname "$ovl" )"
|
||||||
|
|
||||||
|
# Help randomness for wpa_supplicant and ssh server
|
||||||
rc-service seedrng start
|
rc-service seedrng start
|
||||||
|
|
||||||
## Setup Network interfaces
|
## Setup Network interfaces
|
||||||
|
@ -95,10 +98,18 @@ cat <<-EOF >> /etc/ssh/sshd_config
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Banner file
|
# Banner file
|
||||||
|
warn=""
|
||||||
|
grep -q "${ovlpath}.*[[:space:]]ro[[:space:],]" /proc/mounts; RO=$?
|
||||||
|
[ "$RO" -eq "0" ] && warn="(remount partition read-write!)"
|
||||||
|
|
||||||
cat <<-EOF > /tmp/.trash/banner
|
cat <<-EOF > /tmp/.trash/banner
|
||||||
|
|
||||||
Alpine Linux headless bootstrap v$VERSION by macmpi
|
Alpine Linux headless bootstrap v$VERSION by macmpi
|
||||||
|
|
||||||
|
You may want to delete/rename overlay before next reboot ${warn}:
|
||||||
|
$ovl
|
||||||
|
(can be done automatically with unattended script - see sample snippet)
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Bundled temporary keys are moved in RAM /tmp so they won't be stored
|
# Bundled temporary keys are moved in RAM /tmp so they won't be stored
|
||||||
|
|
|
@ -14,12 +14,13 @@ sleep 60
|
||||||
|
|
||||||
|
|
||||||
## This snippet removes apkovl file on volume after initial boot
|
## This snippet removes apkovl file on volume after initial boot
|
||||||
ovlpath=$( find /media -maxdepth 2 -type d -path '*/.*' -prune -o -type f -name *.apkovl.tar.gz -exec dirname {} \; | head -1 )
|
ovl="$( dmesg | grep -o 'Loading user settings from .*:' | awk '{print $5}' | sed 's/:.*$//' )"
|
||||||
|
ovlpath="$( dirname "$ovl" )"
|
||||||
|
|
||||||
# also works in case volume is mounted read-only
|
# also works in case volume is mounted read-only
|
||||||
grep -q "${ovlpath}.*[[:space:]]ro[[:space:],]" /proc/mounts; RO=$?
|
grep -q "${ovlpath}.*[[:space:]]ro[[:space:],]" /proc/mounts; RO=$?
|
||||||
[ "$RO" -eq "0" ] && mount -o remount,rw "${ovlpath}"
|
[ "$RO" -eq "0" ] && mount -o remount,rw "${ovlpath}"
|
||||||
rm "${ovlpath}"/*.apkovl.tar.gz
|
rm -f "${ovl}"
|
||||||
[ "$RO" -eq "0" ] && mount -o remount,ro "${ovlpath}"
|
[ "$RO" -eq "0" ] && mount -o remount,ro "${ovlpath}"
|
||||||
|
|
||||||
########################################################
|
########################################################
|
||||||
|
|
Loading…
Reference in New Issue