Subversion Repositories livecd

Rev

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

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