Subversion Repositories livecd

Rev

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

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