Subversion Repositories livecd

Rev

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

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