Subversion Repositories livecd

Rev

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

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