Subversion Repositories livecd

Rev

Rev 346 | Rev 359 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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