Subversion Repositories livecd

Rev

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

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