Subversion Repositories livecd

Rev

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

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