Subversion Repositories livecd

Rev

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

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