Skip to content

Commit 546675c

Browse files
committed
fix(system): improve overlayfs module config handling and status check
- Always generate clean overlayroot.conf instead of relying on .dpkg-new - Fix status command to run overlayroot-chroot with 'true' to avoid hang - Remove unnecessary apt purge from remove command Signed-off-by: Igor Pecovnik <igor@armbian.com>
1 parent f00c6ce commit 546675c

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

tools/modules/system/module_overlayfs.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,32 @@ function module_overlayfs() {
2525

2626
case "$1" in
2727
"${commands[0]}")
28-
pkg_install -o Dpkg::Options::="--force-confold" overlayroot cryptsetup cryptsetup-bin
29-
[[ ! -f /etc/overlayroot.conf ]] && cp /etc/overlayroot.conf.dpkg-new /etc/overlayroot.conf
30-
sed -i "s/^overlayroot=.*/overlayroot=\"tmpfs\"/" /etc/overlayroot.conf
28+
pkg_install --reinstall -o Dpkg::Options::="--force-confold" overlayroot
29+
cat > /etc/overlayroot.conf <<-EOT
30+
# overlayroot config - managed by configng
31+
overlayroot_cfgdisk="disabled"
32+
overlayroot="tmpfs"
33+
EOT
3134
rm -f /etc/update-motd.d/97-overlayroot
35+
3236
if $DIALOG --title " Reboot required " --yes-button "Reboot" --no-button "Cancel" --yesno \
3337
"A reboot is required to apply the changes. Shall we reboot now?" 7 34; then
3438
reboot
3539
fi
3640
;;
3741
"${commands[1]}")
3842
overlayroot-chroot rm /etc/overlayroot.conf > /dev/null 2>&1
39-
pkg_remove overlayroot cryptsetup cryptsetup-bin
4043
if $DIALOG --title " Reboot required " --yes-button "Reboot" --no-button "Cancel" --yesno \
4144
"A reboot is required to apply the changes. Shall we reboot now?" 7 34; then
4245
reboot
4346
fi
4447
;;
4548
"${commands[2]}")
46-
if command -v overlayroot-chroot > /dev/null 2>&1; then
47-
return 0
48-
else
49-
return 1
50-
fi
49+
overlayroot-chroot true > /dev/null 2>&1
50+
case $? in
51+
0) return 0 ;;
52+
*) return 1 ;;
53+
esac
5154
;;
5255
"${commands[3]}")
5356
echo -e "\nUsage: ${module_options["module_overlayfs,feature"]} <command>"

0 commit comments

Comments
 (0)