#!/bin/bash boot_is_ro=false bootefi_is_ro=false remount_boot_rw() { if mount | grep "/boot " | grep ro,; then mount -o rw,remount /boot boot_is_ro=true fi if mount | grep "/boot/efi " | grep ro,; then mount -o rw,remount /boot/efi bootefi_is_ro=true fi } remount_boot_ro() { if [ "$boot_is_ro" = "true" ]; then mount -o ro,remount /boot fi if [ "$bootefi_is_ro" = "true" ]; then mount -o ro,remount /boot/efi fi } remount_boot_rw #INITRAMFS_MODULES=$(sed -n 20p /etc/initramfs-tools/initramfs.conf) #DEP=${INITRAMFS_MODULES:0-3} #if [ xdep = x"$DEP" ];then update-initramfs -u # update-grub #fi remount_boot_ro