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 140... Line 140...
140
 
140
 
141
# Services which are off (not running) on the LiveCD
141
# Services which are off (not running) on the LiveCD
142
SERVICES_OFF="mdmonitor setroubleshoot auditd crond atd readahead_early \
142
SERVICES_OFF="mdmonitor setroubleshoot auditd crond atd readahead_early \
143
              readahead_later kdump microcode_ctl openct pcscd postfix"
143
              readahead_later kdump microcode_ctl openct pcscd postfix"
144
 
144
 
-
 
145
# Services which should be on, but are not on per default
-
 
146
SERVICES_ON=""
-
 
147
 
145
EOF_livesysconf
148
EOF_livesysconf
146
 
149
 
147
 
150
 
148
cat > /etc/init.d/livesys.functions << 'EOF_livesysfunctions'
151
cat > /etc/init.d/livesys.functions << 'EOF_livesysfunctions'
149
###--------------------------------------------------------------------
152
###--------------------------------------------------------------------
Line 200... Line 203...
200
 
203
 
201
. /etc/init.d/functions
204
. /etc/init.d/functions
202
. /etc/livesys.conf
205
. /etc/livesys.conf
203
. /etc/init.d/livesys.functions
206
. /etc/init.d/livesys.functions
204
 
207
 
-
 
208
# exit if not running from LiveCD
205
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ]; then
209
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ]; then
206
    exit 0
210
    exit 0
207
fi
211
fi
208
 
212
 
209
if [ -e /.liveimg-configured ] ; then
213
[ -e /.liveimg-configured ] && configdone=1
210
    configdone=1
-
 
211
fi
-
 
212
 
214
 
213
touch /.liveimg-configured
215
touch /.liveimg-configured
214
 
216
 
215
# read boot parameters out of /proc/cmdline
217
# read boot parameters out of /proc/cmdline
-
 
218
 
-
 
219
# hostname
216
hostname=\\\$( cmdline_value hostname )
220
hostname=\\\$( cmdline_value hostname )
-
 
221
 
-
 
222
# afs cell
217
CELL=\\\$( cmdline_value cell )
223
CELL=\\\$( cmdline_value cell )
-
 
224
 
-
 
225
# services to turn on / off
218
SERVICEON=\\\$( cmdline_value serviceon )
226
SERVICEON=\\\$( cmdline_value serviceon )
219
SERVICEOFF=\\\$( cmdline_value serviceoff )
227
SERVICEOFF=\\\$( cmdline_value serviceoff )
220
 
228
 
-
 
229
# cups server
-
 
230
CUPS=\\\$( cmdline_value cups )
-
 
231
 
221
# set livecd user
232
# set livecd user
222
LIVECD_USER=\\\$( cmdline_value user )
233
LIVECD_USER=\\\$( cmdline_value user )
223
[ ! "\\\$LIVECD_USER" ] && LIVECD_USER=\\\$LIVECD_DEF_USER
234
[ ! "\\\$LIVECD_USER" ] && LIVECD_USER=\\\$LIVECD_DEF_USER
224
 
235
 
225
# mount live image
236
# mount live image
Line 308... Line 319...
308
mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum
319
mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum
309
mount -t tmpfs tmp /tmp
320
mount -t tmpfs tmp /tmp
310
mount -t tmpfs vartmp /var/tmp
321
mount -t tmpfs vartmp /var/tmp
311
[ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /tmp /var/tmp >/dev/null 2>&1
322
[ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /tmp /var/tmp >/dev/null 2>&1
312
 
323
 
-
 
324
# set afs cell if given by boot parameter
-
 
325
if [ "\\\$CELL" ]; then
-
 
326
    [ -e /usr/vice/etc/ThisCell ] && echo \\\$CELL > /usr/vice/etc/ThisCell
-
 
327
fi
-
 
328
 
-
 
329
# set cups server
-
 
330
if [ "\\\$CUPS" ]; then
-
 
331
    if [ -e /etc/cups/client.conf ]; then
-
 
332
        sed -i "s|.*ServerName .*|ServerName  \\\$CUPS|" /etc/cups/client.conf
-
 
333
        grep -q ServerName /etc/cups/client.conf || echo "ServerName  \\\$CUPS" >> /etc/cups/client.conf 
-
 
334
    fi
-
 
335
fi
-
 
336
 
-
 
337
# set the LiveCD hostname
-
 
338
[ ! "\\\$hostname" ] && hostname="livecd.localdomain"
-
 
339
sed -i -e "s|HOSTNAME=.*|HOSTNAME=\\\$hostname|g" /etc/sysconfig/network
-
 
340
/bin/hostname \\\$hostname
-
 
341
 
-
 
342
 
-
 
343
###########################################################
-
 
344
# EXIT here if LiveCD has already been configured         #
-
 
345
# happens if you start the LiveCD with persistent changes #
-
 
346
###########################################################
-
 
347
[ "\\\$configdone" ] && exit 0
-
 
348
 
313
# turn off services, which are not useful on LiveCD, to preserve resources
349
# turn off services, which are not useful on LiveCD, to preserve resources
314
if [ "\\\$SERVICES_OFF" ]; then
350
if [ "\\\$SERVICES_OFF" ]; then
315
    for service in \\\$SERVICES_OFF ; do
351
    for service in \\\$SERVICES_OFF ; do
316
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
352
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
317
    done
353
    done
318
fi
354
fi
319
 
355
 
-
 
356
# turn on services, which are off by default
-
 
357
if [ "\\\$SERVICES_ON" ]; then
-
 
358
    for service in \\\$SERVICES_ON ; do
-
 
359
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service ofn  2>/dev/null
-
 
360
    done
-
 
361
fi
-
 
362
 
320
# services off, from command line paramter
363
# services off, from command line parameter (turn it off once again)
321
if [ "\\\$SERVICEOFF" ]; then
364
if [ "\\\$SERVICEOFF" ]; then
322
    for service in \\\$( echo "\\\$SERVICEOFF" | tr ':' ' ' ); do
365
    for service in \\\$( echo "\\\$SERVICEOFF" | tr ':' ' ' ); do
323
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
366
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
324
    done
367
    done
325
fi
368
fi
326
 
369
 
327
# services on, from command line paramter
370
# services on, from command line parameter (turn it ofn once again)
328
if [ "\\\$SERVICEON" ]; then
371
if [ "\\\$SERVICEON" ]; then
329
    for service in \\\$( echo "\\\$SERVICEON" | tr ':' ' ' ); do
372
    for service in \\\$( echo "\\\$SERVICEON" | tr ':' ' ' ); do
330
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service on  2>/dev/null
373
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service on  2>/dev/null
331
    done
374
    done
332
fi
375
fi
333
 
376
 
334
# set afs cell if given by boot parameter
-
 
335
[ "\\\$CELL" ] && echo \\\$CELL > /usr/vice/etc/ThisCell
-
 
336
 
-
 
337
# set the LiveCD hostname
-
 
338
[ ! "\\\$hostname" ] && hostname="livecd.localdomain"
-
 
339
sed -i -e "s|HOSTNAME=.*|HOSTNAME=\\\$hostname|g" /etc/sysconfig/network
-
 
340
/bin/hostname \\\$hostname
-
 
341
 
-
 
342
 
-
 
343
###################################################
-
 
344
# EXIT here if LiveCD has already been configured #
-
 
345
###################################################
-
 
346
if [ -n "\\\$configdone" ]; then
-
 
347
  exit 0
-
 
348
fi
-
 
349
 
-
 
350
## fix various bugs and issues
377
## fix various bugs and issues
351
# unmute sound card
378
# unmute sound card
352
exists alsaunmute 0 2> /dev/null
379
exists alsaunmute 0 2> /dev/null
353
 
380
 
354
# turn off firstboot for livecd boots
381
# turn off firstboot for livecd boots
Line 529... Line 556...
529
 
556
 
530
. /etc/init.d/functions
557
. /etc/init.d/functions
531
. /etc/livesys.conf
558
. /etc/livesys.conf
532
. /etc/init.d/livesys.functions
559
. /etc/init.d/livesys.functions
533
 
560
 
-
 
561
# exit if not running from LiveCD
534
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ] || [ -e /.liveimg-late-configured ] ; then
562
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ]; then
535
    exit 0
563
    exit 0
536
fi
564
fi
537
 
565
 
538
touch /.liveimg-late-configured
566
touch /.liveimg-late-configured
539
 
567