summaryrefslogtreecommitdiff
blob: 11c62a9a33186dc0a2396dd945f94873ee8d512d (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
199
200
# Copyright 1999-2001 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Maintainer: System Team <system@gentoo.org>
# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/baselayout-1.6-r1.ebuild,v 1.9 2001/08/23 23:42:06 drobbins Exp $

SV=1.1.3
S=${WORKDIR}/rc-scripts-${SV}
DESCRIPTION="Base layout for Gentoo Linux filesystem (incl. initscripts)"
SRC_URI="http://www.ibiblio.org/gentoo/distfiles/rc-scripts-${SV}.tar.bz2"
HOMEPAGE="http://www.gentoo.org"

src_compile() {
	cp ${S}/init.d/runscript.c ${T}
	cd ${T}
	gcc ${CFLAGS} runscript.c -o runscript
}

#adds ".keep" files so that dirs aren't auto-cleaned
keepdir() {
	dodir $*
	local x
	for x in $*
	do
		touch ${D}/${x}/.keep
	done
}

src_install()
{
	local foo
	if [ "$MAINTAINER" != "yes" ] && [ "$ROOT" = "/" ]
	then
		echo '!!! baselayout should only be merged if you know what youre doing.'
		echo '!!! It will overwrite important system files (passwd/group and others) with their'
		echo '!!! original versions.  For now, please update your files by hand by'
		echo '!!! comparing the contents of the files in '${FILESDIR}' to your'
		echo '!!! installed versions.  We will have an automated update system shortly.'
		exit 1
	fi
	keepdir /sbin
	exeinto /sbin
	doexe ${T}/runscript

	keepdir /usr
	keepdir /usr/bin
	keepdir /usr/lib
	keepdir /usr/sbin
	dosbin ${S}/sbin/MAKEDEV ${S}/sbin/run-crons ${S}/sbin/update-modules
	keepdir /var /var/run /var/lock/subsys
	dosym ../var/tmp /usr/tmp
	
	if [ -z "`use bootcd`" ]
	then
		keepdir /boot
		dosym . /boot/boot
		keepdir /home
		keepdir /usr/include /usr/src /usr/portage /usr/X11R6/include/GL
		dosym ../X11R6/include/X11 /usr/include/X11
		dosym ../X11R6/include/GL /usr/include/GL
		
		#dosym ../src/linux/include/linux /usr/include/linux
		#dosym ../src/linux/include/asm-i386 /usr/include/asm
		#Important note: Gentoo Linux 1.0_rc6 no longer uses symlinks to /usr/src for includes.
		#We now rely on the special sys-kernel/linux-headers package, which takes a snapshot of
		#the currently-installed includes in /usr/src and copies them to /usr/include/linux and
		#/usr/include/asm.  This is the recommended approach so that kernel includes can remain
		#constant.  The kernel includes should really only be upgraded when you upgrade glibc.
		keepdir /usr/include/linux /usr/include/asm
		keepdir /usr/share/man /usr/share/info /usr/share/doc /usr/share/misc

		for foo in games lib sbin share bin share/doc share/man src
		do
		  keepdir /usr/local/${foo}
		done
		#local FHS compat symlinks
		dosym share/man /usr/local/man	
		dosym share/doc	/usr/local/doc	

		#FHS compatibility symlinks stuff
		dosym share/man /usr/man
		dosym share/doc /usr/doc
		dosym share/info /usr/info
		keepdir /usr/X11R6/share
		dosym ../../share/info	/usr/X11R6/share/info
		#end FHS compatibility symlinks stuff
		
		doman ${FILESDIR}/MAKEDEV.8
		dodoc ${FILESDIR}/copyright ${FILESDIR}/changelog.Debian
		keepdir /usr/X11R6/lib /usr/X11R6/man
		keepdir /var/log/news
		
		#supervise stuff depreciated
		#dodir /var/lib/supervise
		#install -d -m0750 -o root -g wheel ${D}/var/lib/supervise/control
		#install -d -m0750 -o root -g wheel ${D}/var/lib/supervise/services
		#end supervise stuff
		
		keepdir /opt

#		It makes sense to move these to the PAM package.
#		dodir /etc/pam.d
#		cd ${FILESDIR}/pam.d
#		insinto /etc/pam.d
#		doins *
	fi
	
	touch ${D}/var/log/lastlog
	touch ${D}/var/run/utmp
	touch ${D}/var/log/wtmp
	#the .keep file messes up Portage when looking in /var/db/pkg
	dodir /var/db/pkg 
	keepdir /var/spool /var/tmp /var/lib/misc
	chmod 1777 ${D}/var/tmp
	keepdir /root
	
	#/proc is very likely mounted right now so a keepdir will fail on merge
	dodir /proc	
	
	chmod go-rx ${D}/root
	keepdir /tmp
	chmod 1777 ${D}/tmp
	chmod 1777 ${D}/var/tmp
	chown root.uucp ${D}/var/lock
	chmod 775 ${D}/var/lock
	insopts -m0644
	
	insinto /etc
	ln -s ../proc/filesystems ${D}/etc/filesystems
	for foo in hourly daily weekly monthly
	do
		keepdir /etc/cron.${foo}
	done
	for foo in ${S}/etc/*
	do
		#install files, not dirs
		[ -f $foo ] && doins $foo
	done
	
	chmod go-rwx ${D}/etc/shadow
	keepdir /lib /proc /mnt/floppy /mnt/cdrom
	chmod go-rwx ${D}/mnt/floppy ${D}/mnt/cdrom

#	dosbin rc-update 
#	insinto /usr/bin
#	insopts -m0755
#	doins colors
  	keepdir /dev
	keepdir /dev-state
	keepdir /dev/pts /dev/shm
	dosym /usr/sbin/MAKEDEV /dev/MAKEDEV
	cd ${D}/dev
	#These devices are also needed by many people and should be included
	echo "Making device nodes... (this could take a minute or so...)"
	${S}/sbin/MAKEDEV generic-i386
	${S}/sbin/MAKEDEV sg
	${S}/sbin/MAKEDEV scd
	${S}/sbin/MAKEDEV rtc 
	${S}/sbin/MAKEDEV audio
	${S}/sbin/MAKEDEV hde
	${S}/sbin/MAKEDEV hdf
	${S}/sbin/MAKEDEV hdg
	${S}/sbin/MAKEDEV hdh

	cd ${S}/sbin
	into /
	dosbin init rc

	#env-update stuff
	dodir /etc/env.d
	insinto /etc/env.d
	doins ${S}/etc/env.d/00basic
	
	dodir /etc/modutils
	insinto /etc/modutils
	doins ${S}/etc/modutils/aliases ${S}/etc/modutils/i386

	dodir /etc/init.d
	exeinto /etc/init.d
	for foo in ${S}/init.d/*
	do
		[ -f $foo ] && doexe $foo
	done
	#not the greatest location for this file; should move it at some point
	rm ${S}/etc/init.d/runscript.c

	#set up default runlevel symlinks
	local bar
	for foo in default boot nonetwork single
	do
		dodir /etc/runlevels/${foo}
		for bar in `cat ${S}/rc-lists/${foo}`
		do
			[ -e ${S}/init.d/${bar} ] && dosym /etc/init.d/${bar} /etc/runlevels/${foo}/${bar}
		done
	done

	#default make.profile symlink; handy for doing bootstraps, etc.
	dosym /usr/portage/profiles/default /etc/make.profile

}