Subversion Repositories livecd

Rev

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

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