Subversion Repositories livecd

Rev

Rev 20 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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