Subversion Repositories livecd

Rev

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

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