1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 inherit eutils flag-o-matic toolchain-funcs
7 IUSE="static minimal pxeserial device-mapper"
9 DESCRIPTION="Standard Linux boot loader"
10 HOMEPAGE="http://lilo.go.dyndns.org/pub/linux/lilo/"
11 DOLILO_TAR="dolilo-${DOLILO_V}.tar.bz2"
14 SRC_URI="http://home.san.rr.com/johninsd/pub/linux/lilo/${MY_P}.tar.gz
15 ftp://metalab.unc.edu/pub/Linux/system/boot/lilo/${MY_P}.tar.gz
16 ftp://metalab.unc.edu/pub/Linux/system/boot/lilo/obsolete/${MY_P}.tar.gz
17 mirror://gentoo/${DOLILO_TAR}"
21 KEYWORDS="-* amd64 x86"
23 DEPEND=">=sys-devel/bin86-0.15.5"
24 RDEPEND="device-mapper? ( >=sys-fs/lvm2-2.02.45 )"
31 # Correctly document commandline options -v and -V, bug #43554
32 epatch "${FILESDIR}/${P}-correct-usage-info.patch"
33 # Install manpages to correct location, do not rely on incorrect manpath output, bug #117135
34 # Do not strip the main binary, it upsets portage, bug #140210
35 # Do not install diag1.img, bug #149887
36 epatch "${FILESDIR}/${P}-makefile.patch"
38 # this patch is needed when booting PXE and the device you're using
39 # emulates vga console via serial console.
40 # IE.. B.B.o.o.o.o.t.t.i.i.n.n.g.g....l.l.i.i.n.n.u.u.x.x and stair stepping.
41 use pxeserial && epatch "${FILESDIR}/${P}-novga.patch"
42 use device-mapper || epatch "${FILESDIR}/${P}-nodevmapper.patch"
48 # lilo needs this. bug #140209
51 # we explicitly prevent the custom CFLAGS for stability reasons
53 emake CC="$(tc-getCC)" lilo.static || die
54 mv lilo.static lilo || die
56 emake CC="$(tc-getCC)" lilo || die
62 make ROOT="${D}" install || die
66 dosbin "${S}"/dolilo/dolilo
72 newins "${FILESDIR}"/lilo.conf lilo.conf.example
74 newconfd "${S}"/dolilo/dolilo.conf.d dolilo.example
76 doman manPages/*.[5-8]
77 dodoc CHANGES INCOMPAT README*
78 docinto samples ; dodoc sample/*
82 # Check whether LILO is installed
83 # This function is from /usr/sbin/mkboot from debianutils, with copyright:
86 # Copyright 1996-1997 Guy Maor <maor@debian.org>
88 # Modified for Gentoo for use with the lilo ebuild by:
89 # Martin Schlemmer <azarah@gentoo.org> (16 Mar 2003)
93 local rootpart="$(mount | grep -v "tmpfs" | grep -v "rootfs" | grep "on / " | cut -f1 -d " ")"
96 einfon "Checking for LILO ..."
98 if [ "$(whoami)" != "root" ]
101 eerror "Only root can check for LILO!"
105 if [ -z "${rootpart}" ]
108 eerror "Could not determine root partition!"
112 if [ ! -f /etc/lilo.conf -o ! -x /sbin/lilo ]
118 bootpart="$(sed -n "s:^boot[ ]*=[ ]*\(.*\)[ ]*:\1:p" /etc/lilo.conf)"
120 if [ -z "${bootpart}" ]
122 # lilo defaults to current root when 'boot=' is not present
123 bootpart="${rootpart}"
126 if ! dd if=${bootpart} ibs=16 count=1 2>&- | grep -q 'LILO'
129 ewarn "Yes, but I couldn't find a LILO signature on ${bootpart}"
130 ewarn "Check your /etc/lilo.conf, or run /sbin/lilo by hand."
134 echo " Yes, on ${bootpart}"
140 if [ ! -e "${ROOT}/boot/boot.b" -a ! -L "${ROOT}/boot/boot.b" ]
142 [ -f "${ROOT}/boot/boot-menu.b" ] && \
143 ln -snf boot-menu.b "${ROOT}/boot/boot.b"
146 if [ "${ROOT}" = "/" ] && use !minimal;
150 einfo "Running DOLILO to complete the install ..."
151 # do not redirect to /dev/null because it may display some input
157 ewarn "Running /sbin/dolilo failed! Please check what the problem is"
158 ewarn "before your next reboot."
166 if use !minimal; then
168 einfo "Issue 'dolilo' instead of 'lilo' to have a friendly wrapper that"
169 einfo "handles mounting and unmounting /boot for you. It can do more then"
170 einfo "that when asked, edit /etc/conf.d/dolilo to harness it's full potential."