Subversion Repositories livecd

Rev

Rev 17 | Go to most recent revision | Details | Compare with Previous | 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
 
20 beyerle@PS 504
### scripts to install LiveCD on local harddisk
505
cp -a customize/livecd-install  /usr/sbin/
16 beyerle@PS 506
 
507
 
20 beyerle@PS 508
### get livecd-mkinitrd (used by livecd-install)
509
if [ -e customize/sl${OS_RELEASE}/livecd-mkinitrd ]; then
510
    cp -a customize/sl${OS_RELEASE}/livecd-mkinitrd /usr/sbin/
511
else
512
    cp -a /sbin/mkinitrd /usr/sbin/livecd-mkinitrd
513
fi
514
 
515
 
1 beyerle@PS 516
echo "done."
517
echo "--------------------------------------------"
518
 
519
 
520
 
521
###############################################################
522
# Create special files
523
###############################################################
524
 
525
echo "Create special files ..."
526
 
527
###############################################################
528
# /etc/rc.d/init.d/kudzu-auto
529
### Noninteractive HW detection and configuration
530
 
531
cp -a customize/kudzu-auto /etc/init.d/kudzu-auto
532
chmod +x /etc/rc.d/init.d/kudzu-auto
533
ln -sf /etc/rc.d/init.d/kudzu-auto /etc/rc.d/rc5.d/S04kudzu-auto
534
ln -sf /etc/rc.d/init.d/kudzu-auto /etc/rc.d/rc3.d/S04kudzu-auto
535
 
536
 
537
###############################################################
538
# /etc/rc.d/init.d/runveryfirst
539
### Fix some things during bootup - run VERY first
540
# runveryfirst will run at the begining of /etc/rc.d/rc.sysinit
541
 
542
cp -a customize/runveryfirst /etc/init.d/runveryfirst
543
chmod +x /etc/rc.d/init.d/runveryfirst
544
 
545
# execute runveryfirst just before "Initialize hardware"
546
grep -q runveryfirst /etc/rc.d/rc.sysinit
547
if [ "$?" != "0" ]; then
548
    sed -i -e "/^# Initialize hardware/a\/etc\/init.d\/runveryfirst" /etc/rc.d/rc.sysinit
549
fi
550
 
551
 
552
###############################################################
553
# /etc/rc.d/init.d/runfirst
554
### Fix some things during bootup - run first
555
# runfirst will run at the end of /etc/rc.d/rc.sysinit
556
 
557
cp -a customize/runfirst /etc/init.d/runfirst
558
chmod +x /etc/rc.d/init.d/runfirst
559
 
560
sysinit_line="/etc/rc.d/init.d/runfirst"
561
grep -q "$sysinit_line" /etc/rc.d/rc.sysinit
562
if [ "$?" != "0" ]; then
563
    echo "$sysinit_line" >> /etc/rc.d/rc.sysinit
564
    echo >> /etc/rc.d/rc.sysinit
565
fi
566
 
14 beyerle@PS 567
 
1 beyerle@PS 568
###############################################################
569
# /etc/rc.d/init.d/login
570
### Provides directly login over xinit
571
 
572
cp -a customize/login /etc/init.d/login
573
chmod +x /etc/rc.d/init.d/login
574
 
575
 
576
###############################################################
577
# /etc/rc.d/init.d/runlast
578
### Fix some things during bootup - run last
579
 
580
cp -a customize/runlast /etc/init.d/runlast
581
chmod +x /etc/rc.d/init.d/runlast
582
 
583
### Add /etc/rc.d/init.d/runlast to rc.local
584
LINE=/etc/rc.d/init.d/runlast
585
grep -q $LINE /etc/rc.d/rc.local
586
if [ "$?" != "0" ]; then
587
    # add line
588
    echo "" >> /etc/rc.d/rc.local
589
    echo $LINE >> /etc/rc.d/rc.local
590
    echo "" >> /etc/rc.d/rc.local    
591
fi
592
 
14 beyerle@PS 593
 
1 beyerle@PS 594
###############################################################
595
# /usr/bin/save-localdata
596
### stores data on a usbstick
597
cp -a customize/save-localdata /usr/bin/save-localdata
598
chmod +x /usr/bin/save-localdata
599
 
600
# add /usr/bin/save-localdata to /etc/sudoers
601
grep -q "save-localdata" /etc/sudoers 2>/dev/null
602
if [ "$?" != "0" ]; then
603
    echo "$LOCALUSER ALL = NOPASSWD: /usr/bin/save-localdata" >> /etc/sudoers
604
fi
605
 
606
# create menu entry
607
cp -a customize/save-localdata.desktop /usr/share/applications/
608
 
14 beyerle@PS 609
 
1 beyerle@PS 610
###############################################################
611
# /usr/bin/set-volume
612
### unmute all mixers and set volumes
613
cp -a customize/set-volume /usr/bin/set-volume
614
chmod +x /usr/bin/set-volume
615
 
14 beyerle@PS 616
 
1 beyerle@PS 617
###############################################################
618
# /etc/sysconfig/networking/devices/ifcfg-eth0
619
# /etc/sysconfig/networking/devices/ifcfg-eth1
620
 
621
for iface in eth0 eth1; do 
622
 
623
    # remove it first
624
    rm -f /etc/sysconfig/networking/devices/ifcfg-${iface} 2>/dev/null
625
    rm -f /etc/sysconfig/networking/profiles/default/ifcfg-${iface} 2>/dev/null
626
    rm -f /etc/sysconfig/network-scripts/ifcfg-${iface} 2>/dev/null
627
 
628
    # create it, if we have a sample
629
    if [ -e customize/sl${OS_RELEASE}/ifcfg-${iface} ]; then
630
	cp -a customize/sl${OS_RELEASE}/ifcfg-${iface} /etc/sysconfig/networking/devices/ifcfg-${iface}
631
        # make hard links
632
	cp -lf /etc/sysconfig/networking/devices/ifcfg-${iface} /etc/sysconfig/networking/profiles/default/
633
	cp -lf /etc/sysconfig/networking/devices/ifcfg-${iface} /etc/sysconfig/network-scripts/
634
    fi
635
done
636
 
637
 
638
###############################################################
639
# /etc/profile.d/setsysfont.sh
640
### setsysfont 
641
cat > /etc/profile.d/setsysfont.sh <<EOF
642
# setsysfont once
643
if [ ! -e /tmp/.sysfont_has_been_set ]; then
644
    touch /tmp/.sysfont_has_been_set
645
    /bin/setfont 2>/dev/null
646
    /sbin/setsysfont 2>/dev/null
647
fi
648
EOF
649
chmod 755 /etc/profile.d/setsysfont.sh
650
 
14 beyerle@PS 651
 
1 beyerle@PS 652
###############################################################
653
# /etc/profile.d/setsysfont.csh
654
### setsysfont 
655
cat > /etc/profile.d/setsysfont.csh <<EOF
656
# setsysfont once
657
if ( ! -e /tmp/.sysfont_has_been_set ) then
658
    touch /tmp/.sysfont_has_been_set
659
    /bin/setfont 2>/dev/null
660
    /sbin/setsysfont 2>/dev/null
661
endif
662
EOF
663
chmod 755 /etc/profile.d/setsysfont.csh
664
 
14 beyerle@PS 665
 
1 beyerle@PS 666
###############################################################
667
# /etc/cron.d/psi
668
### PSI specific cronjobs
669
 
14 beyerle@PS 670
if [ $PSI ]; then
671
    cp -a customize/psi/cron_psi /etc/cron.d/psi
672
    chmod +x /etc/cron.d/psi
1 beyerle@PS 673
fi
674
 
675
echo "done."
676
echo "--------------------------------------------"
677
 
678
 
679
 
680
###############################################################
681
# Configure services
682
###############################################################
683
 
684
echo "Configure services ..."
685
 
686
# services off
687
 
688
if [ $PSI ]; then
689
    chkconfig cfenvd off 2>/dev/null
690
    chkconfig cfexecd off 2>/dev/null
691
    chkconfig cfservd off 2>/dev/null
692
fi
693
if [ ! "$SERVICES_OFF" = "" ]; then
694
    for service in $SERVICES_OFF; do
695
	chkconfig $service off 2>/dev/null
696
    done
697
fi
698
# we do kudzu-auto
699
chkconfig kudzu off 
700
 
701
 
702
# services on
703
 
704
if [ $PSI ]; then
705
    chkconfig vpnclient_init on 2>/dev/null
706
fi
707
if [ ! "$SERVICES_ON" = "" ]; then
708
    for service in $SERVICES_ON; do
709
	chkconfig $service on 2>/dev/null
710
    done
711
fi
712
 
713
echo "done."
714
echo "--------------------------------------------"
715
 
716
 
717
###############################################################
718
# Empty files
719
###############################################################
720
 
721
echo "Empty files ..."
722
 
723
### /etc/security/users
724
if [ $PSI ]; then
725
    rm -f /etc/security/users
726
    touch /etc/security/users
727
fi
728
 
729
### Files to empty
730
FILES_TOUCH="/etc/sysconfig/hwconf \
731
             /etc/resolv.conf \
732
             /etc/adjtime \
733
             /etc/modprobe.conf \
734
             /etc/dhclient-eth0.conf"
735
 
736
for file in $FILES_TOUCH; do
737
    rm -rf $file
738
    touch $file
739
done
740
 
741
echo "done."
742
echo "--------------------------------------------"
743
 
744
 
745
###############################################################
746
# Update locate db, prelink, makewhatis
747
###############################################################
748
 
749
### run slocate
750
if [ -x /usr/bin/updatedb ]; then
751
    echo "Run updatedb..."
752
    . /etc/updatedb.conf 2>/dev/null
753
    rpm -q mlocate >/dev/null
754
    if [ "$?" = "0" ]; then
755
	/usr/bin/updatedb -e "/media /sfs /tmp /boot /livecd /home /net"
756
    else
757
	/usr/bin/updatedb -e /media,/tmp,/boot,/livecd,/home,/net
758
    fi
759
    echo "done."
760
fi
761
 
762
### run prelink
763
if [ -x /etc/cron.daily/prelink ]; then
764
    echo "Run prelink..."
765
    /etc/cron.daily/prelink
766
    echo "done."
767
fi
768
if [ -x /etc/cron_backup/prelink ]; then
769
    echo "Run prelink..."
770
    /etc/cron_backup/prelink
771
    echo "done."
772
fi
773
# clean log
774
rm -f /var/log/prelink/prelink.log 2>/dev/null
775
rm -f /var/log/prelink.log 2>/dev/null
776
 
777
### run makewhatis
778
if [ -x /usr/bin/makewhatis ]; then
779
    echo "Run makewhatis..."
780
    makewhatis -u -w
781
fi
782
 
783
echo "done."
784
echo "--------------------------------------------"
785
 
786
###############################################################