Skip to content

Commit 163a62e

Browse files
committed
Don't modify /etc until boot/05-persistent-data-volume has run
On Alpine the boot script moves /etc and /var/lib to /mnt/data, so on subsequent boots any changes made to before /mnt/data is mounted will be lost. Signed-off-by: Jan Dubois <[email protected]>
1 parent 90e6c9d commit 163a62e

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

pkg/cidata/cidata.TEMPLATE.d/boot.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@ WARNING() {
1212
# shellcheck disable=SC2163
1313
while read -r line; do export "$line"; done <"${LIMA_CIDATA_MNT}"/lima.env
1414

15-
if [ -e /etc/environment ]; then
16-
sed -i '/#LIMA-START/,/#LIMA-END/d' /etc/environment
17-
fi
18-
cat "${LIMA_CIDATA_MNT}/etc_environment" >>/etc/environment
19-
2015
# shellcheck disable=SC2163
2116
while read -r line; do
2217
[ "$(expr "$line" : '#')" -eq 0 ] && export "$line"
2318
done <"${LIMA_CIDATA_MNT}"/etc_environment
2419

2520
CODE=0
2621

22+
# Don't make any changes to /etc or /var/lib until the boot/* scripts have run
23+
# because they might move the directories to /mnt/data on first boot, so changes
24+
# made on restart would be lost.
25+
2726
for f in "${LIMA_CIDATA_MNT}"/boot/*; do
2827
INFO "Executing $f"
2928
if ! "$f"; then
@@ -32,6 +31,11 @@ for f in "${LIMA_CIDATA_MNT}"/boot/*; do
3231
fi
3332
done
3433

34+
if [ -e /etc/environment ]; then
35+
sed -i '/#LIMA-START/,/#LIMA-END/d' /etc/environment
36+
fi
37+
cat "${LIMA_CIDATA_MNT}/etc_environment" >>/etc/environment
38+
3539
if [ -d "${LIMA_CIDATA_MNT}"/provision.system ]; then
3640
for f in "${LIMA_CIDATA_MNT}"/provision.system/*; do
3741
INFO "Executing $f"

0 commit comments

Comments
 (0)