Subversion Repositories livecd

Rev

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

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