Subversion Repositories livecd

Rev

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

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