Subversion Repositories livecd

Rev

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

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