Subversion Repositories livecd

Rev

Rev 7 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7 Rev 9
Line 71... Line 71...
71
    LOCALUSER=sluser
71
    LOCALUSER=sluser
72
fi
72
fi
73
 
73
 
74
 
74
 
75
###############################################################
75
###############################################################
76
# Backup some original files
-
 
77
###############################################################
-
 
78
 
-
 
79
echo "Backup original files ..."
-
 
80
 
-
 
81
ori_files="/etc/init.d/netfs \
-
 
82
           /etc/init.d/autofs \
-
 
83
           /etc/init.d/halt \
-
 
84
           /etc/init.d/network
-
 
85
           /etc/init.d/functions \
-
 
86
           /etc/rc.d/rc.sysinit \
-
 
87
           /etc/sysconfig/afs \
-
 
88
           /etc/motd \
-
 
89
           /etc/redhat-release \
-
 
90
           /etc/rc.d/rc.sysinit \
-
 
91
           /etc/resolv.conf"
-
 
92
 
-
 
93
for file in $ori_files; do
-
 
94
    [ ! -e ${file}.ori ] && cp -a ${file} ${file}.ori 2>/dev/null
-
 
95
done
-
 
96
 
-
 
97
 
-
 
98
 
-
 
99
###############################################################
-
 
100
# Configure system
76
# Configure system
101
###############################################################
77
###############################################################
102
 
78
 
103
echo "Configure system ..."
79
echo "Configure system ..."
104
 
80
 
Line 110... Line 86...
110
# build vpnclient kernel module
86
# build vpnclient kernel module
111
if [ -x /usr/sbin/mkvpnclient ]; then
87
if [ -x /usr/sbin/mkvpnclient ]; then
112
    mkvpnclient
88
    mkvpnclient
113
fi
89
fi
114
 
90
 
-
 
91
# backup /etc/resolv.conf 
-
 
92
cp -a /etc/resolv.conf /etc/resolv.conf.ori
-
 
93
 
115
# Update Virus definitions 
94
# Update Virus definitions 
116
# run freshclam
95
# run freshclam
117
if [ -x /usr/bin/freshclam ]; then
96
if [ -x /usr/bin/freshclam ]; then
118
    echo; echo "Run /usr/bin/freshclam:"
97
    echo; echo "Run /usr/bin/freshclam:"
119
    /etc/init.d/clamd status || /etc/init.d/clamd start && /usr/bin/freshclam
98
    /etc/init.d/clamd status || /etc/init.d/clamd start && /usr/bin/freshclam
Line 148... Line 127...
148
# umount PSI master
127
# umount PSI master
149
if [ $PSI ]; then
128
if [ $PSI ]; then
150
    umount /mnt/master 2>/dev/null
129
    umount /mnt/master 2>/dev/null
151
fi
130
fi
152
    
131
    
-
 
132
# make sure we have a original copy of /etc/rc.d/rc.sysinit
-
 
133
if [ ! -e /etc/rc.d/rc.sysinit.ori ]; then
-
 
134
    echo "Save /etc/rc.d/rc.sysinit as /etc/rc.d/rc.sysinit.ori"
-
 
135
    cp -a /etc/rc.d/rc.sysinit /etc/rc.d/rc.sysinit.ori
-
 
136
fi
-
 
137
 
153
# copy back /etc/yum.repos.d
138
# copy back /etc/yum.repos.d
154
if [ ! $PSI ]; then
139
if [ ! $PSI ]; then
155
    if [ -d /etc/yum.repos.d.ori ]; then
140
    if [ -d /etc/yum.repos.d.ori ]; then
156
	cp -a /etc/yum.repos.d.ori /etc/yum.repos.d
141
	cp -a /etc/yum.repos.d.ori /etc/yum.repos.d
157
    fi
142
    fi
Line 187... Line 172...
187
rm -rf /var/cache/yum/*
172
rm -rf /var/cache/yum/*
188
 
173
 
189
### remove cfengine log files
174
### remove cfengine log files
190
rm -f /var/cfengine/*log
175
rm -f /var/cfengine/*log
191
 
176
 
192
### delete log files
177
### clean log and rpm database
193
find /var/log/ -type f -exec rm -f {} \;
-
 
194
 
-
 
195
### clean rpm database
178
rm -rf /var/log/*
196
rm -rf /var/lib/rpm/__db.*
179
rm -rf /var/lib/rpm/__db.*
197
 
180
 
198
### clean /var/spool/mail
181
### clean /var/spool/mail
199
rm -rf /var/spool/mail/*
182
rm -rf /var/spool/mail/*
200
touch /var/spool/mail/root
183
touch /var/spool/mail/root
201
chmod 600 /var/spool/mail/root
184
chmod 600 /var/spool/mail/root
202
 
185
 
-
 
186
### stop sysstat and create empty log
-
 
187
if [ -e /etc/init.d/sysstat ]; then
-
 
188
    /etc/init.d/sysstat stop
-
 
189
    mkdir -p /var/log/sa
-
 
190
fi
-
 
191
 
-
 
192
### create some empty log dirs
-
 
193
rpm -q gdm > /dev/null
-
 
194
[ "$?" = "0" ] && mkdir -p /var/log/gdm
-
 
195
rpm -q iptraf > /dev/null
-
 
196
[ "$?" = "0" ] && mkdir -p /var/log/iptraf
-
 
197
rpm -q samba-common > /dev/null
-
 
198
[ "$?" = "0" ] && mkdir -p /var/log/samba
-
 
199
rpm -q ppp > /dev/null
-
 
200
[ "$?" = "0" ] && mkdir -p /var/log/ppp
-
 
201
rpm -q isdn4k-utils > /dev/null
-
 
202
[ "$?" = "0" ] && mkdir -p /var/log/vbox
-
 
203
rpm -q cups > /dev/null
-
 
204
[ "$?" = "0" ] && mkdir -p /var/log/cups
-
 
205
rpm -q clamav > /dev/null
-
 
206
if [ "$?" = "0" ]; then
-
 
207
    mkdir -p /var/log/clamav
-
 
208
    chown -R clamav /var/log/clamav
-
 
209
fi
-
 
210
 
203
### delete .cfsaved Files
211
### delete .cfsaved Files
204
if [ $PSI ]; then
212
if [ $PSI ]; then
205
    echo -n "Delete .cfsaved Files, please wait: "
213
    echo -n "Delete .cfsaved Files, please wait: "
206
    find / -xdev -name "*\.cfsaved" -exec rm -f {} \;
214
    find / -xdev -name "*\.cfsaved" -exec rm -f {} \;
207
    echo "ok."
215
    echo "ok."
208
fi
216
fi
209
 
217
 
210
### delete .rpmori .rpm Files in /etc
218
### delete .rpmori .rpm Files in /etc
211
find /etc -name "*\.rpmorig" -exec rm -f {} \;
219
find /etc -name "*\.rpmorig" -exec rm -f {} \;
212
find /etc -name "*\.rpmnew"  -exec rm -f {} \;
220
find /etc -name "*\.rpmnew" -exec rm -f {} \;
213
 
221
 
214
### delete *~ files in /etc
222
### delete *~ files in /etc
215
find /etc | grep "~$" | while read f; do rm -f "$f"; done
223
find /etc | grep "~$" | while read f; do rm -f "$f"; done
216
 
224
 
217
### clean up /root
225
### clean up /root
Line 328... Line 336...
328
    sed  -i "/\!\!\!/d" /etc/init.d/afs
336
    sed  -i "/\!\!\!/d" /etc/init.d/afs
329
fi
337
fi
330
 
338
 
331
### disable umount of loop device during shutdown
339
### disable umount of loop device during shutdown
332
#   this is done really dirty at the moment:
340
#   this is done really dirty at the moment:
333
#    -> just replace "loop" with non existing device "lo_fake"
341
#    -> just replace "loop" with non existing "lo_fake"
334
 
342
 
335
[ -e /etc/init.d/netfs ]     && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/netfs
343
[ -e /etc/init.d/netfs ]  && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/netfs
336
[ -e /etc/init.d/autofs ]    && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/autofs
344
[ -e /etc/init.d/autofs ] && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/autofs
337
[ -e /etc/init.d/halt ]      && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/halt
345
[ -e /etc/init.d/halt ]   && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/halt
338
[ -e /etc/init.d/functions ] && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/functions
-
 
339
 
346
 
340
# do not shuttdown loopback interface
347
# do not shuttdown loopback interface
341
sed -i "s|[^#]action \$\"Shutting down loopback interface:|\t#action \$\"Shutting down loopback interface:|" /etc/init.d/network
348
sed -i "s|[^#]action \$\"Shutting down loopback interface:|\t#action \$\"Shutting down loopback interface:|" /etc/init.d/network
342
 
349
 
343
### copy new /etc/init.d/halt 
350
### copy new /etc/init.d/halt 
344
cp -a customize/sl${OS_RELEASE}/halt /etc/init.d/halt
351
cp -a customize/halt /etc/init.d/halt
345
 
352
 
346
### in /etc/rc.d/rc.sysinit
353
### in /etc/rc.d/rc.sysinit
347
#   comment out 'initlog -c "fsck -T -a $rootdev $fsckoptions"' 
354
#   comment out 'initlog -c "fsck -T -a $rootdev $fsckoptions"' 
348
#   to disable fsck of root filesystem
355
#   to disable fsck of root filesystem
349
sed -i "s|\tfsck -T -a \$rootdev|\tsleep 0; #fsck -T -a \$rootdev|" /etc/rc.d/rc.sysinit
356
sed -i "s|\tfsck -T -a \$rootdev|\tsleep 0; #fsck -T -a \$rootdev|" /etc/rc.d/rc.sysinit
Line 400... Line 407...
400
fi
407
fi
401
if [ $DVD ]; then
408
if [ $DVD ]; then
402
    sed -i "s|CD|DVD|" /etc/redhat-release
409
    sed -i "s|CD|DVD|" /etc/redhat-release
403
fi
410
fi
404
 
411
 
-
 
412
 
405
### Make scratch
413
### Make scratch
406
if [ $PSI ]; then
414
if [ $PSI ]; then
407
    rm -rf /home/scratch
415
    rm -rf /home/scratch
408
    mkdir -p /home/scratch
416
    mkdir -p /home/scratch
409
    chmod 1777 /home/scratch
417
    chmod 1777 /home/scratch
Line 431... Line 439...
431
    echo "DISPLAYMANAGER=$DISPLAYMANAGER" >> /etc/sysconfig/desktop
439
    echo "DISPLAYMANAGER=$DISPLAYMANAGER" >> /etc/sysconfig/desktop
432
fi
440
fi
433
 
441
 
434
### GDM login background
442
### GDM login background
435
if [ -e /usr/share/gdm/themes/SL/background.png ]; then
443
if [ -e /usr/share/gdm/themes/SL/background.png ]; then
436
    cp -a customize/sl${OS_RELEASE}/background.png /usr/share/gdm/themes/SL/background.png
444
    cp -a customize/sl/background.png /usr/share/gdm/themes/SL/background.png
437
fi
445
fi
438
 
446
 
439
### KDE default background
447
### KDE default background
440
if [ ! $PSI ]; then
448
if [ ! $PSI ]; then
441
    if [ -e /usr/share/backgrounds/images/default.png ]; then
449
    if [ -e /usr/share/backgrounds/images/default.png ]; then
442
	cp -a customize/sl${OS_RELEASE}/default.png /usr/share/backgrounds/images/default.png
450
	cp -a customize/sl/default.png /usr/share/backgrounds/images/default.png
443
    fi
451
    fi
444
fi
452
fi
445
 
453
 
446
### KDE startup/exit sound
454
### KDE startup/exit sound
447
if [ -e /usr/share/config/knotify.eventsrc ]; then
455
if [ -e /usr/share/config/knotify.eventsrc ]; then
Line 512... Line 520...
512
echo "Create special files ..."
520
echo "Create special files ..."
513
 
521
 
514
###############################################################
522
###############################################################
515
# /etc/rc.d/init.d/kudzu-auto
523
# /etc/rc.d/init.d/kudzu-auto
516
### Noninteractive HW detection and configuration
524
### Noninteractive HW detection and configuration
-
 
525
cat > /etc/rc.d/init.d/kudzu-auto <<EOF
517
 
526
#!/bin/bash
518
cp -a customize/kudzu-auto /etc/init.d/kudzu-auto
527
# Noninteractive HW detection and configuration
-
 
528
. /etc/init.d/functions
-
 
529
action $"Hardware auto-detection, please wait... " /usr/sbin/kudzu -q 
-
 
530
EOF
519
chmod +x /etc/rc.d/init.d/kudzu-auto
531
chmod +x /etc/rc.d/init.d/kudzu-auto
520
ln -sf /etc/rc.d/init.d/kudzu-auto /etc/rc.d/rc5.d/S04kudzu-auto
532
ln -sf /etc/rc.d/init.d/kudzu-auto /etc/rc.d/rc5.d/S04kudzu-auto
521
ln -sf /etc/rc.d/init.d/kudzu-auto /etc/rc.d/rc3.d/S04kudzu-auto
533
ln -sf /etc/rc.d/init.d/kudzu-auto /etc/rc.d/rc3.d/S04kudzu-auto
522
 
534
 
523
 
535
 
Line 595... Line 607...
595
# /usr/bin/set-volume
607
# /usr/bin/set-volume
596
### unmute all mixers and set volumes
608
### unmute all mixers and set volumes
597
cp -a customize/set-volume /usr/bin/set-volume
609
cp -a customize/set-volume /usr/bin/set-volume
598
chmod +x /usr/bin/set-volume
610
chmod +x /usr/bin/set-volume
599
 
611
 
-
 
612
 
600
###############################################################
613
###############################################################
601
# /etc/sysconfig/networking/devices/ifcfg-eth0
614
# /etc/sysconfig/networking/devices/ifcfg-eth0
-
 
615
### default eth0 config files
602
# /etc/sysconfig/networking/devices/ifcfg-eth1
616
cat > /etc/sysconfig/networking/devices/ifcfg-eth0 <<EOF
-
 
617
DEVICE=eth0
603
 
618
ONBOOT=yes
604
for iface in eth0 eth1; do 
619
TYPE=Ethernet
-
 
620
BOOTPROTO=dhcp
605
 
621
USERCTL=no
606
    # remove it first
622
PEERDNS=yes
607
    rm -f /etc/sysconfig/networking/devices/ifcfg-${iface} 2>/dev/null
-
 
608
    rm -f /etc/sysconfig/networking/profiles/default/ifcfg-${iface} 2>/dev/null
-
 
609
    rm -f /etc/sysconfig/network-scripts/ifcfg-${iface} 2>/dev/null
623
IPV6INIT=no
610
 
624
EOF
611
    # create it, if we have a sample
-
 
612
    if [ -e customize/sl${OS_RELEASE}/ifcfg-${iface} ]; then
-
 
613
	cp -a customize/sl${OS_RELEASE}/ifcfg-${iface} /etc/sysconfig/networking/devices/ifcfg-${iface}
-
 
614
        # make hard links
625
# make hard links
615
	cp -lf /etc/sysconfig/networking/devices/ifcfg-${iface} /etc/sysconfig/networking/profiles/default/
626
cp -lf /etc/sysconfig/networking/devices/ifcfg-eth0 /etc/sysconfig/networking/profiles/default/
616
	cp -lf /etc/sysconfig/networking/devices/ifcfg-${iface} /etc/sysconfig/network-scripts/
627
cp -lf /etc/sysconfig/networking/devices/ifcfg-eth0 /etc/sysconfig/network-scripts/
617
    fi
-
 
618
done
-
 
619
 
628
 
-
 
629
###############################################################
-
 
630
# /etc/sysconfig/networking/devices/ifcfg-eth1
-
 
631
### default eth1 config files
-
 
632
cat > /etc/sysconfig/networking/devices/ifcfg-eth1 <<EOF
-
 
633
DEVICE=eth1
-
 
634
ONBOOT=yes
-
 
635
TYPE=Ethernet
-
 
636
BOOTPROTO=dhcp
-
 
637
USERCTL=no
-
 
638
PEERDNS=yes
-
 
639
IPV6INIT=no
-
 
640
EOF
-
 
641
# make hard links
-
 
642
cp -lf /etc/sysconfig/networking/devices/ifcfg-eth1 /etc/sysconfig/networking/profiles/default/
-
 
643
cp -lf /etc/sysconfig/networking/devices/ifcfg-eth1 /etc/sysconfig/network-scripts/
620
 
644
 
621
###############################################################
645
###############################################################
622
# /etc/profile.d/setsysfont.sh
646
# /etc/profile.d/setsysfont.sh
623
### setsysfont 
647
### setsysfont 
624
cat > /etc/profile.d/setsysfont.sh <<EOF
648
cat > /etc/profile.d/setsysfont.sh <<EOF
Line 728... Line 752...
728
echo "done."
752
echo "done."
729
echo "--------------------------------------------"
753
echo "--------------------------------------------"
730
 
754
 
731
 
755
 
732
###############################################################
756
###############################################################
733
# Update locate db, prelink, makewhatis
757
# Update slocate db, prelink, makewhatis
734
###############################################################
758
###############################################################
735
 
759
 
736
### run slocate
760
# run slocate
737
if [ -x /usr/bin/updatedb ]; then
761
if [ -x /usr/bin/updatedb ]; then
738
    echo "Run updatedb..."
762
    echo "Run updatedb..."
739
    . /etc/updatedb.conf 2>/dev/null
763
    . /etc/updatedb.conf
740
    rpm -q mlocate >/dev/null
-
 
741
    if [ "$?" = "0" ]; then
-
 
742
	/usr/bin/updatedb -e "/media /sfs /tmp /boot /livecd /home /net"
-
 
743
    else
-
 
744
	/usr/bin/updatedb -e /media,/tmp,/boot,/livecd,/home,/net
764
    /usr/bin/updatedb -e /tmp,/boot,/livecd,/home,/net
745
    fi
-
 
746
    echo "done."
765
    echo "done."
747
fi
766
fi
748
 
767
 
749
### run prelink
768
# run prelink
750
if [ -x /etc/cron.daily/prelink ]; then
769
if [ -x /etc/cron.daily/prelink ]; then
751
    echo "Run prelink..."
770
    echo "Run prelink..."
752
    /etc/cron.daily/prelink
771
    /etc/cron.daily/prelink
753
    echo "done."
772
    echo "done."
754
fi
773
fi
755
if [ -x /etc/cron_backup/prelink ]; then
774
if [ -x /etc/cron_backup/prelink ]; then
756
    echo "Run prelink..."
775
    echo "Run prelink..."
757
    /etc/cron_backup/prelink
776
    /etc/cron_backup/prelink
758
    echo "done."
777
    echo "done."
759
fi
778
fi
760
# clean log
-
 
761
rm -f /var/log/prelink/prelink.log 2>/dev/null
-
 
762
rm -f /var/log/prelink.log 2>/dev/null
-
 
763
 
779
 
764
### run makewhatis
780
# run makewhatis
765
if [ -x /usr/bin/makewhatis ]; then
781
if [ -x /usr/bin/makewhatis ]; then
766
    echo "Run makewhatis..."
782
    echo "Run makewhatis..."
767
    makewhatis -u -w
783
    makewhatis -u -w
768
fi
784
fi
769
 
785