summaryrefslogtreecommitdiff
blob: a79f6588af35120d4dc31ed88a66e42dd8505850 (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-gfx/bootsplash/bootsplash-0.6-r10.ebuild,v 1.7 2004/04/25 22:34:05 mholzer Exp $

IUSE="livecd"
S=${WORKDIR}/${PF}
DESCRIPTION="Graphical backgrounds for frame buffer consoles"
HOMEPAGE="http://www.bootsplash.org/ http://linux.tkdack.com/"
SRC_URI="mirror://gentoo/${PF}.tar.bz2
	http://dev.gentoo.org/~spock/portage/distfiles/${PF}.tar.bz2"

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="x86 ~amd64"

DEPEND=">=media-libs/freetype-2
	media-libs/libmng"

src_compile() {
	# compile utils
	# the util builds but the rc scripts have not been modified
	# animated boot up require patches to the baselayout package
	cd ${S}/utils

	# a quick'n'dirty fix backported from -r11
	sed -i 's#\$(LIBDIR)/libmng.a#\$(LIBDIR)/libmng.a \$(LIBDIR)/liblcms.a#' fbmngplay/Makefile

	emake -C fbmngplay || die
	emake -C fbtruetype || die
	emake -C splashutils || die

	cd ${S}
}

src_install() {
	# Splash utilities
	exeinto /sbin
	doexe utils/fbmngplay/fbmngplay{,.static}
	doexe utils/fbtruetype/fbtruetype{,.static}
	newexe utils/splashutils/splash splash.bin
	doexe misc/splash
	doexe utils/splashutils/{fbresolution,getkey,progress}

	dodir /etc/${PN}
	cp -pR themes/* ${D}/etc/${PN}

	# link default config for boot images if not already set
	if [ ! -e ${ROOT}/etc/bootsplash/default ]; then
		use livecd \
			&& dosym ./livecd-2004.0 /etc/bootsplash/default \
			|| dosym ./gentoo /etc/bootsplash/default
	fi

	exeinto /etc/init.d
	doexe misc/bootsplash

	insinto /etc/conf.d
	doins misc/bootsplash.conf

	insinto /usr/share/${PN}
	doins kernel/*.bz2 misc/grub.conf.sample

	sed -i "s:${PN}:${PF}:g" bootsplash_patch
	into /
	dosbin bootsplash_patch
	fperms 0754 /sbin/bootsplash_patch
}

pkg_postinst() {
	# Has to be done here so that the initrd images are created properly
	if [ "${ROOT}" = "/" ]
	then
		for SIZE in 800x600 1024x768 1280x1024 1600x1200
		do
			/sbin/splash -s -f \
				/etc/bootsplash/gentoo/config/bootsplash-${SIZE}.cfg \
				> /usr/share/${PN}/initrd-${SIZE}
		done
	fi

	echo ""
	einfo "Execute \"bootsplash_patch\" to have your kernel sources in"
	einfo "/usr/src/linux patched with the Framebuffer Bootsplash patches."
	einfo
	einfo "You can also use:"
	einfo "    bootsplash_patch /path/to/your/custom/kernel/"
	einfo "to patch your custom kernel sources."
	echo ""
	ewarn "If you have already patched the kernel then you only need to copy"
	ewarn "an initrd from /usr/share/${PN} to /boot"
	echo ""
	einfo "Run:"
	einfo "    rc-update add bootsplash default"
	einfo "to change the console images after startup"
	echo ""
	einfo "Please note that in case /usr is a separate partition"
	einfo "you'll need to use the statically linked versions of Bootplash"
	einfo 'utilities (fbmngplay.static, fbtruetype.static) during boot-time.'
	echo ""
	einfo "If you would like to have a better quality background picture"
	einfo "from the Gentoo theme and you don't care about a few more kilobytes"
	einfo "of used memory, try the gentoo-highquality theme which you can"
	einfo "download from:"
	einfo "http://dev.gentoo.org/~spock/stuff/bootsplash/gentoo-highquality.tar.bz2"
	echo ""
	einfo "After the download is complete, unpack the files to /etc/bootsplash/"
	echo ""
}

pkg_config() {

	if [ "${LINUX}" == "" ]; then
		LINUX='/usr/src/linux'
	fi

	eval `sed -n -e 's/^\([A-Z]*\) = \([0-9]*\)$/\1=\2/p' -e 's/^\([A-Z]*\) = \(-[-a-z0-9]*\)$/\1=\2/p' ${LINUX}/Makefile`

	if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ]
	then
		die "Unable to determine kernel version in ${LINUX}"
	fi

	KB="${VERSION}.${PATCHLEVEL}"
	KV_MINOR="${SUBLEVEL}"

	ewarn
	ewarn "Patching the kernel (branch: ${KB}) in ${LINUX} ..."
	ewarn

	cd ${ROOT}/${LINUX}

	if [ "${KB}" == "2.4" ]; then

		if [ -f drivers/video/fbcon-splash.c ]; then
			eerror
			eerror "It appears your kernel has already been patched."
			eerror
			exit 1
		fi

		if [ ${KV_MINOR} -ge 22 ]; then
			bzip2 -dc \
				${ROOT}/usr/share/${PN}/${PN}-3.0.7-2.4.22-vanilla.diff.bz2 \
					| patch -p1 || die
		else
			bzip2 -dc \
				${ROOT}/usr/share/${PN}/${PN}-3.0.7-2.4.20-vanilla.diff.bz2 \
					| patch -p1 || die
		fi

	elif [ "${KB}" == "2.6" ]; then

		if [ -d drivers/video/bootsplash ]; then
			eerror
			eerror "It appears your kernel has already been patched."
			eerror
			exit 1
		fi

		if [ ${KV_MINOR} -ge 3 ]; then
			bzip2 -dc \
				${ROOT}/usr/share/${PN}/${PN}-3.1.4-2.6.3.diff.bz2 \
					| patch -p1 || die
		else
			bzip2 -dc \
				${ROOT}/usr/share/${PN}/${PN}-3.1.3-2.6.0-test9.diff.bz2 \
					| patch -p1 || die
		fi
	else
		die "Sorry, this kernel branch is not supported."
	fi

	ewarn
	ewarn " ... complete."
	einfo
	einfo "Your kernel has been patched, rebuild with the following options"
	einfo "enabled (do not build them as modules!):"
	einfo "		Block Devices ->"
	einfo "			[*] RAM disk support"
	einfo "			[*] Loopback device support"
	einfo "			[*] Initial RAM disk (initrd) support"
	einfo
	einfo "		Console Drivers ->"
	einfo "			[*] Video mode selection support"
	einfo "			Frame-buffer support ->"
	einfo "				[*] Support for frame buffer devices"
	einfo "				[*] VESA VGA graphics console"
	einfo "				[*] Use splash screen instead of boot logo"
	einfo
	einfo "Copy an initrd from /usr/share/${PN} to /boot"
	einfo
	einfo "Look at \"/usr/share/${PN}/grub.conf.sample\" for an example"
	einfo "grub.conf file with the appropriate changes to enable the"
	einfo "framebuffer boot screens"
	einfo
	einfo "Ensure you make the appropriate changes to your grub.conf"
	einfo
}