mirror of
				https://github.com/brain-hackers/brain-config.git
				synced 2025-11-04 14:38:36 +09:00 
			
		
		
		
	20200117 release
OverlayFS - remove initramfs when disabled
This commit is contained in:
		
							
								
								
									
										5
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
raspi-config (20200109) UNRELEASED; urgency=medium
 | 
			
		||||
raspi-config (20200117) buster; urgency=medium
 | 
			
		||||
 | 
			
		||||
  * Add proxy configuration
 | 
			
		||||
  * Handle cases where SUDO_USER is unset
 | 
			
		||||
@@ -6,8 +6,9 @@ raspi-config (20200109) UNRELEASED; urgency=medium
 | 
			
		||||
  * Install required packages when changing GL settings
 | 
			
		||||
  * Add warning when enabling SSH
 | 
			
		||||
  * 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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										39
									
								
								raspi-config
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								raspi-config
									
									
									
									
									
								
							@@ -1860,6 +1860,11 @@ get_bootro_conf() {
 | 
			
		||||
  grep /boot /etc/fstab | grep -q "defaults.*,ro "
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
is_uname_current() {
 | 
			
		||||
  test -d "/lib/modules/$(uname -r)"
 | 
			
		||||
  return $?
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
enable_overlayfs() {
 | 
			
		||||
  KERN=$(uname -r)
 | 
			
		||||
  INITRD=initrd.img-"$KERN"-overlay
 | 
			
		||||
@@ -1875,11 +1880,7 @@ enable_overlayfs() {
 | 
			
		||||
    BOOTRO=no
 | 
			
		||||
  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 -*-
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
@@ -1933,20 +1934,18 @@ local_mount_root()
 | 
			
		||||
	    overlay ${rootmnt}
 | 
			
		||||
}
 | 
			
		||||
EOF
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # add the overlay to the list of modules
 | 
			
		||||
    if ! grep overlay /etc/initramfs-tools/modules > /dev/null; then
 | 
			
		||||
      echo overlay >> /etc/initramfs-tools/modules
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # build the new initramfs
 | 
			
		||||
    update-initramfs -c -k "$KERN"
 | 
			
		||||
 | 
			
		||||
    # rename it so we know it has overlay added
 | 
			
		||||
    mv /boot/initrd.img-"$KERN" /boot/"$INITRD"
 | 
			
		||||
  # add the overlay to the list of modules
 | 
			
		||||
  if ! grep overlay /etc/initramfs-tools/modules > /dev/null; then
 | 
			
		||||
    echo overlay >> /etc/initramfs-tools/modules
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  # build the new initramfs
 | 
			
		||||
  update-initramfs -c -k "$KERN"
 | 
			
		||||
 | 
			
		||||
  # rename it so we know it has overlay added
 | 
			
		||||
  mv /boot/initrd.img-"$KERN" /boot/"$INITRD"
 | 
			
		||||
 | 
			
		||||
  # there is now a modified initramfs ready for use...
 | 
			
		||||
 | 
			
		||||
  # modify config.txt
 | 
			
		||||
@@ -1966,6 +1965,7 @@ EOF
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
disable_overlayfs() {
 | 
			
		||||
  KERN=$(uname -r)
 | 
			
		||||
  # mount the boot partition as writable if it isn't already
 | 
			
		||||
  if get_bootro_now ; then
 | 
			
		||||
    if ! mount -o remount,rw /boot 2>/dev/null ; then
 | 
			
		||||
@@ -1979,6 +1979,7 @@ disable_overlayfs() {
 | 
			
		||||
 | 
			
		||||
  # modify config.txt
 | 
			
		||||
  sed -i /boot/config.txt -e "/initramfs.*/d"
 | 
			
		||||
  update-initramfs -d -k "${KERN}-overlay"
 | 
			
		||||
 | 
			
		||||
  # modify command line
 | 
			
		||||
  sed -i /boot/cmdline.txt -e "s/\(.*\)boot=overlay \(.*\)/\1\2/"
 | 
			
		||||
@@ -2010,6 +2011,12 @@ do_overlayfs() {
 | 
			
		||||
  DEFAULT=--defaultno
 | 
			
		||||
  CURRENT=0
 | 
			
		||||
  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
 | 
			
		||||
    DEFAULT=
 | 
			
		||||
    CURRENT=1
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user