20200117 release

OverlayFS - remove initramfs when disabled
This commit is contained in:
Serge Schneider 2020-01-17 11:51:49 +00:00
parent de8a8dadae
commit 5a888f7e35
2 changed files with 26 additions and 18 deletions

5
debian/changelog vendored
View File

@ -1,4 +1,4 @@
raspi-config (20200109) UNRELEASED; urgency=medium raspi-config (20200117) buster; urgency=medium
* Add proxy configuration * Add proxy configuration
* Handle cases where SUDO_USER is unset * Handle cases where SUDO_USER is unset
@ -6,8 +6,9 @@ raspi-config (20200109) UNRELEASED; urgency=medium
* Install required packages when changing GL settings * Install required packages when changing GL settings
* Add warning when enabling SSH * Add warning when enabling SSH
* OverlayFS - try loading module from rootfs * OverlayFS - try loading module from rootfs
* OverlayFS - remove initramfs when disabled
-- Serge Schneider <serge@raspberrypi.org> Thu, 09 Jan 2020 14:38:50 +0000 -- Serge Schneider <serge@raspberrypi.org> Fri, 17 Jan 2020 11:50:54 +0000
raspi-config (20191210) buster; urgency=medium raspi-config (20191210) buster; urgency=medium

View File

@ -1860,6 +1860,11 @@ get_bootro_conf() {
grep /boot /etc/fstab | grep -q "defaults.*,ro " grep /boot /etc/fstab | grep -q "defaults.*,ro "
} }
is_uname_current() {
test -d "/lib/modules/$(uname -r)"
return $?
}
enable_overlayfs() { enable_overlayfs() {
KERN=$(uname -r) KERN=$(uname -r)
INITRD=initrd.img-"$KERN"-overlay INITRD=initrd.img-"$KERN"-overlay
@ -1875,10 +1880,6 @@ enable_overlayfs() {
BOOTRO=no BOOTRO=no
fi fi
# check that the modified initramfs is available for the current kernel version
if [ ! -e /boot/"$INITRD" ]; then
# generate the modified initramfs - check that the overlay file is available
if [ ! -e /etc/initramfs-tools/scripts/overlay ]; then
cat > /etc/initramfs-tools/scripts/overlay << 'EOF' cat > /etc/initramfs-tools/scripts/overlay << 'EOF'
# Local filesystem mounting -*- shell-script -*- # Local filesystem mounting -*- shell-script -*-
@ -1933,7 +1934,6 @@ local_mount_root()
overlay ${rootmnt} overlay ${rootmnt}
} }
EOF EOF
fi
# add the overlay to the list of modules # add the overlay to the list of modules
if ! grep overlay /etc/initramfs-tools/modules > /dev/null; then if ! grep overlay /etc/initramfs-tools/modules > /dev/null; then
@ -1945,7 +1945,6 @@ EOF
# rename it so we know it has overlay added # rename it so we know it has overlay added
mv /boot/initrd.img-"$KERN" /boot/"$INITRD" mv /boot/initrd.img-"$KERN" /boot/"$INITRD"
fi
# there is now a modified initramfs ready for use... # there is now a modified initramfs ready for use...
@ -1966,6 +1965,7 @@ EOF
} }
disable_overlayfs() { disable_overlayfs() {
KERN=$(uname -r)
# mount the boot partition as writable if it isn't already # mount the boot partition as writable if it isn't already
if get_bootro_now ; then if get_bootro_now ; then
if ! mount -o remount,rw /boot 2>/dev/null ; then if ! mount -o remount,rw /boot 2>/dev/null ; then
@ -1979,6 +1979,7 @@ disable_overlayfs() {
# modify config.txt # modify config.txt
sed -i /boot/config.txt -e "/initramfs.*/d" sed -i /boot/config.txt -e "/initramfs.*/d"
update-initramfs -d -k "${KERN}-overlay"
# modify command line # modify command line
sed -i /boot/cmdline.txt -e "s/\(.*\)boot=overlay \(.*\)/\1\2/" sed -i /boot/cmdline.txt -e "s/\(.*\)boot=overlay \(.*\)/\1\2/"
@ -2010,6 +2011,12 @@ do_overlayfs() {
DEFAULT=--defaultno DEFAULT=--defaultno
CURRENT=0 CURRENT=0
STATUS="disabled" STATUS="disabled"
if [ "$INTERACTIVE" = True ] && ! is_uname_current; then
whiptail --msgbox "Could not find modules for the running kernel ($(uname -r))." 20 60 1
return 1
fi
if get_overlay_conf; then if get_overlay_conf; then
DEFAULT= DEFAULT=
CURRENT=1 CURRENT=1