Subversion Repositories livecd

Rev

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

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