From a536eecee3a88aeb1586706a66c44ab30a7d6a19 Mon Sep 17 00:00:00 2001 From: Ing Date: Fri, 9 Aug 2024 20:02:33 +0800 Subject: [PATCH] fix the bootloader disk read-only --- files/initrd/opt/rr/include/functions.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/initrd/opt/rr/include/functions.sh b/files/initrd/opt/rr/include/functions.sh index 7a33db59..306efc19 100755 --- a/files/initrd/opt/rr/include/functions.sh +++ b/files/initrd/opt/rr/include/functions.sh @@ -7,6 +7,11 @@ ############################################################################### # Check loader disk function checkBootLoader() { + while read KNAME RO; do + [ -z "${KNAME}" ] && continue + [ "${RO}" = "0" ] && continue + hdparm -r0 "${KNAME}" >/dev/null 2>&1 || true + done <<<$(lsblk -pno KNAME,RO 2>/dev/null) [ ! -w "${PART1_PATH}" ] && return 1 [ ! -w "${PART2_PATH}" ] && return 1 [ ! -w "${PART3_PATH}" ] && return 1