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