Subversion Repositories livecd

Rev

Rev 117 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 117 Rev 125
Line 115... Line 115...
115
# update f-prot and uvscan
115
# update f-prot and uvscan
116
[ -x /usr/local/f-prot/tools/check-updates.pl ] && /usr/local/f-prot/tools/check-updates.pl
116
[ -x /usr/local/f-prot/tools/check-updates.pl ] && /usr/local/f-prot/tools/check-updates.pl
117
[ -x /usr/local/uvscan/update-dat ] && /usr/local/uvscan/update-dat
117
[ -x /usr/local/uvscan/update-dat ] && /usr/local/uvscan/update-dat
118
 
118
 
119
# run depmod -a for the LiveCD kernels
119
# run depmod -a for the LiveCD kernels
120
echo "Run depmod -a $KERNEL ..."; depmod -a $KERNEL
120
echo "Run depmod -a $KERNEL ..."
-
 
121
depmod -a $KERNEL
121
if [ $SMP ]; then
122
if [ $SMP ]; then
122
    echo "Run depmod -a ${KERNEL}smp ..."
123
    echo "Run depmod -a ${KERNEL}smp ..."
123
    depmod -a ${KERNEL}smp
124
    depmod -a ${KERNEL}smp
124
fi
125
fi
125
 
126
 
Line 127... Line 128...
127
userdel -r $LOCALUSER 2>/dev/null
128
userdel -r $LOCALUSER 2>/dev/null
128
userdel -r l_psi 2>/dev/null
129
userdel -r l_psi 2>/dev/null
129
userdel -r sluser 2>/dev/null
130
userdel -r sluser 2>/dev/null
130
userdel -r user 2>/dev/null
131
userdel -r user 2>/dev/null
131
 
132
 
132
# umount PSI master
-
 
133
[ $PSI ] && umount /mnt/master 2>/dev/null
-
 
134
    
-
 
135
# copy back /etc/yum.repos.d
133
# copy back /etc/yum.repos.d.ori to /etc/yum.repos.d
136
if [ ! $PSI ]; then
-
 
137
    if [ -d /etc/yum.repos.d.ori ]; then
134
if [ -d /etc/yum.repos.d.ori ]; then
138
	cp -a /etc/yum.repos.d.ori /etc/yum.repos.d
135
    cp -a /etc/yum.repos.d.ori /etc/yum.repos.d
139
    fi
-
 
140
fi
136
fi
141
 
137
 
142
# run cfagent
138
# run cfagent
143
if [ $PSI ]; then
139
if [ $PSI ]; then
144
    if [ -e /usr/bin/cfagent ]; then
140
    if [ -e /usr/bin/cfagent ]; then
Line 175... Line 171...
175
rm -f /var/cfengine/*log
171
rm -f /var/cfengine/*log
176
 
172
 
177
### delete log files
173
### delete log files
178
find /var/log/ -type f -exec rm -f {} \;
174
find /var/log/ -type f -exec rm -f {} \;
179
 
175
 
180
### clean rpm database
176
### clean rpm database cache
181
rm -rf /var/lib/rpm/__db.*
177
rm -rf /var/lib/rpm/__db.*
182
 
178
 
183
### clean /var/spool/mail
179
### clean /var/spool/mail
184
rm -rf /var/spool/mail/*
180
rm -rf /var/spool/mail/*
185
touch /var/spool/mail/root
181
touch /var/spool/mail/root
186
chmod 600 /var/spool/mail/root
182
chmod 600 /var/spool/mail/root
187
 
183
 
188
### delete .cfsaved Files
-
 
189
if [ $PSI ]; then
-
 
190
    echo -n "Delete .cfsaved Files, please wait: "
-
 
191
    find / -xdev -name "*\.cfsaved" -exec rm -f {} \;
-
 
192
    echo "ok."
-
 
193
fi
-
 
194
 
-
 
195
### delete .rpmori .rpm Files in /etc
184
### delete .rpmori .rpm Files in /etc
196
find /etc -name "*\.rpmorig" -exec rm -f {} \;
185
find /etc -name "*\.rpmorig" -exec rm -f {} \;
197
find /etc -name "*\.rpmnew"  -exec rm -f {} \;
186
find /etc -name "*\.rpmnew"  -exec rm -f {} \;
198
find /etc -name "*\.rpmsave" -exec rm -f {} \;
187
find /etc -name "*\.rpmsave" -exec rm -f {} \;
199
 
188
 
Line 223... Line 212...
223
sed -i "s|^root:.*:0:0|root:x:0:0|" /etc/passwd
212
sed -i "s|^root:.*:0:0|root:x:0:0|" /etc/passwd
224
 
213
 
225
### remove /.autofsck
214
### remove /.autofsck
226
rm -f /.autofsck
215
rm -f /.autofsck
227
 
216
 
228
### disable cfagent
217
### disable cfagent 
229
[ $PSI ] && rm -f /etc/cron.d/cfengine
218
[ $PSI ] && mv /etc/cron.d/cfengine      /etc/cron_backup/ 2>/dev/null
230
 
219
 
-
 
220
### disable psi-cronjobs
-
 
221
[ $PSI ] && mv /etc/cron.d/psi-cronjobs  /etc/cron_backup/ 2>/dev/null
-
 
222
 
231
### disable check_update in rc.local.psi
223
### disable check_update
232
[ $PSI ] && sed -i "s|/etc/init.d/check_update|# /etc/init.d/check_update|" /etc/rc.d/rc.local.psi
224
[ $PSI ] && sed -i "s|/etc/init.d/check_update|# /etc/init.d/check_update|" /etc/rc.d/rc.local.psi
-
 
225
[ $PSI ] && chkconfig check_update off
233
 
226
 
234
### create in /boot link to LiveCD kernel(s)
227
### create in /boot link to LiveCD kernel(s)
235
ln -fs /boot/vmlinuz-$KERNEL /boot/vmlinuz
228
ln -fs /boot/vmlinuz-$KERNEL /boot/vmlinuz
236
[ $SMP ] && ln -fs /boot/vmlinuz-${KERNEL}smp /boot/vmlinuz${SMP}
229
[ $SMP ] && ln -fs /boot/vmlinuz-${KERNEL}smp /boot/vmlinuz${SMP}
237
 
230
 
Line 245... Line 238...
245
    rm -f $file
238
    rm -f $file
246
done
239
done
247
 
240
 
248
### remove useless cronjobs
241
### remove useless cronjobs
249
mkdir -p /etc/cron_backup
242
mkdir -p /etc/cron_backup
250
mv /etc/cron.d/sysstat /etc/cron_backup/ 2>/dev/null
243
mv /etc/cron.d/sysstat                 /etc/cron_backup/ 2>/dev/null
251
mv /etc/cron.daily/00-makewhatis.cron /etc/cron_backup/ 2>/dev/null
-
 
252
mv /etc/cron.weekly/00-makewhatis.cron /etc/cron_backup/00-makewhatis.cron.weekly 2>/dev/null
244
mv /etc/cron.weekly/00-makewhatis.cron /etc/cron_backup/00-makewhatis.cron.weekly 2>/dev/null
253
mv /etc/cron.daily/rpm /etc/cron_backup/ 2>/dev/null
245
mv /etc/cron.daily/00-makewhatis.cron  /etc/cron_backup/ 2>/dev/null
254
mv /etc/cron.daily/slocate.cron /etc/cron_backup/ 2>/dev/null
246
mv /etc/cron.daily/makewhatis.cron     /etc/cron_backup/ 2>/dev/null
255
mv /etc/cron.daily/tetex.cron /etc/cron_backup/ 2>/dev/null
247
mv /etc/cron.daily/rpm                 /etc/cron_backup/ 2>/dev/null
256
mv /etc/cron.daily/yum.cron /etc/cron_backup/ 2>/dev/null
248
mv /etc/cron.daily/slocate.cron        /etc/cron_backup/ 2>/dev/null
257
mv /etc/cron.daily/prelink /etc/cron_backup/ 2>/dev/null
249
mv /etc/cron.daily/tetex.cron          /etc/cron_backup/ 2>/dev/null
258
mv /etc/cron.daily/00-logwatch /etc/cron_backup/ 2>/dev/null
250
mv /etc/cron.daily/yum.cron            /etc/cron_backup/ 2>/dev/null
259
 
-
 
260
### remove desktop entry from crossover
-
 
261
[ $PSI ] && rm -f "/usr/share/apps/kdesktop/DesktopLinks/Internet Explorer.desktop"
251
mv /etc/cron.daily/prelink             /etc/cron_backup/ 2>/dev/null
262
 
252
 
263
### remove backup of /etc/X11/xorg.conf
253
### remove backup of /etc/X11/xorg.conf
264
rm -f /etc/X11/xorg.conf.ori 2>/dev/null
254
rm -f /etc/X11/xorg.conf.ori    2>/dev/null
265
rm -f /etc/X11/xorg.conf.backup 2>/dev/null
255
rm -f /etc/X11/xorg.conf.backup 2>/dev/null
266
 
256
 
267
### remove unused dirs in /lib/modules
257
### remove unused dirs in /lib/modules
268
ls /lib/modules/ | grep -v $KERNEL | while read mod_dir; do
258
ls /lib/modules/ | grep -v $KERNEL | while read mod_dir; do
269
    rpm -qf --quiet /lib/modules/$mod_dir
259
    rpm -qf --quiet /lib/modules/$mod_dir
Line 352... Line 342...
352
 
342
 
353
### start afs with option -memcache !
343
### start afs with option -memcache !
354
if [ -e /etc/sysconfig/afs ]; then
344
if [ -e /etc/sysconfig/afs ]; then
355
    if [ $PSI ]; then
345
    if [ $PSI ]; then
356
	sed -i "s|^EXTRA_OPTIONS=.*|EXTRA_OPTIONS='-fakestat -memcache'|" /etc/sysconfig/afs
346
	sed -i "s|^EXTRA_OPTIONS=.*|EXTRA_OPTIONS='-fakestat -memcache'|" /etc/sysconfig/afs
-
 
347
	sed -i "s|ENABLE_MEMCACHE='no'|ENABLE_MEMCACHE='yes'|" /etc/sysconfig/afs
357
    else
348
    else
358
	# for SL4
349
	# for SL4
359
	grep -q "\-fakestat \-memcache" /etc/sysconfig/afs
350
	grep -q "\-fakestat \-memcache" /etc/sysconfig/afs
360
	if [ "$?" != "0" ]; then
351
	if [ "$?" != "0" ]; then
361
	    sed -i "s|-fakestat|-fakestat -memcache|" /etc/sysconfig/afs
352
	    sed -i "s|-fakestat|-fakestat -memcache|" /etc/sysconfig/afs
Line 366... Line 357...
366
	    sed -i "s|^OPTIONS=.*|OPTIONS=\"-memcache\"|" /etc/sysconfig/afs
357
	    sed -i "s|^OPTIONS=.*|OPTIONS=\"-memcache\"|" /etc/sysconfig/afs
367
	fi
358
	fi
368
    fi
359
    fi
369
fi
360
fi
370
 
361
 
371
### source /etc/sysconfig/cfengine
362
### source /etc/sysconfig/psi
372
[ $PSI ] && . /etc/sysconfig/cfengine
363
[ $PSI ] && . /etc/sysconfig/psi
373
 
364
 
374
### Set /etc/motd
365
### Set /etc/motd
375
LiveCD="LiveCD"
366
LiveCD="LiveCD"
376
[ "$ARCH" = "x86_64" ] && LiveCD="LiveCD 64bit"
367
[ "$ARCH" = "x86_64" ] && LiveCD="LiveCD 64bit"
377
echo "Welcome to $LIVECD_OS ${LiveCD}" > /etc/motd
368
echo "Welcome to $LIVECD_OS ${LiveCD}" > /etc/motd
Line 381... Line 372...
381
 
372
 
382
### Set hostname to psi or slinux (not really necessary)
373
### Set hostname to psi or slinux (not really necessary)
383
if [ $PSI ]; then
374
if [ $PSI ]; then
384
    HOSTNAME="psi"
375
    HOSTNAME="psi"
385
    sed -i "s/hostname=.*/hostname=${HOSTNAME}.psi.ch/" /etc/ssmtp/ssmtp.conf
376
    sed -i "s/hostname=.*/hostname=${HOSTNAME}.psi.ch/" /etc/ssmtp/ssmtp.conf
386
    sed -i "s/HOSTNAME=.*/HOSTNAME=${HOSTNAME}/" /etc/sysconfig/cfengine
377
    sed -i "s/HOSTNAME=.*/HOSTNAME=${HOSTNAME}/" /etc/sysconfig/psi
387
else
378
else
388
    HOSTNAME="$DEFAULT_HOSTNAME"
379
    HOSTNAME="$DEFAULT_HOSTNAME"
389
fi
380
fi
390
 
381
 
391
# change hostname
382
### Change hostname
392
sed -i "s/HOSTNAME=.*/HOSTNAME=${HOSTNAME}/" /etc/sysconfig/network
383
sed -i "s/HOSTNAME=.*/HOSTNAME=${HOSTNAME}/" /etc/sysconfig/network
393
sed -i "s/DHCP_HOSTNAME=.*/DHCP_HOSTNAME==${HOSTNAME}/" /etc/sysconfig/networking/devices/ifcfg-eth0 2>/dev/null
384
sed -i "s/DHCP_HOSTNAME=.*/DHCP_HOSTNAME==${HOSTNAME}/" /etc/sysconfig/networking/devices/ifcfg-eth0 2>/dev/null
394
 
385
 
395
### Modify /etc/redhat-release
386
### Modify /etc/redhat-release
396
ADD=" - LiveCD"
387
ADD=" - LiveCD"
Line 398... Line 389...
398
[ $MINI ] && ADD=" - LiveMiniCD"
389
[ $MINI ] && ADD=" - LiveMiniCD"
399
if [ -e /etc/redhat-release.ori ]; then
390
if [ -e /etc/redhat-release.ori ]; then
400
    echo "$( cat /etc/redhat-release.ori )${ADD}" > /etc/redhat-release
391
    echo "$( cat /etc/redhat-release.ori )${ADD}" > /etc/redhat-release
401
fi
392
fi
402
 
393
 
403
### set default runlevel to $RUNLEVEL
394
### Set default runlevel to $RUNLEVEL
404
if [ $RUNLEVEL ]; then
395
if [ $RUNLEVEL ]; then
405
    sed -i "s/id:.:initdefault:/id:$RUNLEVEL:initdefault:/" /etc/inittab
396
    sed -i "s/id:.:initdefault:/id:$RUNLEVEL:initdefault:/" /etc/inittab
406
fi
397
fi
407
 
398
 
408
### edit /etc/sysconfig/desktop
399
### Edit /etc/sysconfig/desktop
409
if [ $DESKTOP ]; then
400
if [ $DESKTOP ]; then
410
    sed -i "/^DESKTOP=.*/d" /etc/sysconfig/desktop 2&>/dev/null
401
    sed -i "/^DESKTOP=.*/d" /etc/sysconfig/desktop 2&>/dev/null
411
    echo "DESKTOP=$DESKTOP" >> /etc/sysconfig/desktop
402
    echo "DESKTOP=$DESKTOP" >> /etc/sysconfig/desktop
412
fi
403
fi
413
if [ $DISPLAYMANAGER ]; then
404
if [ $DISPLAYMANAGER ]; then
Line 431... Line 422...
431
if [ -e /usr/share/config/knotify.eventsrc ]; then
422
if [ -e /usr/share/config/knotify.eventsrc ]; then
432
    cp -a customize/sl/knotify.eventsrc /usr/share/config/knotify.eventsrc
423
    cp -a customize/sl/knotify.eventsrc /usr/share/config/knotify.eventsrc
433
    cp -a customize/sl/kmixrc /usr/share/config/kmixrc
424
    cp -a customize/sl/kmixrc /usr/share/config/kmixrc
434
fi
425
fi
435
 
426
 
436
### KDE session manager; start at login
-
 
437
#   kmix, krandrtray
-
 
438
# if [ -e /usr/share/config/ksmserverrc ]; then
-
 
439
#    cp -a customize/sl/ksmserverrc /usr/share/config/ksmserverrc
-
 
440
# fi    
-
 
441
#
-
 
442
##  now done in runlast by coping .desktop files to .kde/Autostart
-
 
443
# 
-
 
444
 
-
 
445
### Configure SELinux
427
### Configure SELinux
446
if [ $SELINUX ]; then
428
if [ $SELINUX ]; then
447
    if [ -e /etc/selinux/config ]; then
429
    if [ -e /etc/selinux/config ]; then
448
	sed -i "s|^SELINUX=.*|SELINUX=$SELINUX|" /etc/selinux/config
430
	sed -i "s|^SELINUX=.*|SELINUX=$SELINUX|" /etc/selinux/config
449
    fi
431
    fi
Line 686... Line 668...
686
 
668
 
687
###############################################################
669
###############################################################
688
# /etc/cron.d/psi
670
# /etc/cron.d/psi
689
### PSI specific cronjobs
671
### PSI specific cronjobs
690
 
672
 
691
if [ $PSI ]; then
673
if [ $PSI ] && [ -e customize/psi/cron_psi.sl${OS_RELEASE} ]; then
692
    cp -a customize/psi/cron_psi /etc/cron.d/psi
674
    cp -a customize/psi/cron_psi.sl${OS_RELEASE} /etc/cron.d/psi 
693
    chmod +x /etc/cron.d/psi
675
    chmod +x /etc/cron.d/psi
694
fi
676
fi
695
 
677
 
696
echo "done."
678
echo "done."
697
echo "--------------------------------------------"
679
echo "--------------------------------------------"
Line 703... Line 685...
703
###############################################################
685
###############################################################
704
 
686
 
705
echo "Configure services ..."
687
echo "Configure services ..."
706
 
688
 
707
### services off
689
### services off
708
 
-
 
709
if [ $PSI ]; then
690
if [ $PSI ]; then
710
    chkconfig cfenvd off 2>/dev/null
691
    chkconfig cfenvd off  2>/dev/null
711
    chkconfig cfexecd off 2>/dev/null
692
    chkconfig cfexecd off 2>/dev/null
712
    chkconfig cfservd off 2>/dev/null
693
    chkconfig cfservd off 2>/dev/null
713
fi
694
fi
714
if [ ! "$SERVICES_OFF" = "" ]; then
695
if [ ! "$SERVICES_OFF" = "" ]; then
715
    for service in $SERVICES_OFF; do
696
    for service in $SERVICES_OFF; do
716
	chkconfig $service off 2>/dev/null
697
	chkconfig $service off 2>/dev/null
717
    done
698
    done
718
fi
699
fi
719
# we do kudzu-auto
-
 
720
chkconfig kudzu off 
-
 
721
 
700
 
-
 
701
### we do kudzu-auto
-
 
702
chkconfig kudzu off 
722
 
703
 
723
### services on
704
### services on
724
 
-
 
725
if [ $PSI ]; then
-
 
726
    chkconfig vpnclient_init on 2>/dev/null
-
 
727
fi
-
 
728
if [ ! "$SERVICES_ON" = "" ]; then
705
if [ ! "$SERVICES_ON" = "" ]; then
729
    for service in $SERVICES_ON; do
706
    for service in $SERVICES_ON; do
730
	chkconfig $service on 2>/dev/null
707
	chkconfig $service on 2>/dev/null
731
    done
708
    done
732
fi
709
fi
Line 741... Line 718...
741
 
718
 
742
echo "Empty files ..."
719
echo "Empty files ..."
743
 
720
 
744
### /etc/security/users
721
### /etc/security/users
745
if [ $PSI ]; then
722
if [ $PSI ]; then
746
    rm -f /etc/security/users
723
    rm -f /etc/security/ssh.allow
747
    touch /etc/security/users
724
    touch /etc/security/ssh.allow
748
fi
725
fi
749
 
726
 
750
### Files to empty
727
### Files to empty
751
FILES_TOUCH="/etc/sysconfig/hwconf \
728
FILES_TOUCH="/etc/sysconfig/hwconf \
752
             /etc/resolv.conf \
729
             /etc/resolv.conf \
Line 796... Line 773...
796
### clean prelink log
773
### clean prelink log
797
rm -f /var/log/prelink/prelink.log 2>/dev/null
774
rm -f /var/log/prelink/prelink.log 2>/dev/null
798
rm -f /var/log/prelink.log 2>/dev/null
775
rm -f /var/log/prelink.log 2>/dev/null
799
 
776
 
800
### run makewhatis
777
### run makewhatis
-
 
778
which makewhatis >/dev/null 2>&1
801
if [ -x /usr/bin/makewhatis ]; then
779
if [ "$?" = "0" ]; then
802
    echo "Run makewhatis..."
780
    echo "Run makewhatis..."
803
    makewhatis -u -w
781
    makewhatis -u -w
804
fi
782
fi
805
 
783
 
806
echo "done."
784
echo "done."