Subversion Repositories livecd

Rev

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

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