yhkylin-backup-tools/debian/yhkylin-backup-tools.postinst

42 lines
1.1 KiB
Bash

#!/bin/bash
# kybackup脚本从local-bottom迁移到init-bottom下面
if [ -e "/usr/share/initramfs-tools/scripts/local-bottom/kybackup" ]; then
rm -f /usr/share/initramfs-tools/scripts/local-bottom/kybackup > /dev/null 2>&1
fi
# kybackup改为yhkylin-backup-tools
if [ -e "/usr/share/kylin-user-guide/data/guide/kybackup" ]; then
rm -rf /usr/share/kylin-user-guide/data/guide/kybackup > /deb/null 2>&1
fi
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