Subversion Repositories livecd

Rev

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

Rev 115 Rev 117
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
[ $PSI ] && 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
 
-
 
307
    mkdir -p /mini/usr/share/backgrounds/images
-
 
308
    mv -v /usr/share/backgrounds/images/*.gz /mini/usr/share/backgrounds/images/ 2>/dev/null
306
    
309
    
307
    # move zipped java source to /mini, if j2sdk is installed
310
    # move zipped java source to /mini, if j2sdk is installed
308
    java_src=$( rpm -ql j2sdk 2>/dev/null | grep src.zip )
311
    java_src=$( rpm -ql j2sdk 2>/dev/null | grep src.zip )
309
    [ -e "$java_src" ] && mv -v "$java_src" /mini/
312
    [ -e "$java_src" ] && mv -v "$java_src" /mini/
310
    
313
    
311
fi
314
fi
312
 
315
 
313
echo "done."
316
echo "done."
314
echo "--------------------------------------------"
317
echo "--------------------------------------------"
315
 
318
 
316
 
319
 
317
 
320
 
318
###############################################################
321
###############################################################
319
# Modify files
322
# Modify files
320
###############################################################
323
###############################################################
321
 
324
 
322
echo "Modify files ..."
325
echo "Modify files ..."
323
 
326
 
324
### remove AFS startup warning about cache
327
### remove AFS startup warning about cache
325
[ $PSI ] && sed  -i "/\!\!\!/d" /etc/init.d/afs
328
[ $PSI ] && sed  -i "/\!\!\!/d" /etc/init.d/afs
326
 
329
 
327
### disable umount of loop device during shutdown
330
### disable umount of loop device during shutdown
328
#   this is done really dirty at the moment:
331
#   this is done really dirty at the moment:
329
#    -> just replace "loop" with non existing device "lo_fake"
332
#    -> just replace "loop" with non existing device "lo_fake"
330
 
333
 
331
[ -e /etc/init.d/netfs ]     && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/netfs
334
[ -e /etc/init.d/netfs ]     && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/netfs
332
[ -e /etc/init.d/autofs ]    && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/autofs
335
[ -e /etc/init.d/autofs ]    && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/autofs
333
[ -e /etc/init.d/halt ]      && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/halt
336
[ -e /etc/init.d/halt ]      && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/halt
334
[ -e /etc/init.d/functions ] && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/functions
337
[ -e /etc/init.d/functions ] && sed -i "s|/loop/|/lo_fake/|g" /etc/init.d/functions
335
 
338
 
336
# do not shuttdown loopback interface
339
# do not shuttdown loopback interface
337
sed -i "s|[^#]action \$\"Shutting down loopback interface:|\t#action \$\"Shutting down loopback interface:|" /etc/init.d/network
340
sed -i "s|[^#]action \$\"Shutting down loopback interface:|\t#action \$\"Shutting down loopback interface:|" /etc/init.d/network
338
 
341
 
339
### copy new /etc/init.d/halt 
342
### copy new /etc/init.d/halt 
340
cp -a customize/sl${OS_RELEASE}/halt /etc/init.d/halt
343
cp -a customize/sl${OS_RELEASE}/halt /etc/init.d/halt
341
 
344
 
342
### in /etc/rc.d/rc.sysinit
345
### in /etc/rc.d/rc.sysinit
343
#   comment out 'initlog -c "fsck -T -a $rootdev $fsckoptions"' 
346
#   comment out 'initlog -c "fsck -T -a $rootdev $fsckoptions"' 
344
#   to disable fsck of root filesystem
347
#   to disable fsck of root filesystem
345
sed -i "s|\tfsck -T -a \$rootdev|\tsleep 0; #fsck -T -a \$rootdev|" /etc/rc.d/rc.sysinit
348
sed -i "s|\tfsck -T -a \$rootdev|\tsleep 0; #fsck -T -a \$rootdev|" /etc/rc.d/rc.sysinit
346
sed -i "s|\tinitlog -c \"fsck -T -a \$rootdev|\tsleep 0; #initlog -c \"fsck -T -a \$rootdev|" /etc/rc.d/rc.sysinit
349
sed -i "s|\tinitlog -c \"fsck -T -a \$rootdev|\tsleep 0; #initlog -c \"fsck -T -a \$rootdev|" /etc/rc.d/rc.sysinit
347
#   disable "Remounting root filesystem in read-write mode"
350
#   disable "Remounting root filesystem in read-write mode"
348
sed -i "s| action \$\"Remounting root filesystem|#action \$\"Remounting root filesystem|" /etc/rc.d/rc.sysinit
351
sed -i "s| action \$\"Remounting root filesystem|#action \$\"Remounting root filesystem|" /etc/rc.d/rc.sysinit
349
 
352
 
350
### start afs with option -memcache !
353
### start afs with option -memcache !
351
if [ -e /etc/sysconfig/afs ]; then
354
if [ -e /etc/sysconfig/afs ]; then
352
    if [ $PSI ]; then
355
    if [ $PSI ]; then
353
	sed -i "s|^EXTRA_OPTIONS=.*|EXTRA_OPTIONS='-fakestat -memcache'|" /etc/sysconfig/afs
356
	sed -i "s|^EXTRA_OPTIONS=.*|EXTRA_OPTIONS='-fakestat -memcache'|" /etc/sysconfig/afs
354
    else
357
    else
355
	# for SL4
358
	# for SL4
356
	grep -q "\-fakestat \-memcache" /etc/sysconfig/afs
359
	grep -q "\-fakestat \-memcache" /etc/sysconfig/afs
357
	if [ "$?" != "0" ]; then
360
	if [ "$?" != "0" ]; then
358
	    sed -i "s|-fakestat|-fakestat -memcache|" /etc/sysconfig/afs
361
	    sed -i "s|-fakestat|-fakestat -memcache|" /etc/sysconfig/afs
359
	fi
362
	fi
360
	# for SL5
363
	# for SL5
361
	rpm -q openafs | grep -q SL5
364
	rpm -q openafs | grep -q SL5
362
	if [ "$?" = "0" ]; then
365
	if [ "$?" = "0" ]; then
363
	    sed -i "s|^OPTIONS=.*|OPTIONS=\"-memcache\"|" /etc/sysconfig/afs
366
	    sed -i "s|^OPTIONS=.*|OPTIONS=\"-memcache\"|" /etc/sysconfig/afs
364
	fi
367
	fi
365
    fi
368
    fi
366
fi
369
fi
367
 
370
 
368
### source /etc/sysconfig/cfengine
371
### source /etc/sysconfig/cfengine
369
[ $PSI ] && . /etc/sysconfig/cfengine
372
[ $PSI ] && . /etc/sysconfig/cfengine
370
 
373
 
371
### Set /etc/motd
374
### Set /etc/motd
372
LiveCD="LiveCD"
375
LiveCD="LiveCD"
373
[ "$ARCH" = "x86_64" ] && LiveCD="LiveCD 64bit"
376
[ "$ARCH" = "x86_64" ] && LiveCD="LiveCD 64bit"
374
echo "Welcome to $LIVECD_OS ${LiveCD}" > /etc/motd
377
echo "Welcome to $LIVECD_OS ${LiveCD}" > /etc/motd
375
[ $PSI ] && echo "Welcome to PSI ${LiveCD} (${CLASS} ${SUBCLASS} SL${RELEASE})" > /etc/motd
378
[ $PSI ] && echo "Welcome to PSI ${LiveCD} (${CLASS} ${SUBCLASS} SL${RELEASE})" > /etc/motd
376
[ $DVD ]  && sed -i "s|CD|DVD|"    /etc/motd
379
[ $DVD ]  && sed -i "s|CD|DVD|"    /etc/motd
377
[ $MINI ] && sed -i "s|CD|MiniCD|" /etc/motd
380
[ $MINI ] && sed -i "s|CD|MiniCD|" /etc/motd
378
 
381
 
379
### Set hostname to psi or slinux (not really necessary)
382
### Set hostname to psi or slinux (not really necessary)
380
if [ $PSI ]; then
383
if [ $PSI ]; then
381
    HOSTNAME="psi"
384
    HOSTNAME="psi"
382
    sed -i "s/hostname=.*/hostname=${HOSTNAME}.psi.ch/" /etc/ssmtp/ssmtp.conf
385
    sed -i "s/hostname=.*/hostname=${HOSTNAME}.psi.ch/" /etc/ssmtp/ssmtp.conf
383
    sed -i "s/HOSTNAME=.*/HOSTNAME=${HOSTNAME}/" /etc/sysconfig/cfengine
386
    sed -i "s/HOSTNAME=.*/HOSTNAME=${HOSTNAME}/" /etc/sysconfig/cfengine
384
else
387
else
385
    HOSTNAME="$DEFAULT_HOSTNAME"
388
    HOSTNAME="$DEFAULT_HOSTNAME"
386
fi
389
fi
387
 
390
 
388
# change hostname
391
# change hostname
389
sed -i "s/HOSTNAME=.*/HOSTNAME=${HOSTNAME}/" /etc/sysconfig/network
392
sed -i "s/HOSTNAME=.*/HOSTNAME=${HOSTNAME}/" /etc/sysconfig/network
390
sed -i "s/DHCP_HOSTNAME=.*/DHCP_HOSTNAME==${HOSTNAME}/" /etc/sysconfig/networking/devices/ifcfg-eth0 2>/dev/null
393
sed -i "s/DHCP_HOSTNAME=.*/DHCP_HOSTNAME==${HOSTNAME}/" /etc/sysconfig/networking/devices/ifcfg-eth0 2>/dev/null
391
 
394
 
392
### Modify /etc/redhat-release
395
### Modify /etc/redhat-release
393
ADD=" - LiveCD"
396
ADD=" - LiveCD"
394
[ $DVD ]  && ADD=" - LiveDVD"
397
[ $DVD ]  && ADD=" - LiveDVD"
395
[ $MINI ] && ADD=" - LiveMiniCD"
398
[ $MINI ] && ADD=" - LiveMiniCD"
396
if [ -e /etc/redhat-release.ori ]; then
399
if [ -e /etc/redhat-release.ori ]; then
397
    echo "$( cat /etc/redhat-release.ori )${ADD}" > /etc/redhat-release
400
    echo "$( cat /etc/redhat-release.ori )${ADD}" > /etc/redhat-release
398
fi
401
fi
399
 
402
 
400
### set default runlevel to $RUNLEVEL
403
### set default runlevel to $RUNLEVEL
401
if [ $RUNLEVEL ]; then
404
if [ $RUNLEVEL ]; then
402
    sed -i "s/id:.:initdefault:/id:$RUNLEVEL:initdefault:/" /etc/inittab
405
    sed -i "s/id:.:initdefault:/id:$RUNLEVEL:initdefault:/" /etc/inittab
403
fi
406
fi
404
 
407
 
405
### edit /etc/sysconfig/desktop
408
### edit /etc/sysconfig/desktop
406
if [ $DESKTOP ]; then
409
if [ $DESKTOP ]; then
407
    sed -i "/^DESKTOP=.*/d" /etc/sysconfig/desktop 2&>/dev/null
410
    sed -i "/^DESKTOP=.*/d" /etc/sysconfig/desktop 2&>/dev/null
408
    echo "DESKTOP=$DESKTOP" >> /etc/sysconfig/desktop
411
    echo "DESKTOP=$DESKTOP" >> /etc/sysconfig/desktop
409
fi
412
fi
410
if [ $DISPLAYMANAGER ]; then
413
if [ $DISPLAYMANAGER ]; then
411
    sed -i "/^DISPLAYMANAGER=.*/d" /etc/sysconfig/desktop 2&>/dev/null
414
    sed -i "/^DISPLAYMANAGER=.*/d" /etc/sysconfig/desktop 2&>/dev/null
412
    echo "DISPLAYMANAGER=$DISPLAYMANAGER" >> /etc/sysconfig/desktop
415
    echo "DISPLAYMANAGER=$DISPLAYMANAGER" >> /etc/sysconfig/desktop
413
fi
416
fi
414
 
417
 
415
### GDM login background
418
### GDM login background
416
if [ -e /usr/share/gdm/themes/SL/background.png ]; then
419
if [ -e /usr/share/gdm/themes/SL/background.png ]; then
417
    cp -a customize/sl${OS_RELEASE}/background.png /usr/share/gdm/themes/SL/background.png
420
    cp -a customize/sl${OS_RELEASE}/background.png /usr/share/gdm/themes/SL/background.png
418
fi
421
fi
419
 
422
 
420
### KDE default background
423
### KDE default background
421
if [ ! $PSI ]; then
424
if [ ! $PSI ]; then
422
    if [ -e /usr/share/backgrounds/images/default.png ]; then
425
    if [ -e /usr/share/backgrounds/images/default.png ]; then
423
	cp -a customize/sl${OS_RELEASE}/default.png /usr/share/backgrounds/images/default.png
426
	cp -a customize/sl${OS_RELEASE}/default.png /usr/share/backgrounds/images/default.png
424
    fi
427
    fi
425
fi
428
fi
426
 
429
 
427
### KDE startup/exit sound
430
### KDE startup/exit sound
428
if [ -e /usr/share/config/knotify.eventsrc ]; then
431
if [ -e /usr/share/config/knotify.eventsrc ]; then
429
    cp -a customize/sl/knotify.eventsrc /usr/share/config/knotify.eventsrc
432
    cp -a customize/sl/knotify.eventsrc /usr/share/config/knotify.eventsrc
430
    cp -a customize/sl/kmixrc /usr/share/config/kmixrc
433
    cp -a customize/sl/kmixrc /usr/share/config/kmixrc
431
fi
434
fi
432
 
435
 
433
### KDE session manager; start at login
436
### KDE session manager; start at login
434
#   kmix, krandrtray
437
#   kmix, krandrtray
435
# if [ -e /usr/share/config/ksmserverrc ]; then
438
# if [ -e /usr/share/config/ksmserverrc ]; then
436
#    cp -a customize/sl/ksmserverrc /usr/share/config/ksmserverrc
439
#    cp -a customize/sl/ksmserverrc /usr/share/config/ksmserverrc
437
# fi    
440
# fi    
438
#
441
#
439
##  now done in runlast by coping .desktop files to .kde/Autostart
442
##  now done in runlast by coping .desktop files to .kde/Autostart
440
# 
443
# 
441
 
444
 
442
### Configure SELinux
445
### Configure SELinux
443
if [ $SELINUX ]; then
446
if [ $SELINUX ]; then
444
    if [ -e /etc/selinux/config ]; then
447
    if [ -e /etc/selinux/config ]; then
445
	sed -i "s|^SELINUX=.*|SELINUX=$SELINUX|" /etc/selinux/config
448
	sed -i "s|^SELINUX=.*|SELINUX=$SELINUX|" /etc/selinux/config
446
    fi
449
    fi
447
fi
450
fi
448
 
451
 
449
### Do not like jumping CD icon when starting autorun.desktop
452
### Do not like jumping CD icon when starting autorun.desktop
450
if [ -e /etc/skel/.kde/Autostart/Autorun.desktop ]; then
453
if [ -e /etc/skel/.kde/Autostart/Autorun.desktop ]; then
451
    grep -q "StartupNotify=false" /etc/skel/.kde/Autostart/Autorun.desktop
454
    grep -q "StartupNotify=false" /etc/skel/.kde/Autostart/Autorun.desktop
452
    if [ "$?" != "0" ]; then
455
    if [ "$?" != "0" ]; then
453
	echo "StartupNotify=false" >> /etc/skel/.kde/Autostart/Autorun.desktop
456
	echo "StartupNotify=false" >> /etc/skel/.kde/Autostart/Autorun.desktop
454
    fi
457
    fi
455
fi
458
fi
456
 
459
 
457
echo "done."
460
echo "done."
458
echo "--------------------------------------------"
461
echo "--------------------------------------------"
459
 
462
 
460
 
463
 
461
 
464
 
462
###############################################################
465
###############################################################
463
# Add-ons
466
# Add-ons
464
###############################################################
467
###############################################################
465
 
468
 
466
echo "Add-ons ..."
469
echo "Add-ons ..."
467
 
470
 
468
### System icon on desktop
471
### System icon on desktop
469
if [ -d /usr/share/apps/kdesktop/DesktopLinks ]; then
472
if [ -d /usr/share/apps/kdesktop/DesktopLinks ]; then
470
    cp -a customize/System.desktop /usr/share/apps/kdesktop/DesktopLinks/
473
    cp -a customize/System.desktop /usr/share/apps/kdesktop/DesktopLinks/
471
fi
474
fi
472
 
475
 
473
### files for PSI User, will be copied during bootup to /home/$LOCALUSER/
476
### files for PSI User, will be copied during bootup to /home/$LOCALUSER/
474
if [ $PSI ]; then
477
if [ $PSI ]; then
475
    rm -rf /usr/share/$LOCALUSER
478
    rm -rf /usr/share/$LOCALUSER
476
    cp -a customize/$LOCALUSER /usr/share/
479
    cp -a customize/$LOCALUSER /usr/share/
477
fi
480
fi
478
 
481
 
479
### psi-menu, psi-scanvirus
482
### psi-menu, psi-scanvirus
480
if [ $PSI ]; then
483
if [ $PSI ]; then
481
    cp -a customize/psi/psi-menu /usr/bin/
484
    cp -a customize/psi/psi-menu /usr/bin/
482
    cp -a customize/psi/psi-scanvirus /usr/bin/
485
    cp -a customize/psi/psi-scanvirus /usr/bin/
483
    [ -d /usr/local/uvscan ] && cp -a customize/psi/update-dat /usr/local/uvscan/
486
    [ -d /usr/local/uvscan ] && cp -a customize/psi/update-dat /usr/local/uvscan/
484
    [ -x /usr/bin/freshclam ] && cp -a customize/psi/psi-freshclam /usr/bin/
487
    [ -x /usr/bin/freshclam ] && cp -a customize/psi/psi-freshclam /usr/bin/
485
fi
488
fi
486
 
489
 
487
### script to install LiveCD on local harddisk
490
### script to install LiveCD on local harddisk
488
cp -a customize/livecd-install  /usr/bin/
491
cp -a customize/livecd-install  /usr/bin/
489
 
492
 
490
### GUI for livecd-install
493
### GUI for livecd-install
491
cp -a customize/livecd-install-gui/livecd-install-gui /usr/sbin/
494
cp -a customize/livecd-install-gui/livecd-install-gui /usr/sbin/
492
ln -fs consolehelper /usr/bin/livecd-install-gui
495
ln -fs consolehelper /usr/bin/livecd-install-gui
493
cp -a customize/livecd-install-gui/livecd-install-gui.desktop /usr/share/applications/
496
cp -a customize/livecd-install-gui/livecd-install-gui.desktop /usr/share/applications/
494
cp -a customize/livecd-install-gui/livecd-install-gui.console.apps /etc/security/console.apps/livecd-install-gui
497
cp -a customize/livecd-install-gui/livecd-install-gui.console.apps /etc/security/console.apps/livecd-install-gui
495
cp -a customize/livecd-install-gui/livecd-install-gui.pam.d /etc/pam.d/livecd-install-gui
498
cp -a customize/livecd-install-gui/livecd-install-gui.pam.d /etc/pam.d/livecd-install-gui
496
 
499
 
497
### livecd-mkinitrd (used by livecd-install)
500
### livecd-mkinitrd (used by livecd-install)
498
if [ -e customize/sl${OS_RELEASE}/livecd-mkinitrd ]; then
501
if [ -e customize/sl${OS_RELEASE}/livecd-mkinitrd ]; then
499
    cp -a customize/sl${OS_RELEASE}/livecd-mkinitrd /usr/sbin/
502
    cp -a customize/sl${OS_RELEASE}/livecd-mkinitrd /usr/sbin/
500
else
503
else
501
    cp -a /sbin/mkinitrd /usr/sbin/livecd-mkinitrd
504
    cp -a /sbin/mkinitrd /usr/sbin/livecd-mkinitrd
502
fi
505
fi
503
 
506
 
504
 
507
 
505
echo "done."
508
echo "done."
506
echo "--------------------------------------------"
509
echo "--------------------------------------------"
507
 
510
 
508
 
511
 
509
###############################################################
512
###############################################################
510
# Create missing files
513
# Create missing files
511
###############################################################
514
###############################################################
512
 
515
 
513
echo "Create missing files ..."
516
echo "Create missing files ..."
514
 
517
 
515
###############################################################
518
###############################################################
516
# /etc/hosts
519
# /etc/hosts
517
### copy host file, if not existing
520
### copy host file, if not existing
518
[ -e /etc/hosts ] || cp -a customize/hosts /etc/hosts
521
[ -e /etc/hosts ] || cp -a customize/hosts /etc/hosts
519
[ -e /etc/sysconfig/networking/profiles/default/hosts ] || cp -a customize/hosts /etc/sysconfig/networking/profiles/default/hosts
522
[ -e /etc/sysconfig/networking/profiles/default/hosts ] || cp -a customize/hosts /etc/sysconfig/networking/profiles/default/hosts
520
 
523
 
521
 
524
 
522
###############################################################
525
###############################################################
523
# /etc/shadow
526
# /etc/shadow
524
if [ ! -e /etc/shadow ]; then
527
if [ ! -e /etc/shadow ]; then
525
    sed -i "s|\*|x|" /etc/passwd
528
    sed -i "s|\*|x|" /etc/passwd
526
    sed -i "s|^root::|root:x:|" /etc/passwd
529
    sed -i "s|^root::|root:x:|" /etc/passwd
527
    cat /etc/passwd | cut -d":" -f 1 | while read u; do echo "$u:*:12345:0:99999:1:::"; done >> /etc/shadow
530
    cat /etc/passwd | cut -d":" -f 1 | while read u; do echo "$u:*:12345:0:99999:1:::"; done >> /etc/shadow
528
    chmod 600 /etc/shadow
531
    chmod 600 /etc/shadow
529
fi
532
fi
530
 
533
 
531
# /etc/gshadow
534
# /etc/gshadow
532
if [ ! -e /etc/gshadow ]; then
535
if [ ! -e /etc/gshadow ]; then
533
    cp -a /etc/group /etc/gshadow
536
    cp -a /etc/group /etc/gshadow
534
    sed -i "s|:x:|::|"       /etc/gshadow
537
    sed -i "s|:x:|::|"       /etc/gshadow
535
    sed -i "s|:[0-9]\+:|::|" /etc/gshadow
538
    sed -i "s|:[0-9]\+:|::|" /etc/gshadow
536
    chmod 600 /etc/gshadow
539
    chmod 600 /etc/gshadow
537
fi
540
fi
538
 
541
 
539
echo "done."
542
echo "done."
540
echo "--------------------------------------------"
543
echo "--------------------------------------------"
541
 
544
 
542
 
545
 
543
 
546
 
544
###############################################################
547
###############################################################
545
# Create special files
548
# Create special files
546
###############################################################
549
###############################################################
547
 
550
 
548
echo "Create special files ..."
551
echo "Create special files ..."
549
 
552
 
550
###############################################################
553
###############################################################
551
# /etc/rc.d/init.d/kudzu-auto
554
# /etc/rc.d/init.d/kudzu-auto
552
### Noninteractive HW detection and configuration
555
### Noninteractive HW detection and configuration
553
 
556
 
554
cp -a customize/kudzu-auto /etc/init.d/kudzu-auto
557
cp -a customize/kudzu-auto /etc/init.d/kudzu-auto
555
chmod +x /etc/rc.d/init.d/kudzu-auto
558
chmod +x /etc/rc.d/init.d/kudzu-auto
556
ln -sf /etc/rc.d/init.d/kudzu-auto /etc/rc.d/rc5.d/S04kudzu-auto
559
ln -sf /etc/rc.d/init.d/kudzu-auto /etc/rc.d/rc5.d/S04kudzu-auto
557
ln -sf /etc/rc.d/init.d/kudzu-auto /etc/rc.d/rc3.d/S04kudzu-auto
560
ln -sf /etc/rc.d/init.d/kudzu-auto /etc/rc.d/rc3.d/S04kudzu-auto
558
 
561
 
559
 
562
 
560
###############################################################
563
###############################################################
561
# /etc/rc.d/init.d/runveryfirst
564
# /etc/rc.d/init.d/runveryfirst
562
### Fix some things during bootup - run VERY first
565
### Fix some things during bootup - run VERY first
563
# runveryfirst will run at the begining of /etc/rc.d/rc.sysinit
566
# runveryfirst will run at the begining of /etc/rc.d/rc.sysinit
564
 
567
 
565
cp -a customize/runveryfirst /etc/init.d/runveryfirst
568
cp -a customize/runveryfirst /etc/init.d/runveryfirst
566
chmod +x /etc/rc.d/init.d/runveryfirst
569
chmod +x /etc/rc.d/init.d/runveryfirst
567
 
570
 
568
# execute runveryfirst just before "Initialize hardware"
571
# execute runveryfirst just before "Initialize hardware"
569
grep -q runveryfirst /etc/rc.d/rc.sysinit
572
grep -q runveryfirst /etc/rc.d/rc.sysinit
570
if [ "$?" != "0" ]; then
573
if [ "$?" != "0" ]; then
571
    sed -i -e "/^# Initialize hardware/a\/etc\/init.d\/runveryfirst" /etc/rc.d/rc.sysinit
574
    sed -i -e "/^# Initialize hardware/a\/etc\/init.d\/runveryfirst" /etc/rc.d/rc.sysinit
572
fi
575
fi
573
 
576
 
574
 
577
 
575
###############################################################
578
###############################################################
576
# /etc/rc.d/init.d/runfirst
579
# /etc/rc.d/init.d/runfirst
577
### Fix some things during bootup - run first
580
### Fix some things during bootup - run first
578
# runfirst will run at the end of /etc/rc.d/rc.sysinit
581
# runfirst will run at the end of /etc/rc.d/rc.sysinit
579
 
582
 
580
cp -a customize/runfirst /etc/init.d/runfirst
583
cp -a customize/runfirst /etc/init.d/runfirst
581
chmod +x /etc/rc.d/init.d/runfirst
584
chmod +x /etc/rc.d/init.d/runfirst
582
 
585
 
583
sysinit_line="/etc/rc.d/init.d/runfirst"
586
sysinit_line="/etc/rc.d/init.d/runfirst"
584
grep -q "$sysinit_line" /etc/rc.d/rc.sysinit
587
grep -q "$sysinit_line" /etc/rc.d/rc.sysinit
585
if [ "$?" != "0" ]; then
588
if [ "$?" != "0" ]; then
586
    echo "$sysinit_line" >> /etc/rc.d/rc.sysinit
589
    echo "$sysinit_line" >> /etc/rc.d/rc.sysinit
587
    echo >> /etc/rc.d/rc.sysinit
590
    echo >> /etc/rc.d/rc.sysinit
588
fi
591
fi
589
 
592
 
590
 
593
 
591
###############################################################
594
###############################################################
592
# /etc/rc.d/init.d/runlast
595
# /etc/rc.d/init.d/runlast
593
### Fix some things during bootup - run last
596
### Fix some things during bootup - run last
594
 
597
 
595
cp -a customize/runlast /etc/init.d/runlast
598
cp -a customize/runlast /etc/init.d/runlast
596
chmod +x /etc/rc.d/init.d/runlast
599
chmod +x /etc/rc.d/init.d/runlast
597
 
600
 
598
### Add /etc/rc.d/init.d/runlast to rc.local
601
### Add /etc/rc.d/init.d/runlast to rc.local
599
LINE=/etc/rc.d/init.d/runlast
602
LINE=/etc/rc.d/init.d/runlast
600
grep -q $LINE /etc/rc.d/rc.local
603
grep -q $LINE /etc/rc.d/rc.local
601
if [ "$?" != "0" ]; then
604
if [ "$?" != "0" ]; then
602
    # add line
605
    # add line
603
    echo "" >> /etc/rc.d/rc.local
606
    echo "" >> /etc/rc.d/rc.local
604
    echo $LINE >> /etc/rc.d/rc.local
607
    echo $LINE >> /etc/rc.d/rc.local
605
    echo "" >> /etc/rc.d/rc.local    
608
    echo "" >> /etc/rc.d/rc.local    
606
fi
609
fi
607
 
610
 
608
 
611
 
609
###############################################################
612
###############################################################
610
# /usr/bin/save-localdata
613
# /usr/bin/save-localdata
611
### stores data on a usbstick
614
### stores data on a usbstick
612
cp -a customize/save-localdata /usr/bin/save-localdata
615
cp -a customize/save-localdata /usr/bin/save-localdata
613
chmod +x /usr/bin/save-localdata
616
chmod +x /usr/bin/save-localdata
614
 
617
 
615
# add /usr/bin/save-localdata to /etc/sudoers
618
# add /usr/bin/save-localdata to /etc/sudoers
616
if [ -e /etc/sudoers ]; then
619
if [ -e /etc/sudoers ]; then
617
    grep -q "save-localdata" /etc/sudoers 2>/dev/null
620
    grep -q "save-localdata" /etc/sudoers 2>/dev/null
618
    if [ "$?" != "0" ]; then
621
    if [ "$?" != "0" ]; then
619
	cp -a /etc/sudoers /etc/sudoers.ori
622
	cp -a /etc/sudoers /etc/sudoers.ori
620
	echo "$LOCALUSER ALL = NOPASSWD: /usr/bin/save-localdata" >> /etc/sudoers
623
	echo "$LOCALUSER ALL = NOPASSWD: /usr/bin/save-localdata" >> /etc/sudoers
621
    fi
624
    fi
622
fi
625
fi
623
 
626
 
624
# create menu entry
627
# create menu entry
625
cp -a customize/save-localdata.desktop /usr/share/applications/
628
cp -a customize/save-localdata.desktop /usr/share/applications/
626
 
629
 
627
 
630
 
628
###############################################################
631
###############################################################
629
# /usr/bin/set-volume
632
# /usr/bin/set-volume
630
### unmute all mixers and set volumes
633
### unmute all mixers and set volumes
631
cp -a customize/set-volume /usr/bin/set-volume
634
cp -a customize/set-volume /usr/bin/set-volume
632
chmod +x /usr/bin/set-volume
635
chmod +x /usr/bin/set-volume
633
 
636
 
634
 
637
 
635
###############################################################
638
###############################################################
636
# /etc/sysconfig/networking/devices/ifcfg-eth0
639
# /etc/sysconfig/networking/devices/ifcfg-eth0
637
# /etc/sysconfig/networking/devices/ifcfg-eth1
640
# /etc/sysconfig/networking/devices/ifcfg-eth1
638
 
641
 
639
for iface in eth0 eth1; do 
642
for iface in eth0 eth1; do 
640
 
643
 
641
    # remove it first
644
    # remove it first
642
    rm -f /etc/sysconfig/networking/devices/ifcfg-${iface} 2>/dev/null
645
    rm -f /etc/sysconfig/networking/devices/ifcfg-${iface} 2>/dev/null
643
    rm -f /etc/sysconfig/networking/profiles/default/ifcfg-${iface} 2>/dev/null
646
    rm -f /etc/sysconfig/networking/profiles/default/ifcfg-${iface} 2>/dev/null
644
    rm -f /etc/sysconfig/network-scripts/ifcfg-${iface} 2>/dev/null
647
    rm -f /etc/sysconfig/network-scripts/ifcfg-${iface} 2>/dev/null
645
 
648
 
646
    # create it, if we have a sample
649
    # create it, if we have a sample
647
    if [ -e customize/sl${OS_RELEASE}/ifcfg-${iface} ]; then
650
    if [ -e customize/sl${OS_RELEASE}/ifcfg-${iface} ]; then
648
	cp -a customize/sl${OS_RELEASE}/ifcfg-${iface} /etc/sysconfig/networking/devices/ifcfg-${iface}
651
	cp -a customize/sl${OS_RELEASE}/ifcfg-${iface} /etc/sysconfig/networking/devices/ifcfg-${iface}
649
        # make hard links
652
        # make hard links
650
	cp -lf /etc/sysconfig/networking/devices/ifcfg-${iface} /etc/sysconfig/networking/profiles/default/
653
	cp -lf /etc/sysconfig/networking/devices/ifcfg-${iface} /etc/sysconfig/networking/profiles/default/
651
	cp -lf /etc/sysconfig/networking/devices/ifcfg-${iface} /etc/sysconfig/network-scripts/
654
	cp -lf /etc/sysconfig/networking/devices/ifcfg-${iface} /etc/sysconfig/network-scripts/
652
    fi
655
    fi
653
done
656
done
654
 
657
 
655
 
658
 
656
###############################################################
659
###############################################################
657
# /etc/profile.d/setsysfont.sh
660
# /etc/profile.d/setsysfont.sh
658
### setsysfont 
661
### setsysfont 
659
cat > /etc/profile.d/setsysfont.sh <<EOF
662
cat > /etc/profile.d/setsysfont.sh <<EOF
660
# setsysfont once
663
# setsysfont once
661
if [ ! -e /tmp/.sysfont_has_been_set ]; then
664
if [ ! -e /tmp/.sysfont_has_been_set ]; then
662
    touch /tmp/.sysfont_has_been_set
665
    touch /tmp/.sysfont_has_been_set
663
    /bin/setfont 2>/dev/null
666
    /bin/setfont 2>/dev/null
664
    /sbin/setsysfont 2>/dev/null
667
    /sbin/setsysfont 2>/dev/null
665
fi
668
fi
666
EOF
669
EOF
667
chmod 755 /etc/profile.d/setsysfont.sh
670
chmod 755 /etc/profile.d/setsysfont.sh
668
 
671
 
669
 
672
 
670
###############################################################
673
###############################################################
671
# /etc/profile.d/setsysfont.csh
674
# /etc/profile.d/setsysfont.csh
672
### setsysfont 
675
### setsysfont 
673
cat > /etc/profile.d/setsysfont.csh <<EOF
676
cat > /etc/profile.d/setsysfont.csh <<EOF
674
# setsysfont once
677
# setsysfont once
675
if ( ! -e /tmp/.sysfont_has_been_set ) then
678
if ( ! -e /tmp/.sysfont_has_been_set ) then
676
    touch /tmp/.sysfont_has_been_set
679
    touch /tmp/.sysfont_has_been_set
677
    /bin/setfont 2>/dev/null
680
    /bin/setfont 2>/dev/null
678
    /sbin/setsysfont 2>/dev/null
681
    /sbin/setsysfont 2>/dev/null
679
endif
682
endif
680
EOF
683
EOF
681
chmod 755 /etc/profile.d/setsysfont.csh
684
chmod 755 /etc/profile.d/setsysfont.csh
682
 
685
 
683
 
686
 
684
###############################################################
687
###############################################################
685
# /etc/cron.d/psi
688
# /etc/cron.d/psi
686
### PSI specific cronjobs
689
### PSI specific cronjobs
687
 
690
 
688
if [ $PSI ]; then
691
if [ $PSI ]; then
689
    cp -a customize/psi/cron_psi /etc/cron.d/psi
692
    cp -a customize/psi/cron_psi /etc/cron.d/psi
690
    chmod +x /etc/cron.d/psi
693
    chmod +x /etc/cron.d/psi
691
fi
694
fi
692
 
695
 
693
echo "done."
696
echo "done."
694
echo "--------------------------------------------"
697
echo "--------------------------------------------"
695
 
698
 
696
 
699
 
697
 
700
 
698
###############################################################
701
###############################################################
699
# Configure services
702
# Configure services
700
###############################################################
703
###############################################################
701
 
704
 
702
echo "Configure services ..."
705
echo "Configure services ..."
703
 
706
 
704
### services off
707
### services off
705
 
708
 
706
if [ $PSI ]; then
709
if [ $PSI ]; then
707
    chkconfig cfenvd off 2>/dev/null
710
    chkconfig cfenvd off 2>/dev/null
708
    chkconfig cfexecd off 2>/dev/null
711
    chkconfig cfexecd off 2>/dev/null
709
    chkconfig cfservd off 2>/dev/null
712
    chkconfig cfservd off 2>/dev/null
710
fi
713
fi
711
if [ ! "$SERVICES_OFF" = "" ]; then
714
if [ ! "$SERVICES_OFF" = "" ]; then
712
    for service in $SERVICES_OFF; do
715
    for service in $SERVICES_OFF; do
713
	chkconfig $service off 2>/dev/null
716
	chkconfig $service off 2>/dev/null
714
    done
717
    done
715
fi
718
fi
716
# we do kudzu-auto
719
# we do kudzu-auto
717
chkconfig kudzu off 
720
chkconfig kudzu off 
718
 
721
 
719
 
722
 
720
### services on
723
### services on
721
 
724
 
722
if [ $PSI ]; then
725
if [ $PSI ]; then
723
    chkconfig vpnclient_init on 2>/dev/null
726
    chkconfig vpnclient_init on 2>/dev/null
724
fi
727
fi
725
if [ ! "$SERVICES_ON" = "" ]; then
728
if [ ! "$SERVICES_ON" = "" ]; then
726
    for service in $SERVICES_ON; do
729
    for service in $SERVICES_ON; do
727
	chkconfig $service on 2>/dev/null
730
	chkconfig $service on 2>/dev/null
728
    done
731
    done
729
fi
732
fi
730
 
733
 
731
echo "done."
734
echo "done."
732
echo "--------------------------------------------"
735
echo "--------------------------------------------"
733
 
736
 
734
 
737
 
735
###############################################################
738
###############################################################
736
# Empty files
739
# Empty files
737
###############################################################
740
###############################################################
738
 
741
 
739
echo "Empty files ..."
742
echo "Empty files ..."
740
 
743
 
741
### /etc/security/users
744
### /etc/security/users
742
if [ $PSI ]; then
745
if [ $PSI ]; then
743
    rm -f /etc/security/users
746
    rm -f /etc/security/users
744
    touch /etc/security/users
747
    touch /etc/security/users
745
fi
748
fi
746
 
749
 
747
### Files to empty
750
### Files to empty
748
FILES_TOUCH="/etc/sysconfig/hwconf \
751
FILES_TOUCH="/etc/sysconfig/hwconf \
749
             /etc/resolv.conf \
752
             /etc/resolv.conf \
750
             /etc/adjtime \
753
             /etc/adjtime \
751
             /etc/modprobe.conf \
754
             /etc/modprobe.conf \
752
             /etc/dhclient-eth0.conf"
755
             /etc/dhclient-eth0.conf"
753
 
756
 
754
for file in $FILES_TOUCH; do
757
for file in $FILES_TOUCH; do
755
    rm -rf $file
758
    rm -rf $file
756
    touch $file
759
    touch $file
757
done
760
done
758
 
761
 
759
echo "done."
762
echo "done."
760
echo "--------------------------------------------"
763
echo "--------------------------------------------"
761
 
764
 
762
 
765
 
763
 
766
 
764
###############################################################
767
###############################################################
765
# Update locate db, prelink, makewhatis
768
# Update locate db, prelink, makewhatis
766
###############################################################
769
###############################################################
767
 
770
 
768
### run updatedb
771
### run updatedb
769
if [ -x /usr/bin/updatedb ]; then
772
if [ -x /usr/bin/updatedb ]; then
770
    echo "Run updatedb..."
773
    echo "Run updatedb..."
771
    . /etc/updatedb.conf 2>/dev/null
774
    . /etc/updatedb.conf 2>/dev/null
772
    rpm -q mlocate >/dev/null
775
    rpm -q mlocate >/dev/null
773
    if [ "$?" = "0" ]; then
776
    if [ "$?" = "0" ]; then
774
	/usr/bin/updatedb -e "/media /sfs /tmp /boot /livecd /home /net /trunk"
777
	/usr/bin/updatedb -e "/media /sfs /tmp /boot /livecd /home /net /trunk"
775
    else
778
    else
776
	/usr/bin/updatedb -e /media,/tmp,/boot,/livecd,/home,/net,/trunk
779
	/usr/bin/updatedb -e /media,/tmp,/boot,/livecd,/home,/net,/trunk
777
    fi
780
    fi
778
    echo "done."
781
    echo "done."
779
fi
782
fi
780
 
783
 
781
### run prelink
784
### run prelink
782
if [ -x /etc/cron.daily/prelink ]; then
785
if [ -x /etc/cron.daily/prelink ]; then
783
    echo "Run prelink..."
786
    echo "Run prelink..."
784
    /etc/cron.daily/prelink
787
    /etc/cron.daily/prelink
785
    echo "done."
788
    echo "done."
786
fi
789
fi
787
if [ -x /etc/cron_backup/prelink ]; then
790
if [ -x /etc/cron_backup/prelink ]; then
788
    echo "Run prelink..."
791
    echo "Run prelink..."
789
    /etc/cron_backup/prelink
792
    /etc/cron_backup/prelink
790
    echo "done."
793
    echo "done."
791
fi
794
fi
792
 
795
 
793
### clean prelink log
796
### clean prelink log
794
rm -f /var/log/prelink/prelink.log 2>/dev/null
797
rm -f /var/log/prelink/prelink.log 2>/dev/null
795
rm -f /var/log/prelink.log 2>/dev/null
798
rm -f /var/log/prelink.log 2>/dev/null
796
 
799
 
797
### run makewhatis
800
### run makewhatis
798
if [ -x /usr/bin/makewhatis ]; then
801
if [ -x /usr/bin/makewhatis ]; then
799
    echo "Run makewhatis..."
802
    echo "Run makewhatis..."
800
    makewhatis -u -w
803
    makewhatis -u -w
801
fi
804
fi
802
 
805
 
803
echo "done."
806
echo "done."
804
echo "--------------------------------------------"
807
echo "--------------------------------------------"
805
 
808
 
806
###############################################################
809
###############################################################