Subversion Repositories livecd

Rev

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