summaryrefslogtreecommitdiff
blob: c7ccba46085e1e7f35965016ddaf86a2da6fe814 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Maintainer: Donny Davies <woodchip@gentoo.org>
# $Header: /var/cvsroot/gentoo-x86/sys-apps/lilo/lilo-21.7.5-r2.ebuild,v 1.1 2002/04/09 03:36:31 woodchip Exp $

#
# This lilo has the Suse animated bootlogo patches.. fun!
#

S=${WORKDIR}/${P}
DESCRIPTION="Standard Linux boot loader"
SRC_URI="ftp://metalab.unc.edu/pub/Linux/system/boot/lilo/${P}.tar.gz"

DEPEND="virtual/glibc >=sys-devel/bin86-0.15.5"
RDEPEND="virtual/glibc"

pkg_setup() {
	[ "${ROOT}" != "/" ] && return 0
	. ${ROOT}/etc/init.d/functions.sh
	local fstabstate="$(cat /etc/fstab |grep -v -e '#' |awk '{print $2}')"
	local procstate="$(cat /proc/mounts |awk '{print $2}')"
	if [ -n "$(echo ${fstabstate} |grep -e "/boot")" ] && \
	   [ -n "$(echo ${procstate} |grep -e "/boot")" ]
	then
		einfo "Your boot partition was detected as being mounted as /boot."
		einfo "Files will be installed there for lilo to function correctly."
	elif [ -n "$(echo ${fstabstate} |grep -e "/boot")" ] && \
	     [ -z "$(echo ${procstate} |grep -e "/boot")" ]
	then
		mount /boot &>/dev/null
		if [ "$?" -eq 0 ]
		then
			einfo "Your boot partition was not mounted as /boot, but portage was able to mount"
			einfo "it without additional intervention."
			einfo "Files will be installed there for lilo to function correctly."
		else
			eerror "Your boot partition has to be mounted on /boot before the installation"
			eerror "can continue. Lilo needs to install important files there."
			die "Please mount your /boot partition."
		fi
	else
		einfo "You do not have a seperate /boot partition."
	fi
}

src_unpack() {
	unpack ${A} ; cd ${S}

	# patches for animated boot logo from Suse.  loopdev fix too.
	patch -p1 < ${FILESDIR}/${PV}/lilo-21.7.4.diff || die
	patch -p1 < ${FILESDIR}/${PV}/lilo-21.7.4-loop_dev.diff || die
	patch -p1 < ${FILESDIR}/${PV}/lilo-21.7.4-gfx.diff || die
	patch -p0 < ${FILESDIR}/${PV}/lilo-21.7-vga_inst.diff || die

	mv Makefile Makefile.orig
	sed -e "s:-g::" Makefile.orig > Makefile
}

src_compile() {
	make || die "compile problem"
}

src_install() {
	into /
	dosbin lilo
	into /usr
	dosbin keytab-lilo.pl
	dodir /boot
	insinto /boot
	doins boot-text.b boot-menu.b chain.b os2_d.b
	doman manPages/*.[5-8]
	dodoc CHANGES COPYING INCOMPAT QuickInst README*

	insinto /etc
	newins ${FILESDIR}/lilo.conf lilo.conf.example
}

pkg_preinst() {
	if [ ! -L $ROOT/boot/boot.b -a -f $ROOT/boot/boot.b ]
	then
	    einfo "Saving old boot.b..."
	    mv $ROOT/boot/boot.b $ROOT/boot/boot.old
	fi

	if [ ! -L $ROOT/boot/chain.b -a -f $ROOT/boot/chain.b ]
	then
	    einfo "Saving old chain.b..."
	    mv $ROOT/boot/chain.b $ROOT/boot/chain.old
	fi

	if [ ! -L $ROOT/boot/os2_d.b -a -f $ROOT/boot/os2_d.b ]
	then
	    einfo "Saving old os2_d.b..."
	    mv $ROOT/boot/os2_d.b $ROOT/boot/os2_d.old
	fi
}

pkg_postinst() {
	einfo "Activating boot-menu..."
	ln -sf boot-menu.b $ROOT/boot/boot.b

	echo
	echo "*****************************************************"
	echo "* You need to use: message=/boot/foo.boot in your   *"
	echo "* /etc/lilo.conf global section.                    *"
	echo "*                                                   *"
	echo "* See http://www.gamers.org/~quinet/lilo/index.html *"
	echo "* for downloadable animations.                      *"
	echo "*****************************************************"
	echo
}