Subversion Repositories livecd

Rev

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

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