Subversion Repositories livecd

Rev

Rev 298 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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