Subversion Repositories livecd

Rev

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

Rev 20 Rev 23
Line 9... Line 9...
9
#
9
#
10
# Urs Beyerle, PSI
10
# Urs Beyerle, PSI
11
#
11
#
12
###############################################################
12
###############################################################
13
 
13
 
14
# source livecd.conf
14
### source livecd.conf
15
. livecd.conf
15
. livecd.conf
16
 
16
 
17
###############################################################
17
###############################################################
18
 
18
 
19
function usage() {
19
function usage() {
Line 57... Line 57...
57
            usage; exit;;
57
            usage; exit;;
58
    esac
58
    esac
59
 
59
 
60
done
60
done
61
 
61
 
62
 
-
 
63
### arch x86_64 or i686 ?
62
### arch x86_64 or i686 ?
64
ARCH=$( /bin/arch )
63
ARCH=$( /bin/arch )
65
[ "$ARCH" != "x86_64" ] && ARCH=i686
64
[ "$ARCH" != "x86_64" ] && ARCH=i686
66
 
65
 
67
### Local username
66
### set local username for PSI
68
if [ $PSI ]; then
-
 
69
    LOCALUSER=l_psi
67
[ $PSI ] && LOCALUSER=l_psi
70
else
-
 
71
    LOCALUSER=sluser
-
 
72
fi
68
 
73
 
69
 
74
 
70
 
75
###############################################################
71
###############################################################
76
# Backup some original files
72
# Backup some original files
77
###############################################################
73
###############################################################
Line 102... Line 98...
102
###############################################################
98
###############################################################
103
 
99
 
104
echo "Configure system ..."
100
echo "Configure system ..."
105
 
101
 
106
# build nvidia kernel modules
102
# build nvidia kernel modules
107
if [ -x /usr/sbin/mknvidia ]; then
103
[ -x /usr/sbin/mknvidia ] && mknvidia
108
    mknvidia
-
 
109
fi
-
 
110
 
104
 
111
# build vpnclient kernel module
105
# build vpnclient kernel module
112
if [ -x /usr/sbin/mkvpnclient ]; then
106
[ -x /usr/sbin/mkvpnclient ] && mkvpnclient
113
    mkvpnclient
-
 
114
fi
-
 
115
 
107
 
116
# Update Virus definitions 
108
# Update Virus definitions 
117
# run freshclam
109
# run freshclam
118
if [ -x /usr/bin/freshclam ]; then
110
if [ -x /usr/bin/freshclam ]; then
119
    echo; echo "Run /usr/bin/freshclam:"
111
    echo; echo "Run /usr/bin/freshclam:"
Line 145... Line 137...
145
    mv /opt /usr/
137
    mv /opt /usr/
146
    ln -s /usr/opt /opt
138
    ln -s /usr/opt /opt
147
fi
139
fi
148
 
140
 
149
# umount PSI master
141
# umount PSI master
150
if [ $PSI ]; then
-
 
151
    umount /mnt/master 2>/dev/null
142
[ $PSI ] && umount /mnt/master 2>/dev/null
152
fi
-
 
153
    
143
    
154
# copy back /etc/yum.repos.d
144
# copy back /etc/yum.repos.d
155
if [ ! $PSI ]; then
145
if [ ! $PSI ]; then
156
    if [ -d /etc/yum.repos.d.ori ]; then
146
    if [ -d /etc/yum.repos.d.ori ]; then
157
	cp -a /etc/yum.repos.d.ori /etc/yum.repos.d
147
	cp -a /etc/yum.repos.d.ori /etc/yum.repos.d
Line 235... Line 225...
235
### remove root passwd
225
### remove root passwd
236
sed -i "s|^root:.*|root:\*:12943:0:99999:7:::|" /etc/shadow
226
sed -i "s|^root:.*|root:\*:12943:0:99999:7:::|" /etc/shadow
237
sed -i "s|^root:.*:0:0|root:x:0:0|" /etc/passwd
227
sed -i "s|^root:.*:0:0|root:x:0:0|" /etc/passwd
238
 
228
 
239
### remove /.autofsck
229
### remove /.autofsck
240
rm -rf /.autofsck
230
rm -f /.autofsck
241
 
231
 
242
### disable cfagent
232
### disable cfagent
243
rm -f /etc/cron.d/cfengine
233
rm -f /etc/cron.d/cfengine
244
 
234
 
245
### disable check_update in rc.local.psi
235
### disable check_update in rc.local.psi
246
if [ $PSI ]; then
-
 
247
    sed -i "s|/etc/init.d/check_update|# /etc/init.d/check_update|" /etc/rc.d/rc.local.psi
236
[ $PSI ] && sed -i "s|/etc/init.d/check_update|# /etc/init.d/check_update|" /etc/rc.d/rc.local.psi
248
fi
-
 
249
 
237
 
250
### create in /boot link to LiveCD kernel(s)
238
### create in /boot link to LiveCD kernel(s)
251
ln -fs /boot/vmlinuz-$KERNEL /boot/vmlinuz
239
ln -fs /boot/vmlinuz-$KERNEL /boot/vmlinuz
252
[ $SMP ] && ln -fs /boot/vmlinuz-${KERNEL}smp /boot/vmlinuz${SMP}
240
[ $SMP ] && ln -fs /boot/vmlinuz-${KERNEL}smp /boot/vmlinuz${SMP}
253
 
241
 
Line 256... Line 244...
256
              /etc/ssh/ssh_host_key.pub \
244
              /etc/ssh/ssh_host_key.pub \
257
              /etc/ssh/ssh_host_rsa_key.pub \
245
              /etc/ssh/ssh_host_rsa_key.pub \
258
              /etc/ssh/ssh_host_dsa_key \
246
              /etc/ssh/ssh_host_dsa_key \
259
              /etc/ssh/ssh_host_dsa_key.pub"
247
              /etc/ssh/ssh_host_dsa_key.pub"
260
for file in $FILES_REMOVE; do
248
for file in $FILES_REMOVE; do
261
    rm -rf $file
249
    rm -f $file
262
done
250
done
263
 
251
 
264
### remove useless cronjobs
252
### remove useless cronjobs
265
mkdir -p /etc/cron_backup
253
mkdir -p /etc/cron_backup
266
mv /etc/cron.d/sysstat /etc/cron_backup/ 2>/dev/null
254
mv /etc/cron.d/sysstat /etc/cron_backup/ 2>/dev/null
Line 272... Line 260...
272
mv /etc/cron.daily/yum.cron /etc/cron_backup/ 2>/dev/null
260
mv /etc/cron.daily/yum.cron /etc/cron_backup/ 2>/dev/null
273
mv /etc/cron.daily/prelink /etc/cron_backup/ 2>/dev/null
261
mv /etc/cron.daily/prelink /etc/cron_backup/ 2>/dev/null
274
mv /etc/cron.daily/00-logwatch /etc/cron_backup/ 2>/dev/null
262
mv /etc/cron.daily/00-logwatch /etc/cron_backup/ 2>/dev/null
275
 
263
 
276
### remove desktop entry from crossover
264
### remove desktop entry from crossover
277
if [ $PSI ]; then
-
 
278
    rm -rf "/usr/share/apps/kdesktop/DesktopLinks/Internet Explorer.desktop"
265
[ $PSI ] && rm -f "/usr/share/apps/kdesktop/DesktopLinks/Internet Explorer.desktop"
279
fi
-
 
280
 
266
 
281
### remove backup of /etc/X11/xorg.conf
267
### remove backup of /etc/X11/xorg.conf
282
rm -f /etc/X11/xorg.conf.ori 2>/dev/null
268
rm -f /etc/X11/xorg.conf.ori 2>/dev/null
283
rm -f /etc/X11/xorg.conf.backup 2>/dev/null
269
rm -f /etc/X11/xorg.conf.backup 2>/dev/null
284
 
270
 
Line 323... Line 309...
323
###############################################################
309
###############################################################
324
 
310
 
325
echo "Modify files ..."
311
echo "Modify files ..."
326
 
312
 
327
### remove AFS startup warning about cache
313
### remove AFS startup warning about cache
328
if [ $PSI ]; then
-
 
329
    sed  -i "/\!\!\!/d" /etc/init.d/afs
314
[ $PSI ] && sed  -i "/\!\!\!/d" /etc/init.d/afs
330
fi
-
 
331
 
315
 
332
### disable umount of loop device during shutdown
316
### disable umount of loop device during shutdown
333
#   this is done really dirty at the moment:
317
#   this is done really dirty at the moment:
334
#    -> just replace "loop" with non existing device "lo_fake"
318
#    -> just replace "loop" with non existing device "lo_fake"
335
 
319
 
Line 366... Line 350...
366
 
350
 
367
### source /etc/sysconfig/cfengine
351
### source /etc/sysconfig/cfengine
368
[ $PSI ] && . /etc/sysconfig/cfengine
352
[ $PSI ] && . /etc/sysconfig/cfengine
369
 
353
 
370
### Set /etc/motd
354
### Set /etc/motd
371
if [ "$ARCH" = "x86_64" ]; then
-
 
372
    LiveCD="LiveCD 64bit"
355
LiveCD="LiveCD"
373
else
-
 
374
    LiveCD="LiveCD"
356
[ "$ARCH" = "x86_64" ] && LiveCD="LiveCD 64bit"
375
fi
-
 
376
 
-
 
377
if [ $PSI ]; then
-
 
378
    echo "Welcome to PSI ${LiveCD} (${CLASS} ${SUBCLASS} SL${RELEASE})" > /etc/motd
357
echo "Welcome to $LIVECD_OS ${LiveCD}" > /etc/motd
379
else
-
 
380
    echo "Welcome to $LIVECD_OS ${LiveCD}" > /etc/motd
358
[ $PSI ] && echo "Welcome to PSI ${LiveCD} (${CLASS} ${SUBCLASS} SL${RELEASE})" > /etc/motd
381
fi
-
 
382
 
359
 
383
### Set hostname to psi or slinux (not really necessary)
360
### Set hostname to psi or slinux (not really necessary)
384
if [ $PSI ]; then
361
if [ $PSI ]; then
385
    HOSTNAME="psi"
362
    HOSTNAME="psi"
386
    sed -i "s/hostname=.*/hostname=${HOSTNAME}.psi.ch/" /etc/ssmtp/ssmtp.conf
363
    sed -i "s/hostname=.*/hostname=${HOSTNAME}.psi.ch/" /etc/ssmtp/ssmtp.conf
387
    sed -i "s/HOSTNAME=.*/HOSTNAME=${HOSTNAME}/" /etc/sysconfig/cfengine
364
    sed -i "s/HOSTNAME=.*/HOSTNAME=${HOSTNAME}/" /etc/sysconfig/cfengine
388
else
365
else
389
    HOSTNAME="slinux"
366
    HOSTNAME="$DEFAULT_HOSTNAME"
390
fi  
367
fi
391
 
368
 
392
# change hostname
369
# change hostname
393
sed -i "s/HOSTNAME=.*/HOSTNAME=${HOSTNAME}/" /etc/sysconfig/network
370
sed -i "s/HOSTNAME=.*/HOSTNAME=${HOSTNAME}/" /etc/sysconfig/network
394
sed -i "s/DHCP_HOSTNAME=.*/DHCP_HOSTNAME==${HOSTNAME}/" /etc/sysconfig/networking/devices/ifcfg-eth0 2>/dev/null
371
sed -i "s/DHCP_HOSTNAME=.*/DHCP_HOSTNAME==${HOSTNAME}/" /etc/sysconfig/networking/devices/ifcfg-eth0 2>/dev/null
395
 
372
 
Line 397... Line 374...
397
ADD=" - LiveCD"
374
ADD=" - LiveCD"
398
grep -q "$ADD" /etc/redhat-release
375
grep -q "$ADD" /etc/redhat-release
399
if [ "$?" != "0" ]; then
376
if [ "$?" != "0" ]; then
400
    echo "$( cat /etc/redhat-release )${ADD}" > /etc/redhat-release
377
    echo "$( cat /etc/redhat-release )${ADD}" > /etc/redhat-release
401
fi
378
fi
402
if [ $DVD ]; then
-
 
403
    sed -i "s|CD|DVD|" /etc/redhat-release
379
[ $DVD ] && sed -i "s|CD|DVD|" /etc/redhat-release
404
fi
-
 
405
 
380
 
406
### Make scratch
381
### Make scratch
407
if [ $PSI ]; then
382
if [ $PSI ]; then
408
    rm -rf /home/scratch
383
    rm -rf /home/scratch
409
    mkdir -p /home/scratch
384
    mkdir -p /home/scratch
Line 499... Line 474...
499
    cp -a customize/psi/psi-scanvirus /usr/bin/
474
    cp -a customize/psi/psi-scanvirus /usr/bin/
500
    [ -d /usr/local/uvscan ] && cp -a customize/psi/update-dat /usr/local/uvscan/
475
    [ -d /usr/local/uvscan ] && cp -a customize/psi/update-dat /usr/local/uvscan/
501
    [ -x /usr/bin/freshclam ] && cp -a customize/psi/psi-freshclam /usr/bin/
476
    [ -x /usr/bin/freshclam ] && cp -a customize/psi/psi-freshclam /usr/bin/
502
fi
477
fi
503
 
478
 
504
### scripts to install LiveCD on local harddisk
479
### script to install LiveCD on local harddisk
505
cp -a customize/livecd-install  /usr/sbin/
480
cp -a customize/livecd-install  /usr/sbin/
506
 
481
 
507
 
-
 
508
### get livecd-mkinitrd (used by livecd-install)
482
### livecd-mkinitrd (used by livecd-install)
509
if [ -e customize/sl${OS_RELEASE}/livecd-mkinitrd ]; then
483
if [ -e customize/sl${OS_RELEASE}/livecd-mkinitrd ]; then
510
    cp -a customize/sl${OS_RELEASE}/livecd-mkinitrd /usr/sbin/
484
    cp -a customize/sl${OS_RELEASE}/livecd-mkinitrd /usr/sbin/
511
else
485
else
512
    cp -a /sbin/mkinitrd /usr/sbin/livecd-mkinitrd
486
    cp -a /sbin/mkinitrd /usr/sbin/livecd-mkinitrd
513
fi
487
fi
Line 681... Line 655...
681
# Configure services
655
# Configure services
682
###############################################################
656
###############################################################
683
 
657
 
684
echo "Configure services ..."
658
echo "Configure services ..."
685
 
659
 
686
# services off
660
### services off
687
 
661
 
688
if [ $PSI ]; then
662
if [ $PSI ]; then
689
    chkconfig cfenvd off 2>/dev/null
663
    chkconfig cfenvd off 2>/dev/null
690
    chkconfig cfexecd off 2>/dev/null
664
    chkconfig cfexecd off 2>/dev/null
691
    chkconfig cfservd off 2>/dev/null
665
    chkconfig cfservd off 2>/dev/null
Line 697... Line 671...
697
fi
671
fi
698
# we do kudzu-auto
672
# we do kudzu-auto
699
chkconfig kudzu off 
673
chkconfig kudzu off 
700
 
674
 
701
 
675
 
702
# services on
676
### services on
703
 
677
 
704
if [ $PSI ]; then
678
if [ $PSI ]; then
705
    chkconfig vpnclient_init on 2>/dev/null
679
    chkconfig vpnclient_init on 2>/dev/null
706
fi
680
fi
707
if [ ! "$SERVICES_ON" = "" ]; then
681
if [ ! "$SERVICES_ON" = "" ]; then
Line 768... Line 742...
768
if [ -x /etc/cron_backup/prelink ]; then
742
if [ -x /etc/cron_backup/prelink ]; then
769
    echo "Run prelink..."
743
    echo "Run prelink..."
770
    /etc/cron_backup/prelink
744
    /etc/cron_backup/prelink
771
    echo "done."
745
    echo "done."
772
fi
746
fi
-
 
747
 
773
# clean log
748
### clean prelink log
774
rm -f /var/log/prelink/prelink.log 2>/dev/null
749
rm -f /var/log/prelink/prelink.log 2>/dev/null
775
rm -f /var/log/prelink.log 2>/dev/null
750
rm -f /var/log/prelink.log 2>/dev/null
776
 
751
 
777
### run makewhatis
752
### run makewhatis
778
if [ -x /usr/bin/makewhatis ]; then
753
if [ -x /usr/bin/makewhatis ]; then