summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-11-10 22:37:11 (EST)
committer P. J. McDermott <pj@pehjota.net>2014-11-10 22:37:53 (EST)
commit431136fdd54c02ae09d0fca5b63123c3205110c3 (patch)
treeb1255249961a112b759a40b385614d475f20fee0
parent75631becb774d7c55047c31c44bad7b30818420d (diff)
install-lilo: Use PARTUUID for root option
-rw-r--r--install-lilo.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/install-lilo.sh b/install-lilo.sh
index 987b7a5..a421a36 100644
--- a/install-lilo.sh
+++ b/install-lilo.sh
@@ -5,6 +5,13 @@ set -u
main()
{
local boot=
+ local root=
+ local rootdev=
+ local rootpart=
+ local b4=
+ local b3=
+ local b2=
+ local b1=
[ "x$(id -u)" = 'x0' ] || error 'Must be run as the superuser'
@@ -16,6 +23,15 @@ main()
boot="$(mountpoint -n /boot | cut -d ' ' -f 1)"
boot="${boot%%[0-9]}"
root="$(mountpoint -n / | cut -d ' ' -f 1)"
+ rootdev="$(printf '%s\n' "${root}" | \
+ sed 's|^\([/a-zA-Z]*\)\([0-9]*\)|\1|')"
+ rootpart="$(printf '%s\n' "${root}" | \
+ sed 's|^\([/a-zA-Z]*\)\([0-9]*\)|\2|')"
+ read b4 b3 b2 b1 <<-EOF
+ $(od -An -tx1 -v -j 440 -N 4 "${rootdev}")
+ EOF
+ root="$(printf 'PARTUUID=%s-%02d\n' \
+ "${b1}${b2}${b3}${b4}" ${rootpart})"
elif [ ${#} -eq 2 ]; then
boot="${1}"
root="${2}"