Subversion Repositories livecd

Rev

Rev 274 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 274 Rev 275
Line 23... Line 23...
23
 
23
 
24
# Services which are off (not running) on the LiveCD
24
# Services which are off (not running) on the LiveCD
25
SERVICES_OFF="mdmonitor setroubleshoot auditd crond atd readahead_early \
25
SERVICES_OFF="mdmonitor setroubleshoot auditd crond atd readahead_early \
26
              readahead_later kdump microcode_ctl openct pcscd postfix"
26
              readahead_later kdump microcode_ctl openct pcscd postfix"
27
 
27
 
-
 
28
# Services which should be on, but are not on per default
-
 
29
SERVICES_ON=""
-
 
30
 
28
EOF_livesysconf
31
EOF_livesysconf
29
 
32
 
30
 
33
 
31
cat > /etc/init.d/livesys.functions << 'EOF_livesysfunctions'
34
cat > /etc/init.d/livesys.functions << 'EOF_livesysfunctions'
32
###--------------------------------------------------------------------
35
###--------------------------------------------------------------------
Line 83... Line 86...
83
 
86
 
84
. /etc/init.d/functions
87
. /etc/init.d/functions
85
. /etc/livesys.conf
88
. /etc/livesys.conf
86
. /etc/init.d/livesys.functions
89
. /etc/init.d/livesys.functions
87
 
90
 
-
 
91
# exit if not running from LiveCD
88
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ]; then
92
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ]; then
89
    exit 0
93
    exit 0
90
fi
94
fi
91
 
95
 
92
if [ -e /.liveimg-configured ] ; then
96
[ -e /.liveimg-configured ] && configdone=1
93
    configdone=1
-
 
94
fi
-
 
95
 
97
 
96
touch /.liveimg-configured
98
touch /.liveimg-configured
97
 
99
 
98
# read boot parameters out of /proc/cmdline
100
# read boot parameters out of /proc/cmdline
-
 
101
 
-
 
102
# hostname
99
hostname=\\\$( cmdline_value hostname )
103
hostname=\\\$( cmdline_value hostname )
-
 
104
 
-
 
105
# afs cell
100
CELL=\\\$( cmdline_value cell )
106
CELL=\\\$( cmdline_value cell )
-
 
107
 
-
 
108
# services to turn on / off
101
SERVICEON=\\\$( cmdline_value serviceon )
109
SERVICEON=\\\$( cmdline_value serviceon )
102
SERVICEOFF=\\\$( cmdline_value serviceoff )
110
SERVICEOFF=\\\$( cmdline_value serviceoff )
103
 
111
 
-
 
112
# cups server
-
 
113
CUPS=\\\$( cmdline_value cups )
-
 
114
 
104
# set livecd user
115
# set livecd user
105
LIVECD_USER=\\\$( cmdline_value user )
116
LIVECD_USER=\\\$( cmdline_value user )
106
[ ! "\\\$LIVECD_USER" ] && LIVECD_USER=\\\$LIVECD_DEF_USER
117
[ ! "\\\$LIVECD_USER" ] && LIVECD_USER=\\\$LIVECD_DEF_USER
107
 
118
 
108
# mount live image
119
# mount live image
Line 191... Line 202...
191
mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum
202
mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum
192
mount -t tmpfs tmp /tmp
203
mount -t tmpfs tmp /tmp
193
mount -t tmpfs vartmp /var/tmp
204
mount -t tmpfs vartmp /var/tmp
194
[ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /tmp /var/tmp >/dev/null 2>&1
205
[ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /tmp /var/tmp >/dev/null 2>&1
195
 
206
 
-
 
207
# set afs cell if given by boot parameter
-
 
208
if [ "\\\$CELL" ]; then
-
 
209
    [ -e /usr/vice/etc/ThisCell ] && echo \\\$CELL > /usr/vice/etc/ThisCell
-
 
210
fi
-
 
211
 
-
 
212
# set cups server
-
 
213
if [ "\\\$CUPS" ]; then
-
 
214
    if [ -e /etc/cups/client.conf ]; then
-
 
215
        sed -i "s|.*ServerName .*|ServerName  \\\$CUPS|" /etc/cups/client.conf
-
 
216
        grep -q ServerName /etc/cups/client.conf || echo "ServerName  \\\$CUPS" >> /etc/cups/client.conf 
-
 
217
    fi
-
 
218
fi
-
 
219
 
-
 
220
# set the LiveCD hostname
-
 
221
[ ! "\\\$hostname" ] && hostname="livecd.localdomain"
-
 
222
sed -i -e "s|HOSTNAME=.*|HOSTNAME=\\\$hostname|g" /etc/sysconfig/network
-
 
223
/bin/hostname \\\$hostname
-
 
224
 
-
 
225
 
-
 
226
###########################################################
-
 
227
# EXIT here if LiveCD has already been configured         #
-
 
228
# happens if you start the LiveCD with persistent changes #
-
 
229
###########################################################
-
 
230
[ "\\\$configdone" ] && exit 0
-
 
231
 
196
# turn off services, which are not useful on LiveCD, to preserve resources
232
# turn off services, which are not useful on LiveCD, to preserve resources
197
if [ "\\\$SERVICES_OFF" ]; then
233
if [ "\\\$SERVICES_OFF" ]; then
198
    for service in \\\$SERVICES_OFF ; do
234
    for service in \\\$SERVICES_OFF ; do
199
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
235
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
200
    done
236
    done
201
fi
237
fi
202
 
238
 
-
 
239
# turn on services, which are off by default
-
 
240
if [ "\\\$SERVICES_ON" ]; then
-
 
241
    for service in \\\$SERVICES_ON ; do
-
 
242
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service ofn  2>/dev/null
-
 
243
    done
-
 
244
fi
-
 
245
 
203
# services off, from command line paramter
246
# services off, from command line parameter (turn it off once again)
204
if [ "\\\$SERVICEOFF" ]; then
247
if [ "\\\$SERVICEOFF" ]; then
205
    for service in \\\$( echo "\\\$SERVICEOFF" | tr ':' ' ' ); do
248
    for service in \\\$( echo "\\\$SERVICEOFF" | tr ':' ' ' ); do
206
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
249
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
207
    done
250
    done
208
fi
251
fi
209
 
252
 
210
# services on, from command line paramter
253
# services on, from command line parameter (turn it ofn once again)
211
if [ "\\\$SERVICEON" ]; then
254
if [ "\\\$SERVICEON" ]; then
212
    for service in \\\$( echo "\\\$SERVICEON" | tr ':' ' ' ); do
255
    for service in \\\$( echo "\\\$SERVICEON" | tr ':' ' ' ); do
213
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service on  2>/dev/null
256
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service on  2>/dev/null
214
    done
257
    done
215
fi
258
fi
216
 
259
 
217
# set afs cell if given by boot parameter
-
 
218
[ "\\\$CELL" ] && echo \\\$CELL > /usr/vice/etc/ThisCell
-
 
219
 
-
 
220
# set the LiveCD hostname
-
 
221
[ ! "\\\$hostname" ] && hostname="livecd.localdomain"
-
 
222
sed -i -e "s|HOSTNAME=.*|HOSTNAME=\\\$hostname|g" /etc/sysconfig/network
-
 
223
/bin/hostname \\\$hostname
-
 
224
 
-
 
225
 
-
 
226
###################################################
-
 
227
# EXIT here if LiveCD has already been configured #
-
 
228
###################################################
-
 
229
if [ -n "\\\$configdone" ]; then
-
 
230
  exit 0
-
 
231
fi
-
 
232
 
-
 
233
## fix various bugs and issues
260
## fix various bugs and issues
234
# unmute sound card
261
# unmute sound card
235
exists alsaunmute 0 2> /dev/null
262
exists alsaunmute 0 2> /dev/null
236
 
263
 
237
# turn off firstboot for livecd boots
264
# turn off firstboot for livecd boots
Line 412... Line 439...
412
 
439
 
413
. /etc/init.d/functions
440
. /etc/init.d/functions
414
. /etc/livesys.conf
441
. /etc/livesys.conf
415
. /etc/init.d/livesys.functions
442
. /etc/init.d/livesys.functions
416
 
443
 
-
 
444
# exit if not running from LiveCD
417
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ] || [ -e /.liveimg-late-configured ] ; then
445
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ]; then
418
    exit 0
446
    exit 0
419
fi
447
fi
420
 
448
 
421
touch /.liveimg-late-configured
449
touch /.liveimg-late-configured
422
 
450