Subversion Repositories livecd

Rev

Rev 275 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
269 beyerleu 1
########################################################################
2
#
3
#  LiveCD post install 
4
#
5
########################################################################
6
 
7
%post
8
 
9
########################################################################
10
# LiveCD configuration file and LiveCD functions
11
########################################################################
12
 
13
cat > /etc/livesys.conf << 'EOF_livesysconf'
14
###--------------------------------------------------------------------
15
### Configuration file for LiveCD
16
###--------------------------------------------------------------------
17
 
273 beyerleu 18
# default LiveCD user
269 beyerleu 19
LIVECD_DEF_USER="sluser"
20
 
21
# delay in sec. before auto login
22
LOGIN_DELAY=15
23
 
273 beyerleu 24
# Services which are off (not running) on the LiveCD
25
SERVICES_OFF="mdmonitor setroubleshoot auditd crond atd readahead_early \
26
              readahead_later kdump microcode_ctl openct pcscd postfix"
27
 
275 beyerleu 28
# Services which should be on, but are not on per default
29
SERVICES_ON=""
30
 
269 beyerleu 31
EOF_livesysconf
32
 
33
 
270 beyerleu 34
cat > /etc/init.d/livesys.functions << 'EOF_livesysfunctions'
269 beyerleu 35
###--------------------------------------------------------------------
36
### livesys functions
37
###--------------------------------------------------------------------
38
 
39
# egrep_o is a replacement for "egrep -o". It prints only the last matching text
40
egrep_o() {
41
   cat | egrep "$1" | sed -r "s/.*($1).*/\\1/"
42
}
43
 
44
# boot parameter
45
cmdline_parameter() {
46
   CMDLINE=/proc/cmdline
47
   cat "$CMDLINE" | egrep_o "(^|[[:space:]]+)$1(\$|=|[[:space:]]+)" | egrep_o "$1"
48
}
49
 
50
# boot parameter value
51
cmdline_value()
52
{
53
   CMDLINE=/proc/cmdline
54
   cat "$CMDLINE" | egrep_o "(^|[[:space:]]+)$1=([^[:space:]]+)" | egrep_o "=.*" | cut -b 2- | tail -n 1
55
}
56
 
57
exists() {
58
    which $1 >/dev/null 2>&1 || return
59
    $*
60
}
61
 
62
EOF_livesysfunctions
63
 
64
 
65
 
66
########################################################################
67
# Create a sub-script so the output can be captured
68
# Must change "$" to "\$" and "`" to "\`" to avoid shell quoting
69
########################################################################
70
 
71
cat > /root/post-install << EOF_post
72
#!/bin/bash
73
 
74
 
75
echo ###################################################################
76
echo ## Creating the livesys init script - livesys
77
echo ###################################################################
78
 
79
cat > /etc/rc.d/init.d/livesys << EOF_initscript
80
#!/bin/bash
81
#
82
# live: Init script for live image
83
#
84
# chkconfig: 345 00 99
85
# description: Init script for live image.
86
 
87
. /etc/init.d/functions
88
. /etc/livesys.conf
89
. /etc/init.d/livesys.functions
90
 
275 beyerleu 91
# exit if not running from LiveCD
269 beyerleu 92
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ]; then
93
    exit 0
94
fi
95
 
275 beyerleu 96
[ -e /.liveimg-configured ] && configdone=1
269 beyerleu 97
 
98
touch /.liveimg-configured
99
 
100
# read boot parameters out of /proc/cmdline
275 beyerleu 101
 
102
# hostname
273 beyerleu 103
hostname=\\\$( cmdline_value hostname )
275 beyerleu 104
 
105
# afs cell
273 beyerleu 106
CELL=\\\$( cmdline_value cell )
275 beyerleu 107
 
108
# services to turn on / off
273 beyerleu 109
SERVICEON=\\\$( cmdline_value serviceon )
110
SERVICEOFF=\\\$( cmdline_value serviceoff )
269 beyerleu 111
 
275 beyerleu 112
# cups server
113
CUPS=\\\$( cmdline_value cups )
114
 
269 beyerleu 115
# set livecd user
116
LIVECD_USER=\\\$( cmdline_value user )
117
[ ! "\\\$LIVECD_USER" ] && LIVECD_USER=\\\$LIVECD_DEF_USER
118
 
119
# mount live image
120
if [ -b \\\`readlink -f /dev/live\\\` ]; then
121
   mkdir -p /mnt/live
122
   mount -o ro /dev/live /mnt/live 2>/dev/null || mount /dev/live /mnt/live
123
fi
124
 
125
livedir="LiveOS"
126
for arg in \\\`cat /proc/cmdline\\\` ; do
127
  if [ "\\\${arg##live_dir=}" != "\\\${arg}" ]; then
128
    livedir=\\\${arg##live_dir=}
129
    return
130
  fi
131
done
132
 
133
# enable swaps unless requested otherwise
134
swaps=\\\`blkid -t TYPE=swap -o device\\\`
135
if ! strstr "\\\`cat /proc/cmdline\\\`" noswap && [ -n "\\\$swaps" ] ; then
136
  for s in \\\$swaps ; do
137
    action "Enabling swap partition \\\$s" swapon \\\$s
138
  done
139
fi
140
if ! strstr "\\\`cat /proc/cmdline\\\`" noswap && [ -f /mnt/live/\\\${livedir}/swap.img ] ; then
141
  action "Enabling swap file" swapon /mnt/live/\\\${livedir}/swap.img
142
fi
143
 
144
mountPersistentHome() {
145
  # support label/uuid
146
  if [ "\\\${homedev##LABEL=}" != "\\\${homedev}" -o "\\\${homedev##UUID=}" != "\\\${homedev}" ]; then
147
    homedev=\\\`/sbin/blkid -o device -t "\\\$homedev"\\\`
148
  fi
149
 
150
  # if we're given a file rather than a blockdev, loopback it
151
  if [ "\\\${homedev##mtd}" != "\\\${homedev}" ]; then
152
    # mtd devs don't have a block device but get magic-mounted with -t jffs2
153
    mountopts="-t jffs2"
154
  elif [ ! -b "\\\$homedev" ]; then
155
    loopdev=\\\`losetup -f\\\`
156
    if [ "\\\${homedev##/mnt/live}" != "\\\${homedev}" ]; then
157
      action "Remounting live store r/w" mount -o remount,rw /mnt/live
158
    fi
159
    losetup \\\$loopdev \\\$homedev
160
    homedev=\\\$loopdev
161
  fi
162
 
163
  # if it's encrypted, we need to unlock it
164
  if [ "\\\$(/sbin/blkid -s TYPE -o value \\\$homedev 2>/dev/null)" = "crypto_LUKS" ]; then
165
    echo
166
    echo "Setting up encrypted /home device"
167
    plymouth ask-for-password --command="cryptsetup luksOpen \\\$homedev EncHome"
168
    homedev=/dev/mapper/EncHome
169
  fi
170
 
171
  # and finally do the mount
172
  mount \\\$mountopts \\\$homedev /home
173
  # if we have /home under what's passed for persistent home, then
174
  # we should make that the real /home.  useful for mtd device on olpc
175
  if [ -d /home/home ]; then mount --bind /home/home /home ; fi
176
  [ -x /sbin/restorecon ] && /sbin/restorecon /home
177
  if [ -d /home/\\\$LIVECD_USER ]; then USERADDARGS="-M" ; fi
178
}
179
 
180
findPersistentHome() {
181
  for arg in \\\`cat /proc/cmdline\\\` ; do
182
    if [ "\\\${arg##persistenthome=}" != "\\\${arg}" ]; then
183
      homedev=\\\${arg##persistenthome=}
184
      return
185
    fi
186
  done
187
}
188
 
189
if strstr "\\\`cat /proc/cmdline\\\`" persistenthome= ; then
190
  findPersistentHome
191
elif [ -e /mnt/live/\\\${livedir}/home.img ]; then
192
  homedev=/mnt/live/\\\${livedir}/home.img
193
fi
194
 
195
# if we have a persistent /home, then we want to go ahead and mount it
196
if ! strstr "\\\`cat /proc/cmdline\\\`" nopersistenthome && [ -n "\\\$homedev" ] ; then
197
  action "Mounting persistent /home" mountPersistentHome
198
fi
199
 
200
# make it so that we don't do writing to the overlay for things which
201
# are just tmpdirs/caches
202
mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum
203
mount -t tmpfs tmp /tmp
204
mount -t tmpfs vartmp /var/tmp
205
[ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /tmp /var/tmp >/dev/null 2>&1
206
 
275 beyerleu 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
 
273 beyerleu 232
# turn off services, which are not useful on LiveCD, to preserve resources
274 beyerleu 233
if [ "\\\$SERVICES_OFF" ]; then
234
    for service in \\\$SERVICES_OFF ; do
273 beyerleu 235
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
236
    done
237
fi
238
 
275 beyerleu 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
 
246
# services off, from command line parameter (turn it off once again)
273 beyerleu 247
if [ "\\\$SERVICEOFF" ]; then
248
    for service in \\\$( echo "\\\$SERVICEOFF" | tr ':' ' ' ); do
249
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
250
    done
251
fi
252
 
275 beyerleu 253
# services on, from command line parameter (turn it ofn once again)
273 beyerleu 254
if [ "\\\$SERVICEON" ]; then
255
    for service in \\\$( echo "\\\$SERVICEON" | tr ':' ' ' ); do
256
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service on  2>/dev/null
257
    done
258
fi
259
 
269 beyerleu 260
## fix various bugs and issues
261
# unmute sound card
262
exists alsaunmute 0 2> /dev/null
263
 
270 beyerleu 264
# turn off firstboot for livecd boots
265
echo "RUN_FIRSTBOOT=NO" > /etc/sysconfig/firstboot
266
 
267
# start afs with option -memcache (is this correct?)
268
[ -e /etc/sysconfig/afs ] && sed -i "s|^OPTIONS=.*|OPTIONS=\"-memcache\"|" /etc/sysconfig/afs
269
 
269 beyerleu 270
# Stopgap fix for RH #217966; should be fixed in HAL instead
271
touch /media/.hal-mtab
272
 
273
## create the LiveCD default user
274
# add default user with no password
275
/usr/sbin/useradd -c "LiveCD default user" \\\$LIVECD_USER
276
/usr/bin/passwd -d \\\$LIVECD_USER > /dev/null
277
# give default user sudo privileges
278
echo "\\\$LIVECD_USER     ALL=(ALL)     NOPASSWD: ALL" >> /etc/sudoers
279
 
280
## configure default user's desktop
281
# set up timed auto-login at 10 seconds
282
cat >> /etc/gdm/custom.conf << FOE
283
[daemon]
284
TimedLoginEnable=true
285
TimedLogin=LIVECD_USER
286
TimedLoginDelay=$LOGIN_DELAY
287
FOE
288
sed -i "s|LIVECD_USER|\\\$LIVECD_USER|" /etc/gdm/custom.conf
289
 
290
# add keyboard and display configuration utilities to the desktop
291
mkdir -p /home/\\\$LIVECD_USER/Desktop >/dev/null
292
cp /usr/share/applications/gnome-keyboard.desktop           /home/\\\$LIVECD_USER/Desktop/
293
cp /usr/share/applications/gnome-display-properties.desktop /home/\\\$LIVECD_USER/Desktop/
294
 
295
# disable screensaver locking
296
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool   /apps/gnome-screensaver/lock_enabled "false" >/dev/null
297
 
298
# disable PackageKit update checking by default
299
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t int /apps/gnome-packagekit/update-icon/frequency_get_updates "0" >/dev/null
300
 
276 beyerleu 301
 
302
### detecting disk partitions and logical volumes (disabled by default)
303
### use boot parameter automount to enable it
304
 
269 beyerleu 305
CreateDesktopIconHD()
306
{
307
cat > /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop << EOF_HDicon
308
[Desktop Entry]
309
Encoding=UTF-8
310
Version=1.0
311
Type=Link
312
Name=Local hard drives
313
Name[en_US]=Local hard drives
314
Name[fr_CA]=Disques durs locaux
315
URL=/mnt/disc
316
Icon=/usr/share/icons/gnome/32x32/devices/gnome-dev-harddisk.png
317
EOF_HDicon
318
 
319
chmod 755 /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop
320
}
321
 
322
CreateDesktopIconLVM()
323
{
324
mkdir -p /home/\\\$LIVECD_USER/Desktop >/dev/null
325
 
326
cat > /home/\\\$LIVECD_USER/Desktop/Local\ logical\ volumes.desktop << EOF_LVMicon
327
[Desktop Entry]
328
Encoding=UTF-8
329
Version=1.0
330
Type=Link
331
Name=Local logical volumes
332
Name[en_US]=Local logical volumes
333
Name[fr_CA]=Volumes logiques locaux
334
URL=/mnt/lvm
335
Icon=/usr/share/icons/gnome/32x32/devices/gnome-dev-harddisk.png
336
EOF_LVMicon
337
 
338
chmod 755 /home/\\\$LIVECD_USER/Desktop/Local\ logical\ volumes.desktop
339
}
340
 
276 beyerleu 341
# mount disk partitions if 'automount' is given as a boot option
342
if [ "\\\$( cmdline_parameter automount )" ]; then
343
	MOUNTOPTION="rw"
269 beyerleu 344
	HARD_DISKS=\\\`egrep "[sh]d.\\\$" /proc/partitions | tr -s ' ' | sed 's/^  *//' | cut -d' ' -f4\\\`
345
 
346
	echo "Mounting hard disk partitions... "
347
	for DISK in \\\$HARD_DISKS; do
348
	    # Get the device and system info from fdisk (but only for fat and linux partitions).
349
	    FDISK_INFO=\\\`fdisk -l /dev/\\\$DISK | tr [A-Z] [a-z] | egrep "fat|linux" | egrep -v "swap|extended|lvm" | sed 's/*//' | tr -s ' ' | tr ' ' ':' | cut -d':' -f1,6-\\\`
350
	    for FDISK_ENTRY in \\\$FDISK_INFO; do
351
		PARTITION=\\\`echo \\\$FDISK_ENTRY | cut -d':' -f1\\\`
352
		MOUNTPOINT="/mnt/disc/\\\${PARTITION##/dev/}"
353
		mkdir -p \\\$MOUNTPOINT
354
		MOUNTED=FALSE
355
 
356
		# get the partition type
357
		case \\\`echo \\\$FDISK_ENTRY | cut -d':' -f2-\\\` in
358
		*fat*) 
359
		    FSTYPES="vfat"
360
		    EXTRAOPTIONS=",uid=500";;
361
		*)
362
		    FSTYPES="ext4 ext3 ext2"
363
		    EXTRAOPTIONS="";;
364
		esac
365
 
366
		# try to mount the partition
367
		for FSTYPE in \\\$FSTYPES; do
368
		    if mount -o "\\\${MOUNTOPTION}\\\${EXTRAOPTIONS}" -t \\\$FSTYPE \\\$PARTITION \\\$MOUNTPOINT &>/dev/null; then
369
			echo "\\\$PARTITION \\\$MOUNTPOINT \\\$FSTYPE noauto,\\\${MOUNTOPTION}\\\${EXTRAOPTIONS} 0 0" >> /etc/fstab
370
			echo -n "\\\$PARTITION "
371
			MOUNTED=TRUE
372
			CreateDesktopIconHD
373
		    fi
374
		done
375
		[ \\\$MOUNTED = "FALSE" ] && rmdir \\\$MOUNTPOINT
376
	    done
377
	done
378
	echo
379
fi
380
 
276 beyerleu 381
# mount logical volumes if 'automount' is given as a boot option
382
if [ "\\\$( cmdline_parameter automount )" ]; then
383
        MOUNTOPTION="rw"
269 beyerleu 384
	FSTYPES="ext4 ext3 ext2"
385
	echo "Scanning for logical volumes..."
386
	if ! lvm vgscan 2>&1 | grep "No volume groups"; then
387
	    echo "Activating logical volumes ..."
388
	    modprobe dm_mod >/dev/null
389
	    lvm vgchange -ay
390
	    LOGICAL_VOLUMES=\\\`lvm lvdisplay -c | sed "s/^  *//" | cut -d: -f1\\\`
391
	    if [ ! -z "\\\$LOGICAL_VOLUMES" ]; then
392
		echo "Making device nodes ..."
393
		lvm vgmknodes
394
		echo -n "Mounting logical volumes ... "
395
		for VOLUME_NAME in \\\$LOGICAL_VOLUMES; do
396
		    VG_NAME=\\\`echo \\\$VOLUME_NAME | cut -d/ -f3\\\`
397
		    LV_NAME=\\\`echo \\\$VOLUME_NAME | cut -d/ -f4\\\`
398
		    MOUNTPOINT="/mnt/lvm/\\\${VG_NAME}-\\\${LV_NAME}"
399
		    mkdir -p \\\$MOUNTPOINT
400
 
401
		    MOUNTED=FALSE
402
		    for FSTYPE in \\\$FSTYPES; do
403
			if mount -o \\\$MOUNTOPTION -t \\\$FSTYPE \\\$VOLUME_NAME \\\$MOUNTPOINT &>/dev/null; then
404
			    echo "\\\$VOLUME_NAME \\\$MOUNTPOINT \\\$FSTYPE defaults,\\\${MOUNTOPTION} 0 0" >> /etc/fstab
405
			    echo -n "\\\$VOLUME_NAME "
406
			    MOUNTED=TRUE
407
			    CreateDesktopIconLVM
408
			    break
409
			fi
410
		    done
411
		    [ \\\$MOUNTED = FALSE ] && rmdir \\\$MOUNTPOINT
412
		done
413
		echo
414
 
415
	    else
416
		echo "No logical volumes found"
417
	    fi
418
	fi
419
fi
420
 
421
# give back ownership to the default user
422
chown -R \\\$LIVECD_USER:\\\$LIVECD_USER /home/\\\$LIVECD_USER
423
 
424
EOF_initscript
425
echo ###################################################################
426
echo ## End of livesys script
427
echo ###################################################################
428
 
429
 
430
 
431
echo ###################################################################
432
echo ## Creating the livesys init script - livesys-late
433
echo ###################################################################
434
 
435
cat > /etc/rc.d/init.d/livesys-late << EOF_lateinitscript
436
#!/bin/bash
437
#
438
# live: Late init script for live image
439
#
440
# chkconfig: 345 99 01
441
# description: Late init script for live image.
442
 
443
. /etc/init.d/functions
444
. /etc/livesys.conf
445
. /etc/init.d/livesys.functions
446
 
275 beyerleu 447
# exit if not running from LiveCD
448
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ]; then
269 beyerleu 449
    exit 0
450
fi
451
 
452
touch /.liveimg-late-configured
453
 
454
# read boot parameters out of /proc/cmdline
455
ks=\\\$( cmdline_value ks )
456
xdriver=\\\$( cmdline_value xdriver )
457
kb=\\\$( cmdline_value kb )
458
 
459
# if liveinst or textinst is given, start anaconda
460
if [ "\\\$( cmdline_parameter liveinst )" ]; then
461
   plymouth --quit
462
   /usr/sbin/liveinst \\\$ks
463
fi
464
if [ "\\\$( cmdline_parameter textinst )" ] ; then
465
   plymouth --quit
466
   /usr/sbin/liveinst --text \\\$ks
467
fi
468
 
469
# configure X, allowing user to override xdriver
470
if [ "\\\$xdriver" ]; then
471
    exists system-config-display --noui --reconfig --set-depth=24 --set-driver=\\\$xdriver
472
fi
473
 
474
# configure keyboard
475
if [ "\\\$kb" ]; then
476
    exists system-config-keyboard --noui \\\$kb 
477
fi
478
 
479
EOF_lateinitscript
480
echo ###################################################################
481
echo ## End of livesys-late script
482
echo ###################################################################
483
 
484
 
485
 
486
echo ###################################################################
487
echo ## Configure the LiveCD
488
echo ###################################################################
489
 
490
# workaround avahi segfault (#279301)
491
touch /etc/resolv.conf
492
/sbin/restorecon /etc/resolv.conf
493
 
494
chmod 755 /etc/rc.d/init.d/livesys
495
/sbin/restorecon /etc/rc.d/init.d/livesys
496
/sbin/chkconfig --add livesys
497
 
498
chmod 755 /etc/rc.d/init.d/livesys-late
499
/sbin/restorecon /etc/rc.d/init.d/livesys-late
500
/sbin/chkconfig --add livesys-late
501
 
502
# go ahead and pre-make the man -k cache (#455968)
503
/usr/sbin/makewhatis -w
504
 
505
# save a little bit of space at least...
506
rm -f /var/lib/rpm/__db*
507
rm -f /boot/initrd*
508
rm -f /boot/initramfs*
509
# make sure there aren't core files lying around
510
rm -f /core*
511
 
512
# convince readahead not to collect
513
rm -f /.readahead_collect
514
touch /var/lib/readahead/early.sorted
515
 
516
# workaround clock syncing on shutdown that we don't want (#297421)
517
sed -i -e 's/hwclock/no-such-hwclock/g' /etc/rc.d/init.d/halt
518
 
519
# import RPM GPG keys
520
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta
521
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
522
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-sl6
523
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-dawson
524
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-sl
525
 
526
# evolution is in the gnome launch panel (workaround to start thunderbird instead)
527
[ ! -e /usr/bin/evolution ] && ln -s /usr/bin/thunderbird /usr/bin/evolution
528
 
529
EOF_post
530
 
531
# run post-install script
532
/bin/bash -x /root/post-install 2>&1 | tee /root/post-install.log
533
 
534
%end
535
########################################################################
536
# End of configure LiveCD in chroot
537
########################################################################
538
 
539
 
540
 
541
%post --nochroot
542
########################################################################
543
# Post install in no chroot
544
# Must change "$" to "\$" and "`" to "\`" to avoid shell quoting
545
########################################################################
546
cat > /root/postnochroot-install << EOF_postnochroot
547
#!/bin/bash
548
 
549
# Copy licensing information
550
cp $INSTALL_ROOT/usr/share/doc/*-release-*/GPL $LIVE_ROOT/GPL
551
 
552
# add livecd-iso-to-disk utility on the LiveCD
553
# only works on x86, x86_64
554
if [ "\$(uname -i)" = "i386" -o "\$(uname -i)" = "x86_64" ]; then
555
  if [ ! -d \$LIVE_ROOT/LiveOS ]; then mkdir -p \$LIVE_ROOT/LiveOS ; fi
556
  cp /usr/bin/livecd-iso-to-disk \$LIVE_ROOT/LiveOS
557
fi
558
 
559
# customize boot menu entries
560
grep -B4 'menu default'  \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/default.txt
561
grep -B3 'xdriver=vesa'  \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/basicvideo.txt
562
grep -A3 'label check0'  \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/check.txt
563
grep -A2 'label memtest' \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/memtest.txt
564
grep -A2 'label local'   \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/localboot.txt
565
 
566
sed "s/label linux0/label linuxtext0/"   \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/textboot.txt
567
sed -i "s/Boot/Boot (Text Mode)/"                                           \$LIVE_ROOT/isolinux/textboot.txt
568
sed -i "s/liveimg/liveimg 3/"                                               \$LIVE_ROOT/isolinux/textboot.txt
569
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/textboot.txt
570
 
571
sed "s/label linux0/label install0/"     \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/install.txt
572
sed -i "s/Boot/Install/"                                                    \$LIVE_ROOT/isolinux/install.txt
276 beyerleu 573
sed -i "s/liveimg/liveimg liveinst noswap/"                                 \$LIVE_ROOT/isolinux/install.txt
269 beyerleu 574
sed -i "s/ quiet / /"                                                       \$LIVE_ROOT/isolinux/install.txt
575
sed -i "s/ rhgb / /"                                                        \$LIVE_ROOT/isolinux/install.txt
576
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/install.txt
577
 
578
sed "s/label linux0/label textinstall0/" \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/textinstall.txt
579
sed -i "s/Boot/Install (Text Mode)/"                                        \$LIVE_ROOT/isolinux/textinstall.txt
276 beyerleu 580
sed -i "s/liveimg/liveimg textinst noswap/"                                 \$LIVE_ROOT/isolinux/textinstall.txt
269 beyerleu 581
sed -i "s/ quiet / /"                                                       \$LIVE_ROOT/isolinux/textinstall.txt
582
sed -i "s/ rhgb / /"                                                        \$LIVE_ROOT/isolinux/textinstall.txt
583
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/textinstall.txt
584
 
585
cat \$LIVE_ROOT/isolinux/default.txt \$LIVE_ROOT/isolinux/basicvideo.txt \$LIVE_ROOT/isolinux/check.txt \$LIVE_ROOT/isolinux/memtest.txt \$LIVE_ROOT/isolinux/localboot.txt > \$LIVE_ROOT/isolinux/current.txt
586
diff \$LIVE_ROOT/isolinux/isolinux.cfg \$LIVE_ROOT/isolinux/current.txt | sed '/^[0-9][0-9]*/d; s/^. //; /^---$/d' > \$LIVE_ROOT/isolinux/cleaned.txt
587
cat \$LIVE_ROOT/isolinux/cleaned.txt \$LIVE_ROOT/isolinux/default.txt \$LIVE_ROOT/isolinux/textboot.txt \$LIVE_ROOT/isolinux/basicvideo.txt \$LIVE_ROOT/isolinux/install.txt \$LIVE_ROOT/isolinux/textinstall.txt \$LIVE_ROOT/isolinux/memtest.txt \$LIVE_ROOT/isolinux/localboot.txt > \$LIVE_ROOT/isolinux/isolinux.cfg
588
rm -f \$LIVE_ROOT/isolinux/*.txt
589
 
590
EOF_postnochroot
591
 
592
# run postnochroot-install script
593
/bin/bash -x /root/postnochroot-install 2>&1 | tee /root/postnochroot-install.log
594
 
595
%end
596
########################################################################
597
# End of configure LiveCD in nochroot
598
########################################################################