Subversion Repositories livecd

Rev

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

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