Subversion Repositories livecd

Rev

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

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