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
229
230
231
232
233
234
235
236
237
|
# 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
name=aaabasicfs
version=2012
release=5
scriptsversion=lfs-bootscripts-20120409
BLFSscriptsversion=20120409
XORG_PREFIX=/usr
source=(http://www.linuxfromscratch.org/lfs/downloads/development/$scriptsversion.tar.bz2
http://www.linuxfromscratch.org/blfs/downloads/svn/blfs-bootscripts-$BLFSscriptsversion.tar.bz2
fstab inittab inputrc network rc profile dircolors.sh extrapaths.sh
bash_profile bashrc bashrc.etc nu readline.sh unmask.sh X.sh )
build() {
# Creating Directories
mkdir -pv $PKG/{dev,proc,sys,bin,boot,etc/{modprobe.d,profile.d,opt,skel/Desktop,default},home,lib,mnt,opt,srv/sources,run}
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
case $(uname -m) in
x86_64) ln -sv lib $PKG/lib64 && ln -sv lib $PKG/usr/lib64 ;;
esac
mkdir -v $PKG/var/{log,mail,spool}
ln -sv ../run $PKG/var/run
ln -sv ../run/lock $PKG/var/lock
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 -s bash $PKG/bin/sh
ln -s $XORG_PREFIX $PKG/$XORG_PREFIX/X11R6
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:/sbin/nologin
fcron:x:22:22:Fcron User:/dev/null:/bin/false
kdm:x:23:23:KDM Daemon User:/dev/null:/bin/false
lxdm:x:24:24:LXDM Daemon User:/dev/null:/sbin/nologin
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:x: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
avahi:x:85:85:Avahi daemon:/:/bin/false
clamav:x:97:97:Clamav Antivirus:/dev/null:/bin/false
anonymous:x:98:98::/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:gdm
fcron:x:22:
kdm:x:23:kdm
lxdm:x:24:lxdm
apache:x:25:
smmsp:x:26:
polkituser:x:27:
mail:x:34:
mysql:x:40:
postgres:x:41:
rsyncd:x:48:
sshd:x:50:
pppusers:x:52:
games:x:60:
halusers:x:61:
policykit:x:62:
plugdev:x:63:
fuse:x:65:
tomcat:x:66:
scanner:x:70:
vboxusers:x:80:
avahi:x:85:
netdev:x:86:
admin:x:90:
clamav:x:97:
anonymous:x:98:
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
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/
cp $SRC/rc $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 xorg
rm $PKG/etc/sysconfig/createfiles
# Configuration files
cp -v {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 bash_profile $PKG/etc/skel/.bash_profile
cp -v bashrc $PKG/etc/skel/.bashrc
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
EOF
echo "scriptsversion=$BLFSscriptsversion" >> $PKG/var/lib/pkg/blfs-bootscripts
ln -s /var/lib/pkg/blfs-bootscripts $PKG/etc/blfs-bootscripts
# Install Random Number Generation
cd $SRC/blfs-bootscripts-$BLFSscriptsversion
make DESTDIR=$PKG install-random
cat > $PKG/etc/skel/.dmrc << "EOF"
[Desktop]
Session=
EOF
cat >> $PKG/etc/profile.d/extrapaths.sh << "EOF"
if [ -d /install ]; then
pathappend /install
fi
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/sysconfig
ln -s ../etc/profile.d
ln -s ../etc/modprobe.d
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/shells
ln -s ../etc/skel/.xinitrc
ln -s ../etc/X11/xorg.conf.d/20-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{70,80}mountfs
done
ln -s ../init.d/setclock $PKG/etc/rc.d/rcS.d/S15setclock
mv $PKG/etc/rc.d/rcS.d/S{00,01}mountvirtfs
mv $PKG/etc/rc.d/rcS.d/S{20,40}swap
mv $PKG/etc/rc.d/rcS.d/S{30,20}checkfs
mv $PKG/etc/rc.d/rcS.d/S{40,30}mountfs
sed "s|notmpfs,nosysfs,nodevtmpfs|notmpfs,nosysfs,nodevtmpfs,noproc|" -i $PKG/etc/rc.d/init.d/mountfs
}
|