Subversion Repositories livecd

Rev

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

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