Subversion Repositories livecd

Rev

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

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