Skip to content

Commit e85ef08

Browse files
committed
fix ovl file detection again
1 parent 33742de commit e85ef08

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

headless.apkovl.tar.gz

107 Bytes
Binary file not shown.

overlay/etc/local.d/headless.start

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ install -dm 0700 /tmp/.trash
5151

5252
# grab used ovl filename from dmesg
5353
ovl="$( dmesg | grep -o 'Loading user settings from .*:' | awk '{print $5}' | sed 's/:.*$//' )"
54-
ovlpath="$( dirname "$ovl" )"
54+
ovl="$( basename "${ovl}" )"
55+
# search path again as mountpoint may have been changed later in the boot process...
56+
ovlpath=$( find /media -maxdepth 2 -type d -path '*/.*' -prune -o -type f -name "${ovl}" -exec dirname {} \; | head -1 )
5557

5658
# Help randomness for wpa_supplicant and ssh server
5759
rc-service seedrng start
@@ -163,7 +165,7 @@ cat <<-EOF > /tmp/.trash/banner
163165
Alpine Linux headless bootstrap v$VERSION by macmpi
164166
165167
You may want to delete/rename .apkovl file before reboot ${warn}:
166-
$ovl
168+
${ovlpath}/${ovl}
167169
(can be done automatically with unattended script - see sample snippet)
168170
169171

sample_unattended.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ sleep 60
1414

1515

1616
## This snippet removes apkovl file on volume after initial boot
17+
# grab used ovl filename from dmesg
1718
ovl="$( dmesg | grep -o 'Loading user settings from .*:' | awk '{print $5}' | sed 's/:.*$//' )"
18-
ovlpath="$( dirname "$ovl" )"
19+
ovl="$( basename "${ovl}" )"
20+
# search path again as mountpoint may have been changed later in the boot process...
21+
ovlpath=$( find /media -maxdepth 2 -type d -path '*/.*' -prune -o -type f -name "${ovl}" -exec dirname {} \; | head -1 )
1922

2023
# also works in case volume is mounted read-only
2124
grep -q "${ovlpath}.*[[:space:]]ro[[:space:],]" /proc/mounts; RO=$?
2225
[ "$RO" -eq "0" ] && mount -o remount,rw "${ovlpath}"
23-
rm -f "${ovl}"
26+
rm -f "${ovlpath}/${ovl}"
2427
[ "$RO" -eq "0" ] && mount -o remount,ro "${ovlpath}"
2528

2629
########################################################

0 commit comments

Comments
 (0)