Subversion Repositories livecd

Rev

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

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