1 | #!/bin/bash |
---|
2 | #(C)DatuX 2005 - all rights reserved |
---|
3 | #root filesystem in $1 gereed maken voor systeemboot |
---|
4 | |
---|
5 | TARGETPATH=$1 |
---|
6 | |
---|
7 | ############################################################## |
---|
8 | echo "* Preparing libraries:" |
---|
9 | ldconfig -r $TARGETPATH || exit 1 |
---|
10 | |
---|
11 | ############################################################## |
---|
12 | echo "* Activating configuration:" |
---|
13 | chroot $TARGETPATH "/sbin/etc-update" || exit 1 |
---|
14 | |
---|
15 | |
---|
16 | ############################################################## |
---|
17 | echo "* Mounting proc, sysfs and dev:" |
---|
18 | #proc mounten |
---|
19 | chroot $TARGETPATH "/bin/bash" -c "mount -t proc none /proc" || exit 1 |
---|
20 | |
---|
21 | #sysfs mounten |
---|
22 | chroot $TARGETPATH "/bin/bash" -c "mount -t sysfs none /sys" || exit 1 |
---|
23 | |
---|
24 | #/dev populaten |
---|
25 | #OBSOLETE?: chroot $TARGETPATH "/bin/bash" -c "udevstart" || exit 1 |
---|
26 | |
---|
27 | #mtab fixen |
---|
28 | chroot $TARGETPATH "/bin/bash" -c "cat /proc/mounts > /etc/mtab" || exit 1 |
---|
29 | |
---|
30 | |
---|
31 | ############################################################## |
---|
32 | echo "* Activating kernel:" |
---|
33 | |
---|
34 | #forcefully 'activate' the testkernel and testinitrd |
---|
35 | mv $TARGETPATH/boot/initrd.gz.test $TARGETPATH/boot/initrd.gz || exit 1 |
---|
36 | mv $TARGETPATH/boot/bzImage.test $TARGETPATH/boot/bzImage || exit 1 |
---|
37 | |
---|
38 | #new installations use syslinux by default (instead of grub) |
---|
39 | ln -s syn3-install-syslinux $TARGETPATH/sbin/syn3-install-bootloader || exit 1 |
---|
40 | |
---|
41 | ############################################################## |
---|
42 | echo "* Adjusting config:" |
---|
43 | rm $TARGETPATH/etc/rc.d/rc.httpd |
---|
44 | echo 'local7.* -/var/log/simpellinux.log' >> $TARGETPATH/etc/syslog.conf |
---|
45 | #echo "SV:123456:respawn:/usr/bin/svscanboot" >> $TARGETPATH/etc/inittab |
---|
46 | #echo "PI:123456:wait:/sbin/postinst.sh" >> $TARGETPATH/etc/inittab |
---|
47 | |
---|
48 | echo "export LC_ALL=C" >>$TARGETPATH/etc/profile |
---|
49 | chroot $TARGETPATH "/bin/bash" -c "ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime" |
---|
50 | chroot $TARGETPATH "/bin/bash" -c "depmod -ae" |
---|
51 | |
---|
52 | |
---|
53 | cp -a /var/chpasswd $TARGETPATH/tmp || exit 1 |
---|
54 | chmod 755 $TARGETPATH/tmp/chpasswd |
---|
55 | |
---|
56 | |
---|
57 | #for networ.php: |
---|
58 | touch $TARGETPATH/boot/if-assign.conf || exit 1 |
---|
59 | |
---|
60 | #TODO: kijken of lvm.conf en hosts weg kunnen omdat ze in een package zitten |
---|
61 | cp -a /var/lvm.conf $TARGETPATH/etc/lvm ||exit 1 |
---|
62 | touch $TARGETPATH/etc/lvm/lvm.conf || exit 1 |
---|
63 | chmod 644 $TARGETPATH/etc/lvm/lvm.conf |
---|
64 | |
---|
65 | cp -a /var/hosts $TARGETPATH/etc ||exit 1 |
---|
66 | chmod 644 $TARGETPATH/etc/hosts |
---|
67 | |
---|
68 | chmod 1777 $TARGETPATH/tmp || exit 1 |
---|
69 | |
---|
70 | echo $LANG > $TARGETPATH/etc/webint/LANG || exit 1 |
---|
71 | |
---|
72 | #hack for mysql |
---|
73 | chroot $TARGETPATH "/bin/bash" -c "mkdir -p /var/run/mysql && chown mysql /var/run/mysql" || exit 1 |
---|
74 | |
---|
75 | #hack for old postgresql (will upgrade it later) |
---|
76 | ln -s /usr/lib/libreadline.so.6.3 $TARGETPATH/usr/lib/libreadline.so.5 |
---|
77 | |
---|
78 | #prevent old stuff from being installed |
---|
79 | touch $TARGETPATH/var/log/packages/mysql-4-noarch-9999 |
---|
80 | touch $TARGETPATH/var/log/packages/libgcc_g++-9999-noarch-9999 |
---|
81 | touch $TARGETPATH/var/log/packages/libgcc-9999-noarch-9999 |
---|
82 | touch $TARGETPATH/var/log/packages/pecl_bcompiler-9999-noarch-9999 |
---|
83 | touch $TARGETPATH/var/log/packages/glibc_profile-9999-noarch-9999 |
---|
84 | touch $TARGETPATH/var/log/packages/pecl_pdo_mysql-1.0.2.tgz-i586-5946 |
---|
85 | touch $TARGETPATH/var/log/packages/device_mapper-1.02.24-i586-3898 |
---|
86 | touch $TARGETPATH/var/log/packages/drbd-0.7.25-i586-4667 |
---|
87 | touch $TARGETPATH/var/log/packages/db4-4.7.25-i586-5057 # -> heet nu db48 |
---|
88 | touch $TARGETPATH/var/log/packages/svn-9999-noarch-9999 # -> heet nu subversion |
---|
89 | touch $TARGETPATH/var/log/packages/glibc_i18n-2.5-i486-9999 |
---|
90 | touch $TARGETPATH/var/log/packages/pecl_eaccelerator-9-i486-9999 |
---|
91 | touch $TARGETPATH/var/log/packages/eaccelerator-9-i486-9999 |
---|
92 | touch $TARGETPATH/var/log/packages/openswan-9-i486-9999 |
---|
93 | touch $TARGETPATH/var/log/packages/zarafa-9-i486-9999 |
---|
94 | touch $TARGETPATH/var/log/packages/zarafa_conf-9-i486-9999 |
---|
95 | touch $TARGETPATH/var/log/packages/mod_jk-1.2.6-i486-2526 |
---|
96 | touch $TARGETPATH/var/log/packages/libgd2-9-i486-9999 # -> heet nu gd |
---|
97 | touch $TARGETPATH/var/log/packages/ntop-9-i486-9999 # -> heet nu ntopng |
---|
98 | touch $TARGETPATH/var/log/packages/libjasper-9-i486-9999 # -> heet nu jasper |
---|
99 | touch $TARGETPATH/var/log/packages/smbclient-9-i486-9999 |
---|
100 | touch $TARGETPATH/var/log/packages/samba_tools-9-i486-9999 |
---|
101 | |
---|
102 | |
---|
103 | |
---|
104 | #bootstrap webint (postinstaller normally does this, but we need the htdocs dir to do the networking stuff on the first boot) |
---|
105 | mv $TARGETPATH/usr/webint/htdocs.new $TARGETPATH/usr/webint/htdocs |
---|
106 | |
---|
107 | |
---|
108 | #set password |
---|
109 | chroot $TARGETPATH "/bin/bash" -c "/tmp/chpasswd" || exit 1 |
---|
110 | rm $TARGETPATH/tmp/chpasswd |
---|
111 | |
---|
112 | #disable services that are not down already |
---|
113 | #until the wizard completes |
---|
114 | #SvcUpdateActivationStatus() in the webint will reenable them |
---|
115 | #( |
---|
116 | # cd $TARGETPATH/service || exit 1 |
---|
117 | # for RUN in `find . -follow -name run|grep -v log`; do |
---|
118 | # DOWN=`dirname $RUN`/down |
---|
119 | # if ! [ -f $DOWN ]; then |
---|
120 | # echo disabled > $DOWN |
---|
121 | # fi |
---|
122 | # done |
---|
123 | #) || exit 1 |
---|
124 | |
---|
125 | #linkbeeper should be up, since you want it after just installing |
---|
126 | #rm $TARGETPATH/service/linkbeep/down &>/dev/null |
---|
127 | |
---|
128 | #sshkey voor regressie test. |
---|
129 | #Deze word alleen gekopieerd als het systeem in regressietest modus is, geen paniek dus. |
---|
130 | if [ -e /etc/remote.conf ]; then |
---|
131 | mkdir $TARGETPATH/root/.ssh |
---|
132 | cp -a /root/.ssh/authorized_keys $TARGETPATH/root/.ssh/ || exit 1 |
---|
133 | fi |
---|
134 | |
---|
135 | #mark the system as clean |
---|
136 | touch $TARGETPATH/.cleanshutdown |
---|
137 | touch $TARGETPATH/home/.cleanshutdown |
---|
138 | touch $TARGETPATH/boot/.cleanshutdown |
---|
139 | |
---|
140 | #cleanup mounts and daemons |
---|
141 | #killall udevd |
---|
142 | chroot $TARGETPATH "/bin/bash" -c "umount /proc" || exit 1 |
---|
143 | chroot $TARGETPATH "/bin/bash" -c "umount /sys" || exit 1 |
---|
144 | |
---|