Subversion Repositories livecd

Rev

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

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