Subversion Repositories livecd

Rev

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