Subversion Repositories livecd

Rev

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

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