summaryrefslogtreecommitdiffstats
path: root/base/aaabasicfs/Pkgfile
blob: ab6502ebb04a54aa6a284168d28af8303bf8219f (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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# Description: Système de base de NuTyX, contient les répertoires et scripts de demarrage.
# URL: http://www.nutyx.org/
# Maintainer: NuTyX core team
# Packager: thierryn1 at hispeed dot ch
# Depends on:

name=aaabasicfs
version=2010
release=rc1
scriptsversion=lfs-bootscripts-20100124
BLFSscriptsversion=20090302
source=(  http://www.linuxfromscratch.org/lfs/downloads/development/$scriptsversion.tar.bz2\
	http://www.linuxfromscratch.org/blfs/downloads/svn/blfs-bootscripts-$BLFSscriptsversion.tar.bz2
 hosts console fstab inittab message inputrc network \
 profile dircolors.sh extrapaths.sh bash_profile bashrc bashrc.etc lfs-bootscripts-01.patch \
 nu readline.sh unmask.sh X.sh bashrc )


build() {
       # Creating Directories
       
	mkdir -pv $PKG/{dev,proc,sys,bin,boot,etc/{profile.d,opt,skel,default},home,lib,mnt,opt,srv/sources}
	chmod 1777 $PKG/srv/sources
	mkdir -pv $PKG/{media/{floppy,cdrom,key,dvd},sbin,var}
	install -dv -m 0750 $PKG/root	
	install -dv -m 1777 $PKG/tmp 
	install -dv -m 1777 $PKG/var/tmp
	mkdir -pv $PKG/usr/{,local/}{bin,include,lib,sbin,src}
	mkdir -pv $PKG/usr/{,local/}share/{doc,info,locale,man}
	mkdir -v  $PKG/usr/{,local/}share/{misc,terminfo,zoneinfo}
	mkdir -pv $PKG/usr/{,local/}share/man/man{1..8}
	mkdir -p $PKG/usr/ports
	# Needs for cups
	mkdir -p $PKG/usr/share/applications
	install -dv  $PKG/lib/{firmware,udev/devices/{pts,shm}}
	mknod -m 600 $PKG/lib/udev/devices/console c 5 1
	mknod -m 666 $PKG/lib/udev/devices/null c 1 3
	mknod -m 666 $PKG/lib/udev/devices/zero c 1 5
	mknod -m 666 $PKG/dev/null c 1 3
	mknod -m 600 $PKG/dev/console c 5 1
	for dir in $PKG/usr $PKG/usr/local; do
		ln -sv share/{man,doc,info} $dir
	done
	mkdir -v $PKG/var/{lock,log,mail,run,spool}
	mkdir -pv $PKG/var/{opt,cache,lib/{misc,locate},local}
	touch $PKG/var/log/{kern.log,auth.log,mail.log,user.log,sys.log,daemon.log,wtmp,btmp}
	chmod 640 $PKG/var/log/{kern.log,auth.log,mail.log,user.log,sys.log,daemon.log}
	chmod 0600 $PKG/var/log/btmp
	# Creating essential Files and Symlinks
	touch $PKG/etc/mtab
	ln -sv bash $PKG/bin/sh
	mkdir -p $PKG/var/lib/pkg/
	echo "$version-$release" > $PKG/var/lib/pkg/nutyx-version
	ln -s /var/lib/pkg/nutyx-version $PKG/etc/nutyx-version
	
	cat > $PKG/etc/shells << "EOF"
/bin/sh
/bin/bash
EOF
       cat > $PKG/etc/passwd << "EOF"
root:x:0:0:root:/root:/bin/bash
bin:x:1:1::/dev/null:/bin/false
lp:x:9:9:Print Service User:/dev/null:/bin/false
messagebus:x:18:18:D-BUS Message Daemon User:/dev/null:/bin/false
haldaemon:x:19:19:HAL Daemon User:/dev/null:/bin/false
named:x:20:20:BIND Owner:/home/named:/bin/false
gdm:x:21:21:GDM Daemon User:/dev/null:/bin/bash
fcron:x:22:22:Fcron User:/dev/null:/bin/false
apache:x:25:25:Apache Server:/dev/null:/bin/false
smmsp:x:26:26:Sendmail Daemon:/dev/null:/bin/false
polkituser:x:27:27:Policy Kit Daemon User:/dev/null:/bin/false
mysql:x:40:40:MySQL Server:/dev/null/:bin/false
postgres:x:41:41:PostgreSQL Server:/srv/pgsql/data:/bin/bash
rsyncd:48:48:rsyncd Daemon:/home/rsync:/bin/false
sshd:x:50:50:sshd PrivSep:/var/lib/sshd:/bin/false
policykit:x:62:62:PolicyKit:/:/sbin/nologin
tomcat:x:66:66:Tomcat Server:/opt/tomcat:/bin/false
clamav:x:97:97:Clamav Antivirus:/dev/null:/bin/false
anonymous:x:98:1000::/home/anonymous:/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
EOF
       cat > $PKG/etc/group << "EOF"
root:x:0:
bin:x:1:
sys:x:2:
kmem:x:3:
tty:x:4:
tape:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
uucp:x:10:
audio:x:11:
video:x:12:
utmp:x:13:
usb:x:14:
cdrom:x:15:
dialout:x:16:
network:x:17:
messagebus:x:18:
haldaemon:x:19:
named:x:20:
gdm:x:21:
fcron:x:22:
apache:x:25:
smmsp:x:26:
polkituser:x:27:
mail:x:34:
mysql:x:40:
postgres:x:41:
rsyncd:x:48:
sshd:x:50:
games:x:60:
halusers:x:61:
policykit:x:62:
fuse:x:65:
tomcat:x:66:
scanner:x:70:
vboxusers:x:80:
clamav:x:97:
nogroup:x:99:
users:x:100:
EOF
       cat > $PKG/usr/bin/which << "EOF"
#!/bin/bash
type -pa "$@" | head -n 1 ; exit ${PIPESTATUS[0]}
EOF
	chmod -v 755 $PKG/usr/bin/which
	chown 0:0 $PKG/usr/bin/which
	cat > $PKG/etc/default/useradd << "EOF"
# Begin /etc/default/useradd

GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel

# End /etc/default/useradd
EOF
	touch $PKG/var/run/utmp $PKG/var/log/{btmp,lastlog,wtmp}
	chgrp -v 13 $PKG/var/run/utmp $PKG/var/log/lastlog
	chmod -v 664 $PKG/var/run/utmp $PKG/var/log/lastlog
	# Bootscripts
	cd $scriptsversion
	patch -Np1 -i ../lfs-bootscripts-01.patch
	make DESTDIR=$PKG install
	# Rename network script
	mv $PKG/etc/rc.d/init.d/{network,iplink}
	cp $SRC/network $PKG/etc/rc.d/init.d/
	# We want to start the network when init 2
	mv $PKG/etc/rc.d/rc2.d/{K80,S20}network
	cd ..	
	# Remove files which will be installed by xorg7
	rm $PKG/etc/sysconfig/createfiles

	# Configuration files
	cp -v {hosts,fstab,inittab,profile,inputrc,bashrc.etc} $PKG/etc/
	mv $PKG/etc/bashrc.etc $PKG/etc/bashrc
	cp -v {dircolors.sh,extrapaths.sh,readline.sh,unmask.sh,X.sh}\
	$PKG/etc/profile.d/
	cp -v console $PKG/etc/sysconfig/
	echo "HOSTNAME=nutyx" > $PKG/etc/sysconfig/network
	cp -v bash_profile $PKG/etc/skel/.bash_profile
	cp -v bashrc $PKG/etc/skel/.bashrc
	ln -s /etc/slim.xinitrc $PKG/etc/skel/.xinitrc
	cp -v bash_profile $PKG/root/.bash_profile
	cp -v bashrc $PKG/root/.bashrc
	mkdir -p $PKG/root/bin
	cp -v nu $PKG/root/bin
       # Customise startup scripts
	cat > $PKG/var/lib/pkg/blfs-bootscripts << "EOF"
scripts=blfs-bootscripts
scriptsversion=`echo $BLFSscriptsversion`
EOF
	ln -s /var/lib/pkg/blfs-bootscripts $PKG/etc/blfs-bootscripts
	cp -v message $PKG/boot/
	# Install Random Number Generation
	cd $SRC/blfs-bootscripts-$BLFSscriptsversion
	make DESTDIR=$PKG install-random

	cat > $PKG/etc/skel/.dmrc << "EOF"
[Desktop]
Session=
EOF
	cd $PKG/root/
	ln -s ../etc/fstab
	ln -s ../etc/hosts
	ln -s ../boot/grub/menu.lst
	ln -s ../etc/inittab 
	ln -s ../etc/profile 
	ln -s ../etc/inputrc
	ln -s ../etc/bashrc
	ln -s ../etc/hosts.allow
	ln -s ../etc/hosts.deny
	ln -s ../etc/resolv.conf
	ln -s ../etc/modprobe.conf
	ln -s ../etc/shells
	ln -s ../etc/profile.d/dircolors.sh
	ln -s ../etc/profile.d/extrapaths.sh
	ln -s ../etc/profile.d/readline.sh
	ln -s ../etc/profile.d/unmask.sh
	ln -s ../etc/profile.d/X.sh
	ln -s ../etc/profile.d/i18n.sh
	ln -s ../etc/skel/.xinitrc
	ln -s ../etc/profile.d/jdk.sh
	ln -s ../etc/sysconfig/clock
	ln -s ../etc/sysconfig/console
	ln -s ../etc/sysconfig/network
	ln -s ../etc/sysconfig/modules
	ln -s ../etc/X11/xorg.conf.d/10-keyboard.conf
	ln -s ../etc/default/useradd
	ln -s ../etc/prt-get.conf
	ln -s ../etc/pkg-get.conf
	ln -s ../etc/pkgadd.conf
	ln -s ../etc/pkgmk.conf
	for i in rc0.d rc6.d
		do
			mv $PKG/etc/rc.d/$i/S{80,70}swap
			mv $PKG/etc/rc.d/$i/S{70,80}mountfs
	done
	ln -s ../init.d/setclock $PKG/etc/rc.d/rcsysinit.d/S15setclock
	mv $PKG/etc/rc.d/rcsysinit.d/S{20,40}swap
	mv $PKG/etc/rc.d/rcsysinit.d/S{30,20}checkfs
	mv $PKG/etc/rc.d/rcsysinit.d/S{40,30}mountfs
}