Subversion Repositories livecd

Rev

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

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