Subversion Repositories livecd

Rev

Rev 274 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 274 Rev 275
Line 107... Line 107...
107
 
107
 
108
# Services which are off (not running) on the LiveCD
108
# Services which are off (not running) on the LiveCD
109
SERVICES_OFF="mdmonitor setroubleshoot auditd crond atd readahead_early \
109
SERVICES_OFF="mdmonitor setroubleshoot auditd crond atd readahead_early \
110
              readahead_later kdump microcode_ctl openct pcscd postfix"
110
              readahead_later kdump microcode_ctl openct pcscd postfix"
111
 
111
 
-
 
112
# Services which should be on, but are not on per default
-
 
113
SERVICES_ON=""
-
 
114
 
112
EOF_livesysconf
115
EOF_livesysconf
113
 
116
 
114
 
117
 
115
cat > /etc/init.d/livesys.functions << 'EOF_livesysfunctions'
118
cat > /etc/init.d/livesys.functions << 'EOF_livesysfunctions'
116
###--------------------------------------------------------------------
119
###--------------------------------------------------------------------
Line 167... Line 170...
167
 
170
 
168
. /etc/init.d/functions
171
. /etc/init.d/functions
169
. /etc/livesys.conf
172
. /etc/livesys.conf
170
. /etc/init.d/livesys.functions
173
. /etc/init.d/livesys.functions
171
 
174
 
-
 
175
# exit if not running from LiveCD
172
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ]; then
176
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ]; then
173
    exit 0
177
    exit 0
174
fi
178
fi
175
 
179
 
176
if [ -e /.liveimg-configured ] ; then
180
[ -e /.liveimg-configured ] && configdone=1
177
    configdone=1
-
 
178
fi
-
 
179
 
181
 
180
touch /.liveimg-configured
182
touch /.liveimg-configured
181
 
183
 
182
# read boot parameters out of /proc/cmdline
184
# read boot parameters out of /proc/cmdline
-
 
185
 
-
 
186
# hostname
183
hostname=\\\$( cmdline_value hostname )
187
hostname=\\\$( cmdline_value hostname )
-
 
188
 
-
 
189
# afs cell
184
CELL=\\\$( cmdline_value cell )
190
CELL=\\\$( cmdline_value cell )
-
 
191
 
-
 
192
# services to turn on / off
185
SERVICEON=\\\$( cmdline_value serviceon )
193
SERVICEON=\\\$( cmdline_value serviceon )
186
SERVICEOFF=\\\$( cmdline_value serviceoff )
194
SERVICEOFF=\\\$( cmdline_value serviceoff )
187
 
195
 
-
 
196
# cups server
-
 
197
CUPS=\\\$( cmdline_value cups )
-
 
198
 
188
# set livecd user
199
# set livecd user
189
LIVECD_USER=\\\$( cmdline_value user )
200
LIVECD_USER=\\\$( cmdline_value user )
190
[ ! "\\\$LIVECD_USER" ] && LIVECD_USER=\\\$LIVECD_DEF_USER
201
[ ! "\\\$LIVECD_USER" ] && LIVECD_USER=\\\$LIVECD_DEF_USER
191
 
202
 
192
# mount live image
203
# mount live image
Line 275... Line 286...
275
mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum
286
mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum
276
mount -t tmpfs tmp /tmp
287
mount -t tmpfs tmp /tmp
277
mount -t tmpfs vartmp /var/tmp
288
mount -t tmpfs vartmp /var/tmp
278
[ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /tmp /var/tmp >/dev/null 2>&1
289
[ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /tmp /var/tmp >/dev/null 2>&1
279
 
290
 
-
 
291
# set afs cell if given by boot parameter
-
 
292
if [ "\\\$CELL" ]; then
-
 
293
    [ -e /usr/vice/etc/ThisCell ] && echo \\\$CELL > /usr/vice/etc/ThisCell
-
 
294
fi
-
 
295
 
-
 
296
# set cups server
-
 
297
if [ "\\\$CUPS" ]; then
-
 
298
    if [ -e /etc/cups/client.conf ]; then
-
 
299
        sed -i "s|.*ServerName .*|ServerName  \\\$CUPS|" /etc/cups/client.conf
-
 
300
        grep -q ServerName /etc/cups/client.conf || echo "ServerName  \\\$CUPS" >> /etc/cups/client.conf 
-
 
301
    fi
-
 
302
fi
-
 
303
 
-
 
304
# set the LiveCD hostname
-
 
305
[ ! "\\\$hostname" ] && hostname="livecd.localdomain"
-
 
306
sed -i -e "s|HOSTNAME=.*|HOSTNAME=\\\$hostname|g" /etc/sysconfig/network
-
 
307
/bin/hostname \\\$hostname
-
 
308
 
-
 
309
 
-
 
310
###########################################################
-
 
311
# EXIT here if LiveCD has already been configured         #
-
 
312
# happens if you start the LiveCD with persistent changes #
-
 
313
###########################################################
-
 
314
[ "\\\$configdone" ] && exit 0
-
 
315
 
280
# turn off services, which are not useful on LiveCD, to preserve resources
316
# turn off services, which are not useful on LiveCD, to preserve resources
281
if [ "\\\$SERVICES_OFF" ]; then
317
if [ "\\\$SERVICES_OFF" ]; then
282
    for service in \\\$SERVICES_OFF ; do
318
    for service in \\\$SERVICES_OFF ; do
283
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
319
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
284
    done
320
    done
285
fi
321
fi
286
 
322
 
-
 
323
# turn on services, which are off by default
-
 
324
if [ "\\\$SERVICES_ON" ]; then
-
 
325
    for service in \\\$SERVICES_ON ; do
-
 
326
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service ofn  2>/dev/null
-
 
327
    done
-
 
328
fi
-
 
329
 
287
# services off, from command line paramter
330
# services off, from command line parameter (turn it off once again)
288
if [ "\\\$SERVICEOFF" ]; then
331
if [ "\\\$SERVICEOFF" ]; then
289
    for service in \\\$( echo "\\\$SERVICEOFF" | tr ':' ' ' ); do
332
    for service in \\\$( echo "\\\$SERVICEOFF" | tr ':' ' ' ); do
290
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
333
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
291
    done
334
    done
292
fi
335
fi
293
 
336
 
294
# services on, from command line paramter
337
# services on, from command line parameter (turn it ofn once again)
295
if [ "\\\$SERVICEON" ]; then
338
if [ "\\\$SERVICEON" ]; then
296
    for service in \\\$( echo "\\\$SERVICEON" | tr ':' ' ' ); do
339
    for service in \\\$( echo "\\\$SERVICEON" | tr ':' ' ' ); do
297
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service on  2>/dev/null
340
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service on  2>/dev/null
298
    done
341
    done
299
fi
342
fi
300
 
343
 
301
# set afs cell if given by boot parameter
-
 
302
[ "\\\$CELL" ] && echo \\\$CELL > /usr/vice/etc/ThisCell
-
 
303
 
-
 
304
# set the LiveCD hostname
-
 
305
[ ! "\\\$hostname" ] && hostname="livecd.localdomain"
-
 
306
sed -i -e "s|HOSTNAME=.*|HOSTNAME=\\\$hostname|g" /etc/sysconfig/network
-
 
307
/bin/hostname \\\$hostname
-
 
308
 
-
 
309
 
-
 
310
###################################################
-
 
311
# EXIT here if LiveCD has already been configured #
-
 
312
###################################################
-
 
313
if [ -n "\\\$configdone" ]; then
-
 
314
  exit 0
-
 
315
fi
-
 
316
 
-
 
317
## fix various bugs and issues
344
## fix various bugs and issues
318
# unmute sound card
345
# unmute sound card
319
exists alsaunmute 0 2> /dev/null
346
exists alsaunmute 0 2> /dev/null
320
 
347
 
321
# turn off firstboot for livecd boots
348
# turn off firstboot for livecd boots
Line 496... Line 523...
496
 
523
 
497
. /etc/init.d/functions
524
. /etc/init.d/functions
498
. /etc/livesys.conf
525
. /etc/livesys.conf
499
. /etc/init.d/livesys.functions
526
. /etc/init.d/livesys.functions
500
 
527
 
-
 
528
# exit if not running from LiveCD
501
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ] || [ -e /.liveimg-late-configured ] ; then
529
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ]; then
502
    exit 0
530
    exit 0
503
fi
531
fi
504
 
532
 
505
touch /.liveimg-late-configured
533
touch /.liveimg-late-configured
506
 
534