Subversion Repositories livecd

Rev

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

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