Subversion Repositories livecd

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 beyerle@PS 1
#!/bin/bash
2
#
3
###############################################################
4
#
5
# LiveCD customization script
6
# 
7
# Run this script on a SL4 Installation
8
# to prepare the system for a LiveCD 
9
#
10
# Urs Beyerle, PSI
11
#
12
###############################################################
13
 
14
# source livecd.conf
15
. livecd.conf
16
 
17
###############################################################
18
 
19
function usage() {
20
 
21
   ## Usage
22
   # ----------------------------------------------------------
23
 
24
   cat <<EOF
25
 
26
   Optional Options:
27
 
28
    -h:       print this screen
29
    -psi:     customize for PSI Live CD
30
    -dvd:     customize for Live DVD
31
    -mini:    customize for Mini Live CD
32
 
33
EOF
34
 
35
}
36
 
37
###############################################################
38
 
39
###############################################################
40
# Definitions
41
###############################################################
42
 
43
### read options from command-line
44
PSI=""
45
while [ $# -gt 0 ]; do
46
 
47
    case "$1" in
48
       -h)
49
            usage; exit;;
50
       -psi)
51
            PSI=-psi; shift; continue;;
52
       -dvd)
53
            DVD=-dvd; shift; continue;;
54
       -mini)
55
            MINI=-mini; shift; continue;;
56
       *)
57
            usage; exit;;
58
    esac
59
 
60
done
61
 
62
 
63
### arch x86_64 or i686 ?
64
ARCH=$( /bin/arch )
65
[ "$ARCH" != "x86_64" ] && ARCH=i686
66
 
67
### Local username
68
if [ $PSI ]; then
69
    LOCALUSER=l_psi
70
else
71
    LOCALUSER=sluser
72
fi
73
 
74
 
75
###############################################################
76
# Configure system
77
###############################################################
78
 
79
echo "Configure system ..."
80
 
81
# build nvidia kernel modules
82
if [ -x /usr/sbin/mknvidia ]; then
83
    mknvidia
84
fi
85
 
86
# build vpnclient kernel module
87
if [ -x /usr/sbin/mkvpnclient ]; then
88
    mkvpnclient
89
fi
90
 
9 beyerle@PS 91
# backup /etc/resolv.conf 
92
cp -a /etc/resolv.conf /etc/resolv.conf.ori
93
 
1 beyerle@PS 94
# Update Virus definitions 
95
# run freshclam
96
if [ -x /usr/bin/freshclam ]; then
97
    echo; echo "Run /usr/bin/freshclam:"
98
    /etc/init.d/clamd status || /etc/init.d/clamd start && /usr/bin/freshclam
99
    /etc/init.d/clamd stop
100
    echo
101
fi
102
# update f-prot and uvscan
103
[ -x /usr/local/f-prot/tools/check-updates.pl ] && /usr/local/f-prot/tools/check-updates.pl
104
[ -x /usr/local/uvscan/update-dat ] && /usr/local/uvscan/update-dat
105
 
106
# run depmod -a for the LiveCD kernels
107
echo "Run depmod -a $KERNEL ..."; depmod -a $KERNEL
108
if [ $SMP ]; then
109
    echo "Run depmod -a ${KERNEL}smp ..."
110
    depmod -a ${KERNEL}smp
111
fi
112
 
113
# delete users (just to be sure)
114
userdel -r $LOCALUSER 2>/dev/null
115
userdel -r l_psi 2>/dev/null
116
userdel -r sluser 2>/dev/null
117
userdel -r user 2>/dev/null
118
 
119
# move /opt to /usr/opt and link /opt -> /usr/opt
120
# (if not already yet done before)
121
if [ ! -L /opt ]; then
122
    echo "Move /opt to /usr/opt"
123
    mv /opt /usr/
124
    ln -s /usr/opt /opt
125
fi
126
 
127
# umount PSI master
128
if [ $PSI ]; then
129
    umount /mnt/master 2>/dev/null
130
fi
131
 
9 beyerle@PS 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
 
1 beyerle@PS 138
# copy back /etc/yum.repos.d
139
if [ ! $PSI ]; then
140
    if [ -d /etc/yum.repos.d.ori ]; then
141
	cp -a /etc/yum.repos.d.ori /etc/yum.repos.d
142
    fi
143
fi
144
 
145
# run cfagent
146
if [ $PSI ]; then
147
    # cfagent needs running afs
148
    /etc/init.d/afs start
149
    echo "Run cfagent ..."
150
    cfagent
151
fi
152
 
153
echo "done."
154
echo "--------------------------------------------"
155
 
156
 
157
 
158
###############################################################
159
# Clean up and delete files
160
###############################################################
161
 
162
echo "Cleaning up ..."
163
 
164
### set LANG
165
export LANG=C
166
 
167
### stop AFS
168
/etc/init.d/afs stop 2>/dev/null
169
 
170
### clean up yum
171
yum clean all >/dev/null
172
rm -rf /var/cache/yum/*
173
 
174
### remove cfengine log files
175
rm -f /var/cfengine/*log
176
 
9 beyerle@PS 177
### clean log and rpm database
178
rm -rf /var/log/*
1 beyerle@PS 179
rm -rf /var/lib/rpm/__db.*
180
 
181
### clean /var/spool/mail
182
rm -rf /var/spool/mail/*
183
touch /var/spool/mail/root
184
chmod 600 /var/spool/mail/root
185
 
9 beyerle@PS 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
 
1 beyerle@PS 211
### delete .cfsaved Files
212
if [ $PSI ]; then
213
    echo -n "Delete .cfsaved Files, please wait: "
214
    find / -xdev -name "*\.cfsaved" -exec rm -f {} \;
215
    echo "ok."
216
fi
217
 
218
### delete .rpmori .rpm Files in /etc
219
find /etc -name "*\.rpmorig" -exec rm -f {} \;
9 beyerle@PS 220
find /etc -name "*\.rpmnew" -exec rm -f {} \;
1 beyerle@PS 221
 
222
### delete *~ files in /etc
223
find /etc | grep "~$" | while read f; do rm -f "$f"; done
224
 
225
### clean up /root
226
rm -f /root/.bash_history
227
rm -f /root/.ssh/known_hosts
228
 
229
### clean AFS cache
230
if [ -d /usr/vice/cache ]; then
231
    rm -rf /usr/vice/cache
232
    mkdir /usr/vice/cache
233
fi
234
if [ -d /var/cache/openafs ]; then
235
    rm -rf /var/cache/openafs
236
    mkdir /var/cache/openafs
237
fi
238
 
239
### clean up /var/tmp
240
rm -rf /var/tmp/*
241
 
242
### remove root passwd
243
sed -i "s|^root:.*|root:\*:12943:0:99999:7:::|" /etc/shadow
244
sed -i "s|^root:.*:0:0|root:x:0:0|" /etc/passwd
245
 
246
### remove /.autofsck
247
rm -rf /.autofsck
248
 
249
### disable cfagent
250
rm -f /etc/cron.d/cfengine
251
 
252
### disable check_update in rc.local.psi
253
if [ $PSI ]; then
254
    sed -i "s|/etc/init.d/check_update|# /etc/init.d/check_update|" /etc/rc.d/rc.local.psi
255
fi
256
 
257
### create in /boot link to LiveCD kernel(s)
258
ln -fs /boot/vmlinuz-$KERNEL /boot/vmlinuz
259
[ $SMP ] && ln -fs /boot/vmlinuz-${KERNEL}smp /boot/vmlinuz${SMP}
260
 
261
### Files to remove
262
FILES_REMOVE="/etc/ssh/ssh_host_key \
263
              /etc/ssh/ssh_host_key.pub \
264
              /etc/ssh/ssh_host_rsa_key.pub \
265
              /etc/ssh/ssh_host_dsa_key \
266
              /etc/ssh/ssh_host_dsa_key.pub"
267
for file in $FILES_REMOVE; do
268
    rm -rf $file
269
done
270
 
271
### remove useless cronjobs
272
mkdir -p /etc/cron_backup
273
mv /etc/cron.d/sysstat /etc/cron_backup/ 2>/dev/null
274
mv /etc/cron.daily/00-makewhatis.cron /etc/cron_backup/ 2>/dev/null
275
mv /etc/cron.weekly/00-makewhatis.cron /etc/cron_backup/00-makewhatis.cron.weekly 2>/dev/null
276
mv /etc/cron.daily/rpm /etc/cron_backup/ 2>/dev/null
277
mv /etc/cron.daily/slocate.cron /etc/cron_backup/ 2>/dev/null
278
mv /etc/cron.daily/tetex.cron /etc/cron_backup/ 2>/dev/null
279
mv /etc/cron.daily/yum.cron /etc/cron_backup/ 2>/dev/null
280
mv /etc/cron.daily/prelink /etc/cron_backup/ 2>/dev/null
281
mv /etc/cron.daily/00-logwatch /etc/cron_backup/ 2>/dev/null
282
 
283
### remove desktop entry from crossover
284
if [ $PSI ]; then
285
    rm -rf "/usr/share/apps/kdesktop/DesktopLinks/Internet Explorer.desktop"
286
fi
287
 
288
### remove backup of /etc/X11/xorg.conf
289
rm -f /etc/X11/xorg.conf.ori 2>/dev/null
290
rm -f /etc/X11/xorg.conf.backup 2>/dev/null
291
 
292
### remove unused dirs in /lib/modules
293
ls /lib/modules/ | grep -v $KERNEL | while read mod_dir; do
294
    rpm -qf --quiet /lib/modules/$mod_dir
295
    if [ $? != "0" ]; then
296
	if [ $mod_dir != "" ]; then
297
	    cleaned_dir=/tmp/cleaned-$( date +%Y%m%d%H%M )
298
	    mkdir -p $cleaned_dir
299
            echo "Move dir /lib/modules/$mod_dir to $cleaned_dir"
300
	    mv -f /lib/modules/$mod_dir $cleaned_dir/
301
        fi
302
    fi
303
done
304
 
305
### move some unneeded files to /mini (not for LiveDVD and miniCD)
306
if [ ! $DVD ] && [ ! $MINI ]; then
307
    # to save disk space
308
 
309
    mkdir -p /mini
310
 
311
    # move some dirs in /usr/share/doc to /mini
312
    mkdir -p /mini/usr/share/doc
313
    mv /usr/share/doc/openafs-* /mini/usr/share/doc 2>/dev/null
314
    mv /usr/share/doc/gcc-*     /mini/usr/share/doc 2>/dev/null
315
    mv /usr/share/doc/pine-*     /mini/usr/share/doc 2>/dev/null
316
    mv /usr/share/doc/ntp-*     /mini/usr/share/doc 2>/dev/null
317
 
318
    # move zipped java source to /mini, if j2sdk is installed
319
    java_src=$( rpm -ql j2sdk 2>/dev/null | grep src.zip )
320
    [ -e "$java_src" ] && mv "$java_src" /mini/
321
fi
322
 
323
echo "done."
324
echo "--------------------------------------------"
325
 
326
 
327
 
328
###############################################################
329
# Modify files
330
###############################################################
331
 
332
echo "Modify files ..."
333
 
334
### remove AFS startup warning about cache
335
if [ $PSI ]; then
336
    sed  -i "/\!\!\!/d" /etc/init.d/afs
337
fi
338
 
339
### disable umount of loop device during shutdown
340
#   this is done really dirty at the moment:
9 beyerle@PS 341
#    -> just replace "loop" with non existing "lo_fake"
1 beyerle@PS 342
 
9 beyerle@PS 343
[ -e /etc/init.d/netfs ]  && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/netfs
344
[ -e /etc/init.d/autofs ] && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/autofs
345
[ -e /etc/init.d/halt ]   && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/halt
1 beyerle@PS 346
 
347
# do not shuttdown loopback interface
348
sed -i "s|[^#]action \$\"Shutting down loopback interface:|\t#action \$\"Shutting down loopback interface:|" /etc/init.d/network
349
 
350
### copy new /etc/init.d/halt 
9 beyerle@PS 351
cp -a customize/halt /etc/init.d/halt
1 beyerle@PS 352
 
353
### in /etc/rc.d/rc.sysinit
354
#   comment out 'initlog -c "fsck -T -a $rootdev $fsckoptions"' 
355
#   to disable fsck of root filesystem
356
sed -i "s|\tfsck -T -a \$rootdev|\tsleep 0; #fsck -T -a \$rootdev|" /etc/rc.d/rc.sysinit
357
sed -i "s|\tinitlog -c \"fsck -T -a \$rootdev|\tsleep 0; #initlog -c \"fsck -T -a \$rootdev|" /etc/rc.d/rc.sysinit
358
#   disable "Remounting root filesystem in read-write mode"
359
sed -i "s| action \$\"Remounting root filesystem|#action \$\"Remounting root filesystem|" /etc/rc.d/rc.sysinit
360
 
361
### start afs with option -memcache !
362
if [ -e /etc/sysconfig/afs ]; then
363
    if [ $PSI ]; then
364
	sed -i "s|^EXTRA_OPTIONS=.*|EXTRA_OPTIONS='-fakestat -memcache'|" /etc/sysconfig/afs
365
    else
366
	grep -q "\-fakestat \-memcache" /etc/sysconfig/afs
367
	if [ "$?" != "0" ]; then
368
	    sed -i "s|-fakestat|-fakestat -memcache|" /etc/sysconfig/afs
369
	fi
370
    fi
371
fi
372
 
373
### source /etc/sysconfig/cfengine
374
[ $PSI ] && . /etc/sysconfig/cfengine
375
 
376
### Set /etc/motd
377
if [ "$ARCH" = "x86_64" ]; then
378
    LiveCD="LiveCD 64bit"
379
else
380
    LiveCD="LiveCD"
381
fi
382
 
383
if [ $PSI ]; then
384
    echo "Welcome to PSI ${LiveCD} (${CLASS} ${SUBCLASS} SL${RELEASE})" > /etc/motd
385
else
386
    echo "Welcome to $LIVECD_OS ${LiveCD}" > /etc/motd
387
fi
388
 
389
### Set hostname to psi or slinux (not really necessary)
390
if [ $PSI ]; then
391
    HOSTNAME="psi"
392
    sed -i "s/hostname=.*/hostname=${HOSTNAME}.psi.ch/" /etc/ssmtp/ssmtp.conf
393
    sed -i "s/HOSTNAME=.*/HOSTNAME=${HOSTNAME}/" /etc/sysconfig/cfengine
394
else
395
    HOSTNAME="slinux"
396
fi  
397
 
398
# change hostname
399
sed -i "s/HOSTNAME=.*/HOSTNAME=${HOSTNAME}/" /etc/sysconfig/network
400
sed -i "s/DHCP_HOSTNAME=.*/DHCP_HOSTNAME==${HOSTNAME}/" /etc/sysconfig/networking/devices/ifcfg-eth0 2>/dev/null
401
 
402
### Modify /etc/redhat-release
403
ADD=" - LiveCD"
404
grep -q "$ADD" /etc/redhat-release
405
if [ "$?" != "0" ]; then
406
    echo "$( cat /etc/redhat-release )${ADD}" > /etc/redhat-release
407
fi
408
if [ $DVD ]; then
409
    sed -i "s|CD|DVD|" /etc/redhat-release
410
fi
411
 
9 beyerle@PS 412
 
1 beyerle@PS 413
### Make scratch
414
if [ $PSI ]; then
415
    rm -rf /home/scratch
416
    mkdir -p /home/scratch
417
    chmod 1777 /home/scratch
418
    rm -rf /scratch
419
    ln -s /home/scratch /scratch
420
else
421
    rm -rf /home/scratch
422
    rm -rf /scratch
423
    mkdir -p /scratch
424
    chmod 1777 /scratch
425
fi
426
 
427
### set default runlevel to $RUNLEVEL
428
if [ $RUNLEVEL ]; then
429
    sed -i "s/id:.:initdefault:/id:$RUNLEVEL:initdefault:/" /etc/inittab
430
fi
431
 
432
### edit /etc/sysconfig/desktop
433
if [ $DESKTOP ]; then
434
    sed -i "/^DESKTOP=.*/d" /etc/sysconfig/desktop 2&>/dev/null
435
    echo "DESKTOP=$DESKTOP" >> /etc/sysconfig/desktop
436
fi
437
if [ $DISPLAYMANAGER ]; then
438
    sed -i "/^DISPLAYMANAGER=.*/d" /etc/sysconfig/desktop 2&>/dev/null
439
    echo "DISPLAYMANAGER=$DISPLAYMANAGER" >> /etc/sysconfig/desktop
440
fi
441
 
442
### GDM login background
443
if [ -e /usr/share/gdm/themes/SL/background.png ]; then
9 beyerle@PS 444
    cp -a customize/sl/background.png /usr/share/gdm/themes/SL/background.png
1 beyerle@PS 445
fi
446
 
447
### KDE default background
448
if [ ! $PSI ]; then
449
    if [ -e /usr/share/backgrounds/images/default.png ]; then
9 beyerle@PS 450
	cp -a customize/sl/default.png /usr/share/backgrounds/images/default.png
1 beyerle@PS 451
    fi
452
fi
453
 
454
### KDE startup/exit sound
455
if [ -e /usr/share/config/knotify.eventsrc ]; then
456
    cp -a customize/sl/knotify.eventsrc /usr/share/config/knotify.eventsrc
457
    cp -a customize/sl/kmixrc /usr/share/config/kmixrc
458
fi
459
 
460
### KDE session manager; start at login
461
#   kmix, krandrtray
462
if [ -e /usr/share/config/ksmserverrc ]; then
463
    cp -a customize/sl/ksmserverrc /usr/share/config/ksmserverrc
464
fi    
465
 
466
### Configure SELinux
467
if [ $SELINUX ]; then
468
    if [ -e /etc/selinux/config ]; then
469
	sed -i "s|^SELINUX=.*|SELINUX=$SELINUX|" /etc/selinux/config
470
    fi
471
fi
472
 
473
### Do not like jumping CD icon when starting autorun.desktop
474
if [ -e /etc/skel/.kde/Autostart/Autorun.desktop ]; then
475
    grep -q "StartupNotify=false" /etc/skel/.kde/Autostart/Autorun.desktop
476
    if [ "$?" != "0" ]; then
477
	echo "StartupNotify=false" >> /etc/skel/.kde/Autostart/Autorun.desktop
478
    fi
479
fi
480
 
481
echo "done."
482
echo "--------------------------------------------"
483
 
484
 
485
 
486
###############################################################
487
# Add-ons
488
###############################################################
489
 
490
echo "Add-ons ..."
491
 
492
### System icon on desktop
493
if [ -d /usr/share/apps/kdesktop/DesktopLinks ]; then
494
    cp -a customize/System.desktop /usr/share/apps/kdesktop/DesktopLinks/
495
fi
496
 
497
### files for PSI User, will be copied during bootup to /home/$LOCALUSER/
498
if [ $PSI ]; then
499
    rm -rf /usr/share/$LOCALUSER
500
    cp -a customize/$LOCALUSER /usr/share/
501
fi
502
 
503
### psi-menu, psi-scanvirus
504
if [ $PSI ]; then
505
    cp -a customize/psi/psi-menu /usr/bin/
506
    cp -a customize/psi/psi-scanvirus /usr/bin/
507
    [ -d /usr/local/uvscan ] && cp -a customize/psi/update-dat /usr/local/uvscan/
508
    [ -x /usr/bin/freshclam ] && cp -a customize/psi/psi-freshclam /usr/bin/
509
fi
510
 
511
echo "done."
512
echo "--------------------------------------------"
513
 
514
 
515
 
516
###############################################################
517
# Create special files
518
###############################################################
519
 
520
echo "Create special files ..."
521
 
522
###############################################################
523
# /etc/rc.d/init.d/kudzu-auto
524
### Noninteractive HW detection and configuration
9 beyerle@PS 525
cat > /etc/rc.d/init.d/kudzu-auto <<EOF
526
#!/bin/bash
527
# Noninteractive HW detection and configuration
528
. /etc/init.d/functions
529
action $"Hardware auto-detection, please wait... " /usr/sbin/kudzu -q 
530
EOF
1 beyerle@PS 531
chmod +x /etc/rc.d/init.d/kudzu-auto
532
ln -sf /etc/rc.d/init.d/kudzu-auto /etc/rc.d/rc5.d/S04kudzu-auto
533
ln -sf /etc/rc.d/init.d/kudzu-auto /etc/rc.d/rc3.d/S04kudzu-auto
534
 
535
 
536
###############################################################
537
# /etc/rc.d/init.d/runveryfirst
538
### Fix some things during bootup - run VERY first
539
# runveryfirst will run at the begining of /etc/rc.d/rc.sysinit
540
 
541
cp -a customize/runveryfirst /etc/init.d/runveryfirst
542
chmod +x /etc/rc.d/init.d/runveryfirst
543
 
544
# execute runveryfirst just before "Initialize hardware"
545
grep -q runveryfirst /etc/rc.d/rc.sysinit
546
if [ "$?" != "0" ]; then
547
    sed -i -e "/^# Initialize hardware/a\/etc\/init.d\/runveryfirst" /etc/rc.d/rc.sysinit
548
fi
549
 
550
 
551
###############################################################
552
# /etc/rc.d/init.d/runfirst
553
### Fix some things during bootup - run first
554
# runfirst will run at the end of /etc/rc.d/rc.sysinit
555
 
556
cp -a customize/runfirst /etc/init.d/runfirst
557
chmod +x /etc/rc.d/init.d/runfirst
558
 
559
sysinit_line="/etc/rc.d/init.d/runfirst"
560
grep -q "$sysinit_line" /etc/rc.d/rc.sysinit
561
if [ "$?" != "0" ]; then
562
    echo "$sysinit_line" >> /etc/rc.d/rc.sysinit
563
    echo >> /etc/rc.d/rc.sysinit
564
fi
565
 
566
###############################################################
567
# /etc/rc.d/init.d/login
568
### Provides directly login over xinit
569
 
570
cp -a customize/login /etc/init.d/login
571
chmod +x /etc/rc.d/init.d/login
572
 
573
 
574
###############################################################
575
# /etc/rc.d/init.d/runlast
576
### Fix some things during bootup - run last
577
 
578
cp -a customize/runlast /etc/init.d/runlast
579
chmod +x /etc/rc.d/init.d/runlast
580
 
581
### Add /etc/rc.d/init.d/runlast to rc.local
582
LINE=/etc/rc.d/init.d/runlast
583
grep -q $LINE /etc/rc.d/rc.local
584
if [ "$?" != "0" ]; then
585
    # add line
586
    echo "" >> /etc/rc.d/rc.local
587
    echo $LINE >> /etc/rc.d/rc.local
588
    echo "" >> /etc/rc.d/rc.local    
589
fi
590
 
591
###############################################################
592
# /usr/bin/save-localdata
593
### stores data on a usbstick
594
cp -a customize/save-localdata /usr/bin/save-localdata
595
chmod +x /usr/bin/save-localdata
596
 
597
# add /usr/bin/save-localdata to /etc/sudoers
598
grep -q "save-localdata" /etc/sudoers 2>/dev/null
599
if [ "$?" != "0" ]; then
600
    echo "$LOCALUSER ALL = NOPASSWD: /usr/bin/save-localdata" >> /etc/sudoers
601
fi
602
 
603
# create menu entry
604
cp -a customize/save-localdata.desktop /usr/share/applications/
605
 
606
###############################################################
607
# /usr/bin/set-volume
608
### unmute all mixers and set volumes
609
cp -a customize/set-volume /usr/bin/set-volume
610
chmod +x /usr/bin/set-volume
611
 
9 beyerle@PS 612
 
1 beyerle@PS 613
###############################################################
614
# /etc/sysconfig/networking/devices/ifcfg-eth0
9 beyerle@PS 615
### default eth0 config files
616
cat > /etc/sysconfig/networking/devices/ifcfg-eth0 <<EOF
617
DEVICE=eth0
618
ONBOOT=yes
619
TYPE=Ethernet
620
BOOTPROTO=dhcp
621
USERCTL=no
622
PEERDNS=yes
623
IPV6INIT=no
624
EOF
625
# make hard links
626
cp -lf /etc/sysconfig/networking/devices/ifcfg-eth0 /etc/sysconfig/networking/profiles/default/
627
cp -lf /etc/sysconfig/networking/devices/ifcfg-eth0 /etc/sysconfig/network-scripts/
628
 
629
###############################################################
1 beyerle@PS 630
# /etc/sysconfig/networking/devices/ifcfg-eth1
9 beyerle@PS 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/
1 beyerle@PS 644
 
645
###############################################################
646
# /etc/profile.d/setsysfont.sh
647
### setsysfont 
648
cat > /etc/profile.d/setsysfont.sh <<EOF
649
# setsysfont once
650
if [ ! -e /tmp/.sysfont_has_been_set ]; then
651
    touch /tmp/.sysfont_has_been_set
652
    /bin/setfont 2>/dev/null
653
    /sbin/setsysfont 2>/dev/null
654
fi
655
EOF
656
chmod 755 /etc/profile.d/setsysfont.sh
657
 
658
###############################################################
659
# /etc/profile.d/setsysfont.csh
660
### setsysfont 
661
cat > /etc/profile.d/setsysfont.csh <<EOF
662
# setsysfont once
663
if ( ! -e /tmp/.sysfont_has_been_set ) then
664
    touch /tmp/.sysfont_has_been_set
665
    /bin/setfont 2>/dev/null
666
    /sbin/setsysfont 2>/dev/null
667
endif
668
EOF
669
chmod 755 /etc/profile.d/setsysfont.csh
670
 
671
###############################################################
672
# /etc/cron.d/psi
673
### PSI specific cronjobs
674
cat > /etc/cron.d/psi <<EOF
675
MAILTO=""
676
# Update AFS users, if AFS is available
677
00 * * * * root [ -x /afs/psi.ch/sys/common/update_user.pl ] && /afs/psi.ch/sys/common/update_user.pl >/dev/null 2>&1
678
# Update SEPP links, if AFS is available
679
05 * * * * root [ -x /afs/psi.ch/sys/common/update_sepp.pl ] && /afs/psi.ch/sys/common/update_sepp.pl >/dev/null 2>&1
680
EOF
681
 
682
if [ ! $PSI ]; then
683
    rm -f /etc/cron.d/psi
684
fi
685
 
686
echo "done."
687
echo "--------------------------------------------"
688
 
689
 
690
 
691
###############################################################
692
# Configure services
693
###############################################################
694
 
695
echo "Configure services ..."
696
 
697
# services off
698
 
699
if [ $PSI ]; then
700
    chkconfig cfenvd off 2>/dev/null
701
    chkconfig cfexecd off 2>/dev/null
702
    chkconfig cfservd off 2>/dev/null
703
fi
704
if [ ! "$SERVICES_OFF" = "" ]; then
705
    for service in $SERVICES_OFF; do
706
	chkconfig $service off 2>/dev/null
707
    done
708
fi
709
# we do kudzu-auto
710
chkconfig kudzu off 
711
 
712
 
713
# services on
714
 
715
if [ $PSI ]; then
716
    chkconfig vpnclient_init on 2>/dev/null
717
fi
718
if [ ! "$SERVICES_ON" = "" ]; then
719
    for service in $SERVICES_ON; do
720
	chkconfig $service on 2>/dev/null
721
    done
722
fi
723
 
724
echo "done."
725
echo "--------------------------------------------"
726
 
727
 
728
###############################################################
729
# Empty files
730
###############################################################
731
 
732
echo "Empty files ..."
733
 
734
### /etc/security/users
735
if [ $PSI ]; then
736
    rm -f /etc/security/users
737
    touch /etc/security/users
738
fi
739
 
740
### Files to empty
741
FILES_TOUCH="/etc/sysconfig/hwconf \
742
             /etc/resolv.conf \
743
             /etc/adjtime \
744
             /etc/modprobe.conf \
745
             /etc/dhclient-eth0.conf"
746
 
747
for file in $FILES_TOUCH; do
748
    rm -rf $file
749
    touch $file
750
done
751
 
752
echo "done."
753
echo "--------------------------------------------"
754
 
755
 
756
###############################################################
9 beyerle@PS 757
# Update slocate db, prelink, makewhatis
1 beyerle@PS 758
###############################################################
759
 
9 beyerle@PS 760
# run slocate
1 beyerle@PS 761
if [ -x /usr/bin/updatedb ]; then
762
    echo "Run updatedb..."
9 beyerle@PS 763
    . /etc/updatedb.conf
764
    /usr/bin/updatedb -e /tmp,/boot,/livecd,/home,/net
1 beyerle@PS 765
    echo "done."
766
fi
767
 
9 beyerle@PS 768
# run prelink
1 beyerle@PS 769
if [ -x /etc/cron.daily/prelink ]; then
770
    echo "Run prelink..."
771
    /etc/cron.daily/prelink
772
    echo "done."
773
fi
774
if [ -x /etc/cron_backup/prelink ]; then
775
    echo "Run prelink..."
776
    /etc/cron_backup/prelink
777
    echo "done."
778
fi
779
 
9 beyerle@PS 780
# run makewhatis
1 beyerle@PS 781
if [ -x /usr/bin/makewhatis ]; then
782
    echo "Run makewhatis..."
783
    makewhatis -u -w
784
fi
785
 
786
echo "done."
787
echo "--------------------------------------------"
788
 
789
###############################################################