source: pkg/main/parsix-installer/trunk/02-install-tools.bm @ 2579

Revision 2579, 19.7 KB checked in by alanbach-guest, 5 years ago (diff)
  • Libata is enabled by default, so remove Dell MM061 series workround, * Some more clean-ups
Line 
1#!/bin/bash
2
3# Find changes in (real) files of dir1 ... dir2
4# function taken from saveconfig
5system_findchanged(){
6        if [ -d "$1" ]; then
7                for i in $( cd "$1"; find . -type f | sed 's,^\./,,g' | grep -v ' ' ); do
8                        cmp -s "$1/$i" "$2/$i" || echo "$1/$i"
9                done
10        elif [ -e "$1" ]; then
11                        cmp -s "$1" "$2" || echo "$1"
12        fi
13}
14
15#
16# Needed for all modes that feature nohwsetup.
17#
18
19system_add_hd_autoconfig()
20{
21        echo "SYSTEM_TYPE=$SYSTEM_TYPE" >> $TARGET_MNT_POINT/etc/default/parsix
22        echo "SYSTEM_HW_PROFILE=yes" >> $TARGET_MNT_POINT/etc/default/parsix
23       
24        # TODO: :-)
25        [ ! -r /etc/init.d/knoppix-hd-autoconfig -a -x tools/knoppix-hd-autoconfig ] && cp -f tools/knoppix-hd-autoconfig $TARGET_MNT_POINT/etc/init.d/
26
27        chroot_it update-rc.d -f -f knoppix-autoconfig remove . 2>/dev/null >/dev/null
28        [ "$SYSTEM_TYPE" = "beginner" ] && chroot_it update-rc.d -f knoppix-hd-autoconfig start 00 S . >/dev/null
29
30        # TODO: Remove the hacks
31        perl -pi -e 's/rebuildfstab -r -u parsix -g parsix/[ -d \/PARSIX ] && rebuildfstab -r -u parsix -g parsix || rebuildfstab -r/g'  $TARGET_MNT_POINT/sbin/hotplug-knoppix &>/dev/null
32        perl -pi -e 's/rebuildfstab -r -u parsix -g parsix/[ -d \/PARSIX ] && rebuildfstab -r -u parsix -g parsix >\/dev\/null 2>\/dev\/null || rebuildfstab -r/g'  $TARGET_MNT_POINT/etc/init.d/knoppix-autoconfig &>/dev/null
33
34        # TODO: Really _fix_ it:
35        perl -pi -e 's/ReadOnly=1/ReadOnly=0/g' "$TARGET_MNT_POINT/usr/bin/mkdesktophdicons"    &>/dev/null
36        perl -pi -e 's/uid=parsix,gid=parsix,//g' "$TARGET_MNT_POINT/etc/automount.sh"  &>/dev/null
37
38        if [ -x "$TARGET_MNT_POINT/usr/bin/mkdesktophdicons" ]; then
39                mount --bind /proc "$TARGET_MNT_POINT/proc"
40                chroot "$TARGET_MNT_POINT" su "$USER_NAME" -c mkdesktophdicons
41                umount "$TARGET_MNT_POINT/proc"
42        fi
43}
44
45system_add_hd_config()
46{
47        # TODO: :-)
48        [ ! -r /etc/init.d/knoppix-hd-config -a -x tools/knoppix-hd-config ] && cp -f tools/knoppix-hd-config $TARGET_MNT_POINT/etc/init.d/
49
50        DEFAULT_CONFIG_DIR=$TARGET_MNT_POINT/etc/knoppix
51
52        mkdir -p $DEFAULT_CONFIG_DIR/etc/network/
53       
54        save_config $DEFAULT_CONFIG_DIR/install-configuration
55        chmod 600 $DEFAULT_CONFIG_DIR/install-configuration
56
57        cp -af /$DEFAULT_DIR/etc/network/interfaces $DEFAULT_CONFIG_DIR/etc/network/
58        cp -af /$DEFAULT_DIR/etc/pcmcia $DEFAULT_CONFIG_DIR/etc/
59        cp -af /$DEFAULT_DIR/etc/cups $DEFAULT_CONFIG_DIR/etc/
60
61        chroot_it update-rc.d -f knoppix-hd-config start 01 S . >/dev/null
62}
63
64system_copy_etc()
65{
66        update_status $"Copying custom configuration ..."
67       
68        # copy changed files in /etc
69        ( cd $TARGET_MNT_POINT; system_findchanged /etc /PARSIX/etc | egrep -v "fstab|passwd|shadow|group" | tar -T - -cf - | tar xf -) 2>/dev/null
70
71        # Activate xorg-common
72        if [ -x /usr/bin/Xorg ]; then
73                [ -x /etc/init.d/xorg-common ] && chroot_it update-rc.d -f xorg-common start 70 S . >/dev/null
74                [ -x /etc/init.d/x-common ]    && chroot_it update-rc.d -f x-common    start 70 S . >/dev/null
75                [ -x /etc/init.d/x11-common ]  && chroot_it update-rc.d -f x11-common  start 70 S . >/dev/null
76        fi
77
78        # Save ALSA sound volume
79        [ -e /proc/asound/modules -a -x /usr/sbin/alsactl ] && /usr/sbin/alsactl store
80       
81        # Copy volume setting
82        [ -f /var/lib/alsa/asound.state ] && cp /var/lib/alsa/asound.state $TARGET_MNT_POINT/var/lib/alsa
83
84        if [ ! "$SYSTEM_TYPE" = "debian" ]; then
85                # TODO: Remove hack from here
86                perl -pi -e "s/insmod/modprobe/g" $TARGET_MNT_POINT/etc/init.d/live-autoconfig
87        fi
88       
89        # Add dpi setting from cheatcode to hd install
90
91        [ ! -e /etc/sysconfig/base ] && [ -e /etc/sysconfig/parsix ] && source /etc/sysconfig/parsix
92        [ -e /etc/sysconfig/base ] && source /etc/sysconfig/base
93        [ -z "$CUSTOM_DPI" ] && CUSTOM_DPI=96   
94}
95
96system_copy_home()
97{
98        update_status $"Copying home directory ..."
99       
100        #copy home directory from running user
101
102        #check if already data is there then stop
103        if [ -d "$TARGET_MNT_POINT/home/$USER_NAME" ]; then
104                chroot "$TARGET_MNT_POINT" chown -R "$USER_NAME":"$USER_NAME" "/home/$USER_NAME"
105                return 0
106        fi
107
108        if [ -d "/home/$DEFAULT_USER/.kde" ]; then
109                rm -rf "$TARGET_MNT_POINT/home/$DEFAULT_USER"
110                cp -a "/home/$DEFAULT_USER" "$TARGET_MNT_POINT/home"
111                [ "$USER_NAME" != "$DEFAULT_USER" ] && mv "$TARGET_MNT_POINT/home/$DEFAULT_USER" "$TARGET_MNT_POINT/home/$USER_NAME"
112        else
113                cp -a "$TARGET_MNT_POINT/etc/skel" "$TARGET_MNT_POINT/home"
114                mv "$TARGET_MNT_POINT/home/skel" "$TARGET_MNT_POINT/home/$USER_NAME"
115        fi
116
117        chroot "$TARGET_MNT_POINT" chown -R "$USER_NAME":"$USER_NAME" "/home/$USER_NAME"
118
119        if [ -x "$TARGET_MNT_POINT/usr/bin/mkdesktophdicons" ]; then
120                mount --bind /proc "$TARGET_MNT_POINT/proc"
121                chroot "$TARGET_MNT_POINT" su "$USER_NAME" -c mkdesktophdicons
122                umount "$TARGET_MNT_POINT/proc"
123        fi
124
125        # Remove Netscape Directories
126       
127        rm -rf "$TARGET_MNT_POINT/home/$USER_NAME/.netscape*"
128
129        # Mozilla Konfigdateien korrigieren
130
131        if [ "$USER_NAME" != "$DEFAULT_USER" ]; then
132                rm -f "$TARGET_MNT_POINT/home/$USER_NAME/.mozilla/appreg"
133                rm -f "$TARGET_MNT_POINT/home/$USER_NAME/.mozilla/pluginreg.dat"
134                # TODO: Test if symlink works ...
135                if [ -e "$TARGET_MNT_POINT/home/$USER_NAME/.mozilla/$DEFAULT_USER" ]; then
136                        [ -e "$TARGET_MNT_POINT/home/$USER_NAME/.mozilla/default" ] || mv "$TARGET_MNT_POINT/home/$USER_NAME/.mozilla/$DEFAULT_USER" "$TARGET_MNT_POINT/home/$USER_NAME/.mozilla/default"
137                fi
138
139                # Bei unterschiedlichem OLD/NEWHOME muss man die Pfade anpassen, sonst funktionieren die Anwendungen nicht korrekt
140
141                OLDHOME="/home/$DEFAULT_USER"
142                NEWHOME="/home/$USER_NAME"
143                PART="$TARGET_MNT_POINT"
144                for f in $(find "$PART$NEWHOME" -exec grep -ls "$OLDHOME" {} \;|grep -v $0); do
145                        perl -pi -e "s|$OLDHOME|$NEWHOME|g" "$f"
146                done
147        fi
148}
149
150system_setup_dm()
151{
152        if [ -f /etc/init.d/gdm ]; then
153                # Start gdm in runlevel 5
154                chroot_it update-rc.d -f gdm start 99 5 . >/dev/null
155        elif [ -f /etc/init.d/kdm ]; then
156                # Start kdm in runlevel 5
157                chroot_it update-rc.d -f kdm start 99 5 . >/dev/null
158        fi
159}
160
161system_install_templates()
162{
163        TEMPLATE_PATH=""
164        [ -d "$SEARCHPATH/templates" ] && TEMPLATE_PATH="$SEARCHPATH/templates"
165        if [ -n "$TEMPLATE_PATH" ]; then
166                # change prompt (/etc/profile)
167                cp -af "$TEMPLATE_PATH/etc/profile" "$TARGET_MNT_POINT/etc/profile"
168
169                # "normalize" /etc/inittab
170                cp -af "$TEMPLATE_PATH/etc/inittab" "$TARGET_MNT_POINT/etc/inittab"
171       
172                # /etc/inetd.conf, #008341
173                cp -af "$TEMPLATE_PATH/etc/inetd.conf" "$TARGET_MNT_POINT/etc/inetd.conf"
174       
175                # remove Parsix entry from /etc/sudoers
176                cp -af "$TEMPLATE_PATH/etc/sudoers" "$TARGET_MNT_POINT/etc/sudoers"
177                chown root:root "$TARGET_MNT_POINT/etc/sudoers"
178                chmod 0440 "$TARGET_MNT_POINT/etc/sudoers"
179
180                # use less restrictive /etc/hosts.allow
181                cp -af "$TEMPLATE_PATH/etc/hosts.allow" "$TARGET_MNT_POINT/etc/hosts.allow"
182        else
183                echo $"Warning: Templates could not be found. Not updating: profile, inittab, inetd.conf, sudoers, hosts.allow!" 1>&2
184        fi
185       
186        # disable all services in /etc/inetd.conf
187        chroot_it update-inetd --multi --disable '*'
188}
189
190# These are additional services that can be used with _all_ modes.
191system_add_services()
192{
193        # ALSA aktivieren, wenn möglich
194        if [ -e /proc/asound/modules ]; then
195                if [ -x /etc/init.d/alsa-utils ]; then
196                        chroot_it update-rc.d -f alsa-utils defaults
197                elif [ -x /etc/init.d/alsa ]; then
198                        chroot_it update-rc.d -f alsa defaults
199                fi
200        fi
201
202        [ -x /etc/init.d/cupsys ] && chroot_it update-rc.d -f cupsys defaults &>/dev/null
203       
204        [ -x /etc/init.d/mountall.sh ] &&  chroot_it update-rc.d -f mountall.sh start 35 S . &>/dev/null
205
206        if [ "$INSTALL_KANO" = "yes" ]; then                           
207                # configure /etc/kernel-pkg.conf
208                [ -f "$TARGET_MNT_POINT/etc/kernel-pkg.conf" ] && \
209                        perl -pi -e "s/^maintainer.*\=.*/maintainer \:\= $NAME_NAME/;s/^email.*\=.*/email \:\= $USER_NAME\@$HOST_NAME\.local/" "$TARGET_MNT_POINT/etc/kernel-pkg.conf"
210               
211                # create ssh keys
212                [ -e "$TARGET_MNT_POINT/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -q -t rsa -f "$TARGET_MNT_POINT/etc/ssh/ssh_host_rsa_key" -C '' -N ''
213                [ -e "$TARGET_MNT_POINT/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -q -t dsa -f "$TARGET_MNT_POINT/etc/ssh/ssh_host_dsa_key" -C '' -N ''
214
215                # remove live- only packages
216                chroot_it dpkg --purge parsix-installer         &> /dev/null
217                chroot_it dpkg --purge initscripts-parsix-live  &> /dev/null
218
219                if [ "$SYSTEM_TYPE" = "debian" ]; then                 
220                        chroot_it dpkg --purge sudoers-parsix                   &> /dev/null
221                        chroot_it dpkg --purge restartx-parsix                  &> /dev/null
222                        chroot_it dpkg --purge xsession-initscript-parsix       &> /dev/null
223                        chroot_it dpkg --purge xorgconfig-parsix                &> /dev/null
224                       
225                        #  disable live config
226                        [ -f "$TARGET_MNT_POINT/etc/default/distro" ] && \
227                                perl -pi -e "s/^FLL_DISTRO_MODE\=.*/FLL_DISTRO_MODE\=\"installed\"/" "$TARGET_MNT_POINT/etc/default/distro"
228                fi
229
230                # enable udev, if installed
231                if [ -x /etc/init.d/udev ]; then
232                        chroot_it dpkg --purge fix-cdrom                        &> /dev/null
233                        chroot_it dpkg --purge pcmcia-cs                        &> /dev/null
234                        rm -f "$TARGET_MNT_POINT/home/$USER_NAME/Desktop"/[sh]d[a-z][1-9]
235                        rm -f "$TARGET_MNT_POINT/home/$USER_NAME/Desktop"/[sh]d[a-z][1-9][0-9]
236                        rm -f "$TARGET_MNT_POINT/home/$USER_NAME/Desktop"/CD-ROM\ \[cdrom\]
237                        rm -f "$TARGET_MNT_POINT/home/$USER_NAME/Desktop"/CD-ROM\ \[cdrom[1-9]\]
238                        rm -f "$TARGET_MNT_POINT/home/$USER_NAME/Desktop"/Floppy
239                        rm -f "$TARGET_MNT_POINT/etc/skel/Desktop"/Floppy
240                                               
241                        # fix ownership
242                        chroot_it chown -R "$USER_NAME":"$USER_NAME" "/home/$USER_NAME"
243                fi
244        fi     
245}
246
247system_services()
248{
249        SYSTEM_SERVICES_D="sysklogd:10:90 klogd:11:90 kerneld:12:12 ppp:14:14 pcmcia:15:15 logoutd:20:20 makedev:20:20 atd:89:89 cron:89:11"
250
251        # unfreeze init
252        [ -x /usr/sbin/unfreeze-rc.d ] && chroot_it unfreeze-rc.d
253
254        # start services wanted in config ...
255        for i in $SERVICES_START; do
256                chroot_it update-rc.d -f $i defaults                                                            &>/dev/null
257        done
258       
259        ### initscripts ###
260        # create basic system runlevel
261        #
262        #       Okay, we could do this with update-rc.d, but that would probably
263        #       be pretty slow. This way we win some speed.
264        #       DO NOT FOLLOW THIS EXAMPLE IN OTHER PACKAGES.
265        #
266        if [ -x "$TARGET_MNT_POINT/etc/init.d/mountvirtfs" ]; then
267                chroot_it update-rc.d -f mountvirtfs    start 2 S . start 36 S .                                &>/dev/null
268                # XXX: workaround for broken update-rc.d
269                chroot_it ln -sf ../init.d/mountvirtfs /etc/rcS.d/S02mountvirtfs
270                for i in devpts.sh mountkernfs; do
271                        if [ -f "$TARGET_MNT_POINT/etc/init.d/$i" ]; then
272                                rm -f "$TARGET_MNT_POINT/etc/init.d/$i"
273                                chroot_it update-rc.d -f "$i" remove                                            &>/dev/null
274                        fi
275                done
276        elif [ -x "$TARGET_MNT_POINT/etc/init.d/mountkernfs" ]; then
277                chroot_it update-rc.d -f mountkernfs    start 36 S .                                            &>/dev/null
278        else
279                chroot_it update-rc.d -f devpts.sh              start 36 S .                                    &>/dev/null
280        fi
281
282        chroot_it update-rc.d -f bootlogd       start 5 S .                                                     &>/dev/null
283        chroot_it update-rc.d -f checkroot.sh   start 10 S .                                                    &>/dev/null
284        chroot_it update-rc.d -f checkfs.sh     start 30 S .                                                    &>/dev/null
285        chroot_it update-rc.d -f mountall.sh    start 35 S .                                                    &>/dev/null
286        chroot_it update-rc.d -f hostname.sh    start 40 S .                                                    &>/dev/null
287        chroot_it update-rc.d -f mountnfs.sh    start 45 S .                                                    &>/dev/null
288        chroot_it update-rc.d -f mountnfs-bootclean.sh start 46 S .                                             &>/dev/null
289        chroot_it update-rc.d -f bootmisc.sh    start 55 S .                                                    &>/dev/null
290        chroot_it update-rc.d -f urandom        start 55 S . start 30 0 6 .                                     &>/dev/null
291        chroot_it update-rc.d -f bootclean      start 56 S .                                                    &>/dev/null
292        #
293        #       Links in "normal" runlevels.
294        #
295        chroot_it update-rc.d -f sendsigs       start 20 0 6 .                                                  &>/dev/null
296        chroot_it update-rc.d -f umountnfs.sh   start 31 0 6 .                                                  &>/dev/null
297        chroot_it update-rc.d -f umountnfs-bootclean.sh start 32 0 6 .                                          &>/dev/null
298        chroot_it update-rc.d -f umountfs       start 40 0 6 .                                                  &>/dev/null
299        chroot_it update-rc.d -f umountroot     start 60 0 6 .                                                  &>/dev/null
300        chroot_it update-rc.d -f halt           start 90 0 .                                                    &>/dev/null
301        chroot_it update-rc.d -f reboot         start 90 6 .                                                    &>/dev/null
302        chroot_it update-rc.d -f rmnologin      start 99 2 3 4 5 .                                              &>/dev/null
303        chroot_it update-rc.d -f single         start 20 1 .                                                    &>/dev/null
304        chroot_it update-rc.d -f stop-bootlogd  start 99 2 3 4 5 .                                              &>/dev/null
305
306        ### console-tools ###   
307        chroot_it update-rc.d -f console-screen.sh start 1 S .                                                  &>/dev/null
308
309        ### pppconfig ###
310        chroot_it update-rc.d -f dns-clean      start 39 S .                                                    &>/dev/null
311
312        ### util-linux ###
313        chroot_it update-rc.d -f hwclock.sh     start 50 S . stop 25 0 6 .                                      &>/dev/null
314        chroot_it update-rc.d -f hwclockfirst.sh        start 22 S .                                            &>/dev/null
315       
316        ### ifupdown ###
317        chroot_it update-rc.d -f ifupdown       start 39 S . start 36 0 6 .                                     &>/dev/null
318        chroot_it update-rc.d -f ifupdown-clean start 18 S .                                                    &>/dev/null
319       
320        ### console-common ###
321        chroot_it update-rc.d -f keymap.sh      start 05 S .                                                    &>/dev/null
322
323        ### module-init-tools ###
324        chroot_it update-rc.d -f module-init-tools      start 20 S .                                            &>/dev/null
325
326        ### netbase ###
327        chroot_it update-rc.d -f networking     start 40 S . start 35 0 6 .                                     &>/dev/null
328       
329        ### portmap ###
330        chroot_it update-rc.d -f portmap        start 42 S . start 32 0 6 .                                     &>/dev/null
331
332        ### ppp ###
333        chroot_it update-rc.d -f ppp            start 14 2 3 4 5 . stop 86 0 1 6 .                              &>/dev/null
334        chroot_it update-rc.d -f pppd-dns       start 38 S .                                                    &>/dev/null
335
336        ### procps ###
337        chroot_it update-rc.d -f procps.sh      start 30 S .                                                    &>/dev/null
338
339        ### setserial ###
340        chroot_it update-rc.d -f etc-setserial  start 30 S . stop 30 0 6 .                                      &>/dev/null
341        chroot_it update-rc.d -f setserial      start 46 S . stop 19 0 6 .                                      &>/dev/null
342
343        # Start hotplug
344        chroot_it update-rc.d -f hotplug        start 40 S .                                                    &>/dev/null
345        chroot_it update-rc.d -f hotplug-net    start 41 S . stop 89 0 6 .                                      &>/dev/null
346
347        # udev
348        chroot_it update-rc.d -f udev           start 04 S .                                                    &>/dev/null
349        chroot_it update-rc.d -f udev-mtab      start 36 S .                                                    &>/dev/null
350
351        # dbus
352        chroot_it update-rc.d -f dbus           defaults                                                        &>/dev/null
353
354        # hplip
355        chroot_it update-rc.d -f hplip          defaults 19                                                     &>/dev/null
356       
357        # hot-key
358        chroot_it update-rc.d -f hotkey-setup   start 98 2 5 . stop 90 0 6 .                                    &>/dev/null
359
360        # bluetooth     
361        chroot_it update-rc.d -f bluetooth      start 25 2 5 . stop 74 0 6 .                                    &>/dev/null
362
363        # nfs
364        chroot_it update-rc.d -f nfs-common     start 43 S . stop 33 0 6 .                                      &>/dev/null
365        chroot_it update-rc.d -f nfs-kernel-server      start 44 S . stop 32 0 6 .                              &>/dev/null
366
367        # Activate sl-modem-daemon if needed
368        SLAMR=`grep -c slamr /proc/devices`
369        if [ $SLAMR -ne 0 ]; then
370                chroot_it update-rc.d -f sl-modem-daemon  start 26 2 5 . stop 75 0 6 . &>/dev/null
371        fi
372
373        # Activate powernowd if needed
374        if [ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
375                chroot_it update-rc.d -f powernowd start 95 2 5 . stop 90 0 6 . &>/dev/null
376        fi
377
378        # Acer hotkey auto-activation
379        MFG=`dmidecode --string system-manufacturer | grep -c Acer`
380        if [ $MFG -ne 0 ]; then
381                chroot_it update-rc.d -f acerhk start 38 S . &>/dev/null
382        fi
383
384        # activate 915resolution for wide screens
385        WIDE=`grep -c 1200x800 /etc/X11/xorg.conf`
386        CHIP=`grep -c i810 /etc/X11/xorg.conf`
387        if [ $CHIP -ne 0 ]; then
388                if [ $WIDE -ne 0 ]; then
389                        chroot_it update-rc.d -f 915resolution start 85 2 5 . stop 80 0 6 . &>/dev/null
390                else
391                        WIDE=`grep -c 1440x1050 /etc/X11/xorg.conf`
392                        if [ $WIDE -ne 0 ]; then
393                                chroot_it update-rc.d -f 915resolution start 85 2 5 . stop 80 0 6 . &>/dev/null
394                        fi
395                fi
396        fi
397       
398        # Add default scripts to runlevels
399        for i in $SYSTEM_SERVICES_D; do
400                SYSTEM_SERVICE=$(echo $i | cut -d: -f1)
401                SYSTEM_START=$(echo $i | cut -d: -f2)
402                SYSTEM_STOP=$(echo $i | cut -d: -f3)
403                chroot_it update-rc.d -f "$SYSTEM_SERVICE" defaults "$SYSTEM_START" "$SYSTEM_STOP"                      &>/dev/null
404        done
405
406        # start automounter
407        chroot_it update-rc.d -f autofs remove          &>/dev/null
408        chroot_it update-rc.d -f autofs defaults        &>/dev/null
409
410        # Display Manager "korrekt" starten - also nur im Runlevel 5
411        #       (das gilt aber auch eigentlich nur für nicht-debian Systeme ;-))
412       
413        for DM in kdm xdm gdm; do
414                if [ -e "$TARGET_MNT_POINT/etc/init.d/$DM" ]; then
415                        chroot_it update-rc.d -f -f "$DM"       remove                          &>/dev/null
416                        chroot_it update-rc.d -f "$DM"  start 99 5 . stop 1 0 1 2 3 4 6 .       >/dev/null
417                fi
418        done
419
420        # PCMCIA ausschalten, wenn nicht nötig
421        grep -q pcmcia /proc/devices || chroot_it update-rc.d -f -f pcmcia remove >/dev/null 2>/dev/null
422       
423        # ACPI Anpassung
424        [ -d /proc/acpi -a -x /etc/init.d/acpid ] && chroot_it update-rc.d -f acpid defaults >/dev/null
425
426        # Freeze init
427        [ -x /usr/sbin/freeze-rc.d ] && chroot_it freeze-rc.d
428
429}
430
431system_install_keymap()
432{
433        [ -f /etc/sysconfig/keyboard ] && source /etc/sysconfig/keyboard
434
435        # Add correct keymap (thx to Joerg Schirottke)
436        [ -n "$KEYTABLE" ] && chroot_it install-keymap "$KEYTABLE" 2>/dev/null
437}
438
439system_install_i18n()
440{
441        # Environment korrekt setzen
442
443        if [ -e "$TARGET_MNT_POINT/etc/sysconfig/i18n" ]; then
444                source "$TARGET_MNT_POINT/etc/sysconfig/i18n"
445                echo LANG=$LANG >> "$TARGET_MNT_POINT/etc/environment"
446                if [ "$LANG" == "el_GR" ]; then
447                        echo LANGUAGE=$(echo $LANG|perl -pe '($_)=/(..)/') >> "$TARGET_MNT_POINT/etc/environment"
448                        echo LC_ALL=$LANG >> "$TARGET_MNT_POINT/etc/environment"
449                fi
450        fi
451}
452
453# Everything needed for hw-detection
454
455system_create_modules()
456{
457        # create device symlink /dev/mouse ( normally done by hwsetup )
458        cp -a /dev/mouse "$TARGET_MNT_POINT/dev/"
459
460        # create /etc/modules from current loaded modules
461        cat <<EOF >$TMP
462# /etc/modules: kernel modules to load at boot time.
463#
464# This file should contain the names of kernel modules that are
465# to be loaded at boot time, one per line.  Comments begin with
466# a '#', and everything on the line after them are ignored.
467EOF
468
469        BLACKLIST=$(cut -f1 -d' ' /lib/modules/$(uname -r)/modules.usbmap|sort|uniq|perl -pe 's/#\n//;s/\n/|/g')"cloop|snd|radeon|fsam7400|capi|hisax|fcpci|fcdsl|ieee80211|slam|unionfs|dri"
470        cat /proc/modules | tac | grep -v '\[.*\]' | egrep -v "$BLACKLIST" |
471        while read mod x; do
472                if [ "$mod" = apm ]; then
473                        echo "apm power_off=1" >>$TMP
474                elif [ "$mod" = sbp2 ]; then
475                        echo "sbp2 serialize_io=1" >>$TMP
476                else
477                        echo "$mod" >>$TMP
478                fi
479        done
480
481        WHITELIST="ipw2100|ipw2200"
482        cat /proc/modules | tac | grep -v '\[.*\]' | egrep "$WHITELIST" |
483        while read mod x; do
484                echo "$mod" >>$TMP
485        done
486
487        cp -f $TMP "$TARGET_MNT_POINT/etc/modules"
488       
489        # for the future :-)
490        cp -f $TMP "$TARGET_MNT_POINT/etc/modules-$(uname -r)"
491
492        # Also save /etc/sysconfig/
493        mkdir -p $TARGET_MNT_POINT/etc/sysconfig/$(uname -r)
494        cp -f /etc/sysconfig/{i18n,keyboard,desktop,parsix,netcard,mouse,sound,xserver,floppy} $TARGET_MNT_POINT/etc/sysconfig/$(uname -r)/ 2>/dev/null # silence messages
495        cp -f /etc/X11/xorg* $TARGET_MNT_POINT/etc/sysconfig/$(uname -r)/ 2>/dev/null # silence messages
496       
497        # add DMA activation to bootmisc.sh (commented out if nodma is set)
498        if [ "$INSTALL_KANO" = "no" ]; then
499                x=""
500                checkbootparam nodma && x='#'
501                echo "# enable DMA" >>$TARGET_MNT_POINT/etc/init.d/bootmisc.sh
502                if [ -f /proc/partitions ]; then
503                        while read x x x p x; do
504                                case "$p" in
505                                        hd?)
506                                                [ -r "/proc/ide/$p/media" ] && echo "$x /sbin/hdparm -qd1 /dev/$p" >>$TARGET_MNT_POINT/etc/init.d/bootmisc.sh
507                                                ;;
508                                esac
509                        done < /proc/partitions
510                fi
511        fi
512       
513        # Run fix-cdrom at boottime
514        if [ -x $TARGET_MNT_POINT/usr/sbin/fix-cdrom ]; then
515                echo "# detect CDROMs" >>$TARGET_MNT_POINT/etc/init.d/bootmisc.sh
516                echo "[ -x /usr/sbin/fix-cdrom ] && /usr/sbin/fix-cdrom" >>$TARGET_MNT_POINT/etc/init.d/bootmisc.sh
517        fi
518}
519
520system_update_files()
521{
522        # update /etc/motd
523        rm -f $TARGET_MNT_POINT/etc/motd 2>/dev/null
524        echo -e $"Welcome to Parsix GNU/Linux" "(Kernel $(uname -r))\n" > $TARGET_MNT_POINT/etc/motd 2>/dev/null
525
526        cat <<EOF >$TARGET_MNT_POINT/etc/hosts
527127.0.0.1       $HOST_NAME localhost
528
529# The following lines are desirable for IPv6 capable hosts
530# (added automatically by netbase upgrade)
531
532::1     ip6-localhost ip6-loopback
533fe00::0 ip6-localnet
534ff00::0 ip6-mcastprefix
535ff02::1 ip6-allnodes
536ff02::2 ip6-allrouters
537ff02::3 ip6-allhosts
538EOF
539
540        echo "$HOST_NAME" > $TARGET_MNT_POINT/etc/hostname
541        echo "$HOST_NAME" > $TARGET_MNT_POINT/etc/mailname
542       
543        # create "real" /tmp with mode 1777
544        rm -f $TARGET_MNT_POINT/tmp 2>/dev/null
545        mkdir -p $TARGET_MNT_POINT/tmp
546        chmod 1777 $TARGET_MNT_POINT/tmp
547
548        # create /etc/mtab as a regular file
549        rm -f $TARGET_MNT_POINT/etc/mtab
550        touch $TARGET_MNT_POINT/etc/mtab
551}
552
Note: See TracBrowser for help on using the repository browser.