Subversion Repositories livecd

Rev

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

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