summaryrefslogtreecommitdiffstats
path: root/install-lilo.sh
diff options
context:
space:
mode:
Diffstat (limited to 'install-lilo.sh')
-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}"