diff options
author | CyberLeo <cyberleo@cyberleo.net> | 2020-03-28 05:45:52 -0500 |
---|---|---|
committer | CyberLeo <cyberleo@cyberleo.net> | 2020-03-28 05:45:52 -0500 |
commit | 9297468fa579836e3a6a381b798feb6b78217c2d (patch) | |
tree | 53168212f427afbcf0693b534530a4af803152e9 /user/lilo/lilo.trigger | |
parent | a63cc05c53a6f4c22422dc8c69808b14d87a6f6e (diff) | |
parent | da5a69b65a8791fffa6e93366ee585f87eff136d (diff) | |
download | packages-9297468fa579836e3a6a381b798feb6b78217c2d.tar.gz packages-9297468fa579836e3a6a381b798feb6b78217c2d.tar.bz2 packages-9297468fa579836e3a6a381b798feb6b78217c2d.tar.xz packages-9297468fa579836e3a6a381b798feb6b78217c2d.zip |
Merge branch 'master' into zfs
Diffstat (limited to 'user/lilo/lilo.trigger')
-rw-r--r-- | user/lilo/lilo.trigger | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/user/lilo/lilo.trigger b/user/lilo/lilo.trigger new file mode 100644 index 000000000..0f5a802a2 --- /dev/null +++ b/user/lilo/lilo.trigger @@ -0,0 +1,93 @@ +#!/bin/sh -e +conf=/etc/lilo/lilo.conf + +# Check whether LILO is installed +# This function is from /usr/sbin/mkboot from debianutils, with copyright: +# +# Debian GNU/Linux +# Copyright 1996-1997 Guy Maor <maor@debian.org> +# +# Modified for Gentoo for use with the lilo ebuild by: +# Martin Schlemmer <azarah@gentoo.org> (16 Mar 2003) +# +# Modified for Adélie for use with the lilo APKBUILD by: +# Max Rees <maxcrees@me.com> (19 Mar 2020) +lilocheck() { + if ! [ -e "$conf" ]; then + cat >&2 <<-EOF + * + * Could not find '$conf'! + * + EOF + exit 1 + fi + + if grep -q "^[[:space:]]*password[[:space:]]*=[[:space:]]*\"\"" \ + "$conf"; then + cat >&2 <<-EOF + * + * You have requested interactive LILO password setup. + * Run "lilo -p" by hand. + * + EOF + return 1 + fi + + bootpart="$(sed -n "s:^boot[ ]*=[ ]*\(.*\)[ ]*:\1:p" "$conf")" + if ! [ -b "$bootpart" ]; then + cat >&2 <<-EOF + * + * Could not find '$bootpart'! + * + EOF + exit 1 + fi + + if ! dd if="$bootpart" ibs=16 count=1 2>/dev/null | grep -q LILO; then + cat >&2 <<-EOF + * + * No LILO signature found on '$bootpart'. + * You must run 'lilo' yourself. + * + EOF + return 1 + fi +} + +if ! [ -e /etc/fstab ]; then + cat >&2 <<-EOF + * + * You are missing an /etc/fstab file, so liloconfig + * cannot determine the root filesystem. Skipping + * automatic configuration. + * + EOF + exit 0 +fi + +if [ -e "$conf" ] && [ "$conf" -nt "$conf.template" ]; then + cat >&2 <<-EOF + * + * You appear to have manually edited '$conf'. + * LILO configuration will not be automatically regenerated. + * + EOF + exit 0 +fi + +cat >&2 <<-EOF +* +* Running liloconfig... +* +EOF +liloconfig -f "$conf" +touch -r "$conf.template" "$conf" + +if lilocheck; then + cat >&2 <<-EOF + * + * Running lilo... + * + EOF + lilo -C "$conf" +fi |