Subversion Repositories livecd

Rev

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

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