Subversion Repositories livecd

Rev

Rev 286 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 286 Rev 287
Line 43... Line 43...
43
@remote-desktop-clients
43
@remote-desktop-clients
44
# packages added to @remote-desktop-clients
44
# packages added to @remote-desktop-clients
45
rdesktop
45
rdesktop
46
tsclient
46
tsclient
47
@x11
47
@x11
48
@openafs-client
-
 
49
 
48
 
50
# other usefull packages
49
# other usefull packages
51
busybox
50
busybox
52
mailx
51
mailx
53
memtest86+
52
memtest86+
Line 156... Line 155...
156
 
155
 
157
[ -e /.liveimg-configured ] && configdone=1
156
[ -e /.liveimg-configured ] && configdone=1
158
 
157
 
159
touch /.liveimg-configured
158
touch /.liveimg-configured
160
 
159
 
161
# read boot parameters out of /proc/cmdline
160
### read boot parameters out of /proc/cmdline
162
 
161
 
163
# hostname
162
# hostname
164
hostname=\\\$( cmdline_value hostname )
163
hostname=\\\$( cmdline_value hostname )
165
 
164
 
166
# afs cell
165
# afs cell
Line 179... Line 178...
179
 
178
 
180
# set livecd user
179
# set livecd user
181
LIVECD_USER=\\\$( cmdline_value user )
180
LIVECD_USER=\\\$( cmdline_value user )
182
[ ! "\\\$LIVECD_USER" ] && LIVECD_USER=\\\$LIVECD_DEF_USER
181
[ ! "\\\$LIVECD_USER" ] && LIVECD_USER=\\\$LIVECD_DEF_USER
183
 
182
 
-
 
183
 
184
# mount live image
184
### mount live image
185
if [ -b \\\`readlink -f /dev/live\\\` ]; then
185
if [ -b \\\`readlink -f /dev/live\\\` ]; then
186
   mkdir -p /mnt/live
186
   mkdir -p /mnt/live
187
   mount -o ro /dev/live /mnt/live 2>/dev/null || mount /dev/live /mnt/live
187
   mount -o ro /dev/live /mnt/live 2>/dev/null || mount /dev/live /mnt/live
188
fi
188
fi
189
 
189
 
Line 193... Line 193...
193
    livedir=\\\${arg##live_dir=}
193
    livedir=\\\${arg##live_dir=}
194
    return
194
    return
195
  fi
195
  fi
196
done
196
done
197
 
197
 
198
# enable swaps unless requested otherwise
198
### enable swaps unless requested otherwise
199
swaps=\\\`blkid -t TYPE=swap -o device\\\`
199
swaps=\\\`blkid -t TYPE=swap -o device\\\`
200
if ! strstr "\\\`cat /proc/cmdline\\\`" noswap && [ -n "\\\$swaps" ] ; then
200
if ! strstr "\\\`cat /proc/cmdline\\\`" noswap && [ -n "\\\$swaps" ] ; then
201
  for s in \\\$swaps ; do
201
  for s in \\\$swaps ; do
202
    action "Enabling swap partition \\\$s" swapon \\\$s
202
    action "Enabling swap partition \\\$s" swapon \\\$s
203
  done
203
  done
204
fi
204
fi
205
if ! strstr "\\\`cat /proc/cmdline\\\`" noswap && [ -f /mnt/live/\\\${livedir}/swap.img ] ; then
205
if ! strstr "\\\`cat /proc/cmdline\\\`" noswap && [ -f /mnt/live/\\\${livedir}/swap.img ] ; then
206
  action "Enabling swap file" swapon /mnt/live/\\\${livedir}/swap.img
206
  action "Enabling swap file" swapon /mnt/live/\\\${livedir}/swap.img
207
fi
207
fi
208
 
208
 
-
 
209
### functions for persisten Home 
209
mountPersistentHome() {
210
mountPersistentHome() {
210
  # support label/uuid
211
  # support label/uuid
211
  if [ "\\\${homedev##LABEL=}" != "\\\${homedev}" -o "\\\${homedev##UUID=}" != "\\\${homedev}" ]; then
212
  if [ "\\\${homedev##LABEL=}" != "\\\${homedev}" -o "\\\${homedev##UUID=}" != "\\\${homedev}" ]; then
212
    homedev=\\\`/sbin/blkid -o device -t "\\\$homedev"\\\`
213
    homedev=\\\`/sbin/blkid -o device -t "\\\$homedev"\\\`
213
  fi
214
  fi
Line 255... Line 256...
255
  findPersistentHome
256
  findPersistentHome
256
elif [ -e /mnt/live/\\\${livedir}/home.img ]; then
257
elif [ -e /mnt/live/\\\${livedir}/home.img ]; then
257
  homedev=/mnt/live/\\\${livedir}/home.img
258
  homedev=/mnt/live/\\\${livedir}/home.img
258
fi
259
fi
259
 
260
 
260
# if we have a persistent /home, then we want to go ahead and mount it
261
### if we have a persistent /home, then we want to go ahead and mount it
261
if ! strstr "\\\`cat /proc/cmdline\\\`" nopersistenthome && [ -n "\\\$homedev" ] ; then
262
if ! strstr "\\\`cat /proc/cmdline\\\`" nopersistenthome && [ -n "\\\$homedev" ] ; then
262
  action "Mounting persistent /home" mountPersistentHome
263
  action "Mounting persistent /home" mountPersistentHome
263
fi
264
fi
264
 
265
 
265
# make it so that we don't do writing to the overlay for things which
266
### make it so that we don't do writing to the overlay for things which
266
# are just tmpdirs/caches
267
### are just tmpdirs/caches
267
mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum
268
mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum
268
mount -t tmpfs tmp /tmp
269
mount -t tmpfs tmp /tmp
269
mount -t tmpfs vartmp /var/tmp
270
mount -t tmpfs vartmp /var/tmp
270
[ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /tmp /var/tmp >/dev/null 2>&1
271
[ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /tmp /var/tmp >/dev/null 2>&1
271
 
272
 
272
# set afs cell if given by boot parameter
273
### set afs cell if given by boot parameter
273
if [ "\\\$CELL" ]; then
274
if [ "\\\$CELL" ]; then
274
    [ -e /usr/vice/etc/ThisCell ] && echo \\\$CELL > /usr/vice/etc/ThisCell
275
    [ -e /usr/vice/etc/ThisCell ] && echo \\\$CELL > /usr/vice/etc/ThisCell
275
fi
276
fi
276
 
277
 
277
# set cups server
278
### set cups server
278
if [ "\\\$CUPS" ]; then
279
if [ "\\\$CUPS" ]; then
279
    if [ -e /etc/cups/client.conf ]; then
280
    if [ -e /etc/cups/client.conf ]; then
280
        sed -i "s|.*ServerName .*|ServerName  \\\$CUPS|" /etc/cups/client.conf
281
        sed -i "s|.*ServerName .*|ServerName  \\\$CUPS|" /etc/cups/client.conf
281
        grep -q ServerName /etc/cups/client.conf || echo "ServerName  \\\$CUPS" >> /etc/cups/client.conf 
282
        grep -q ServerName /etc/cups/client.conf || echo "ServerName  \\\$CUPS" >> /etc/cups/client.conf 
282
    fi
283
    fi
283
fi
284
fi
284
 
285
 
285
# set the LiveCD hostname
286
### set the LiveCD hostname
286
[ ! "\\\$hostname" ] && hostname="livecd.localdomain"
287
[ ! "\\\$hostname" ] && hostname="livecd.localdomain"
287
sed -i -e "s|HOSTNAME=.*|HOSTNAME=\\\$hostname|g" /etc/sysconfig/network
288
sed -i -e "s|HOSTNAME=.*|HOSTNAME=\\\$hostname|g" /etc/sysconfig/network
288
/bin/hostname \\\$hostname
289
/bin/hostname \\\$hostname
289
 
290
 
290
#-----------------------------------------------------------------------
291
#-----------------------------------------------------------------------
Line 292... Line 293...
292
# happens if you start the LiveCD with persistent changes 
293
# happens if you start the LiveCD with persistent changes 
293
#-----------------------------------------------------------------------
294
#-----------------------------------------------------------------------
294
 
295
 
295
[ "\\\$configdone" ] && exit 0
296
[ "\\\$configdone" ] && exit 0
296
 
297
 
297
# turn off services, which are not useful on LiveCD, to preserve resources
298
### turn off services, which are not useful on LiveCD, to preserve resources
298
if [ "\\\$SERVICES_OFF" ]; then
299
if [ "\\\$SERVICES_OFF" ]; then
299
    for service in \\\$SERVICES_OFF ; do
300
    for service in \\\$SERVICES_OFF ; do
300
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
301
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
301
    done
302
    done
302
fi
303
fi
303
 
304
 
304
# turn on services, which are off by default
305
### turn on services, which are off by default
305
if [ "\\\$SERVICES_ON" ]; then
306
if [ "\\\$SERVICES_ON" ]; then
306
    for service in \\\$SERVICES_ON ; do
307
    for service in \\\$SERVICES_ON ; do
307
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service ofn  2>/dev/null
308
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service ofn  2>/dev/null
308
    done
309
    done
309
fi
310
fi
310
 
311
 
311
# services off, from command line parameter (turn it off once again)
312
### services off, from command line parameter (turn it off once again)
312
if [ "\\\$SERVICEOFF" ]; then
313
if [ "\\\$SERVICEOFF" ]; then
313
    for service in \\\$( echo "\\\$SERVICEOFF" | tr ':' ' ' ); do
314
    for service in \\\$( echo "\\\$SERVICEOFF" | tr ':' ' ' ); do
314
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
315
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
315
    done
316
    done
316
fi
317
fi
Line 320... Line 321...
320
    for service in \\\$( echo "\\\$SERVICEON" | tr ':' ' ' ); do
321
    for service in \\\$( echo "\\\$SERVICEON" | tr ':' ' ' ); do
321
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service on  2>/dev/null
322
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service on  2>/dev/null
322
    done
323
    done
323
fi
324
fi
324
 
325
 
325
## fix various bugs and issues
326
### fix various bugs and issues
326
# unmute sound card
327
# unmute sound card
327
exists alsaunmute 0 2> /dev/null
328
exists alsaunmute 0 2> /dev/null
328
 
329
 
329
# turn off firstboot for livecd boots
330
# turn off firstboot for livecd boots
330
echo "RUN_FIRSTBOOT=NO" > /etc/sysconfig/firstboot
331
echo "RUN_FIRSTBOOT=NO" > /etc/sysconfig/firstboot
Line 333... Line 334...
333
[ -e /etc/sysconfig/afs ] && sed -i "s|^OPTIONS=.*|OPTIONS=\"-memcache\"|" /etc/sysconfig/afs
334
[ -e /etc/sysconfig/afs ] && sed -i "s|^OPTIONS=.*|OPTIONS=\"-memcache\"|" /etc/sysconfig/afs
334
 
335
 
335
# Stopgap fix for RH #217966; should be fixed in HAL instead
336
# Stopgap fix for RH #217966; should be fixed in HAL instead
336
touch /media/.hal-mtab
337
touch /media/.hal-mtab
337
 
338
 
338
## create the LiveCD default user
339
### create the LiveCD default user
339
# add default user with no password
340
# add default user with no password
340
/usr/sbin/useradd -c "LiveCD default user" \\\$LIVECD_USER
341
/usr/sbin/useradd -c "LiveCD default user" \\\$LIVECD_USER
341
/usr/bin/passwd -d \\\$LIVECD_USER > /dev/null
342
/usr/bin/passwd -d \\\$LIVECD_USER > /dev/null
342
# give default user sudo privileges
343
# give default user sudo privileges
343
# echo "\\\$LIVECD_USER     ALL=(ALL)     NOPASSWD: ALL" >> /etc/sudoers
344
# echo "\\\$LIVECD_USER     ALL=(ALL)     NOPASSWD: ALL" >> /etc/sudoers
344
 
345
 
345
## set password
346
### set password
346
if [ "\\\$PW" ]; then
347
if [ "\\\$PW" ]; then
347
    echo \\\$PW | passwd --stdin root >/dev/null
348
    echo \\\$PW | passwd --stdin root >/dev/null
348
    echo \\\$PW | passwd --stdin \\\$LIVECD_USER >/dev/null
349
    echo \\\$PW | passwd --stdin \\\$LIVECD_USER >/dev/null
349
fi
350
fi
350
 
351
 
351
## configure default user's desktop
352
### enable auto-login
352
# set up timed auto-login at 10 seconds
353
if [ ! "\\\$( cmdline_parameter noautologin )" ]; then
353
cat >> /etc/gdm/custom.conf << FOE
354
    cat >> /etc/gdm/custom.conf << FOE
354
[daemon]
355
[daemon]
355
TimedLoginEnable=true
356
TimedLoginEnable=true
356
TimedLogin=LIVECD_USER
357
TimedLogin=LIVECD_USER
357
TimedLoginDelay=$LOGIN_DELAY
358
TimedLoginDelay=\\\$LOGIN_DELAY
358
FOE
359
FOE
359
sed -i "s|LIVECD_USER|\\\$LIVECD_USER|" /etc/gdm/custom.conf
360
    sed -i "s|LIVECD_USER|\\\$LIVECD_USER|" /etc/gdm/custom.conf
-
 
361
fi
360
 
362
 
361
# add keyboard and display configuration utilities to the desktop
363
### add keyboard and display configuration utilities to the desktop
362
mkdir -p /home/\\\$LIVECD_USER/Desktop >/dev/null
364
mkdir -p /home/\\\$LIVECD_USER/Desktop >/dev/null
363
cp /usr/share/applications/gnome-keyboard.desktop           /home/\\\$LIVECD_USER/Desktop/
365
cp /usr/share/applications/gnome-keyboard.desktop           /home/\\\$LIVECD_USER/Desktop/
364
cp /usr/share/applications/gnome-display-properties.desktop /home/\\\$LIVECD_USER/Desktop/
366
cp /usr/share/applications/gnome-display-properties.desktop /home/\\\$LIVECD_USER/Desktop/
365
 
367
 
366
# disable screensaver locking
368
### disable screensaver locking
367
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool   /apps/gnome-screensaver/lock_enabled "false" >/dev/null
369
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool   /apps/gnome-screensaver/lock_enabled "false" >/dev/null
368
 
370
 
369
# don't do packagekit checking by default
371
### don't do packagekit checking by default
370
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t int /apps/gnome-packagekit/update-icon/frequency_get_updates "0" >/dev/null
372
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t int /apps/gnome-packagekit/update-icon/frequency_get_updates "0" >/dev/null
371
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t string /apps/gnome-packagekit/update-icon/frequency_get_updates never >/dev/null
373
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t string /apps/gnome-packagekit/update-icon/frequency_get_updates never >/dev/null
372
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t string /apps/gnome-packagekit/update-icon/frequency_get_upgrades never >/dev/null
374
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t string /apps/gnome-packagekit/update-icon/frequency_get_upgrades never >/dev/null
373
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t string /apps/gnome-packagekit/update-icon/frequency_refresh_cache never >/dev/null
375
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t string /apps/gnome-packagekit/update-icon/frequency_refresh_cache never >/dev/null
374
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-packagekit/update-icon/notify_available false >/dev/null
376
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-packagekit/update-icon/notify_available false >/dev/null
Line 377... Line 379...
377
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-packagekit/enable_check_hardware false >/dev/null
379
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-packagekit/enable_check_hardware false >/dev/null
378
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-packagekit/enable_codec_helper false >/dev/null
380
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-packagekit/enable_codec_helper false >/dev/null
379
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-packagekit/enable_font_helper false >/dev/null
381
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-packagekit/enable_font_helper false >/dev/null
380
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-packagekit/enable_mime_type_helper false >/dev/null
382
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-packagekit/enable_mime_type_helper false >/dev/null
381
 
383
 
382
# start system-config-firewall with su 
384
### start system-config-firewall with su 
383
# (bugfix: system-config-firewall does not work when root has no password)
385
#  (bugfix: system-config-firewall does not work when root has no password)
384
sed -i "s|^Exec=.*|Exec=su - -c /usr/bin/system-config-firewall|" /usr/share/applications/system-config-firewall.desktop
386
sed -i "s|^Exec=.*|Exec=su - -c /usr/bin/system-config-firewall|" /usr/share/applications/system-config-firewall.desktop
385
sed -i "s|^Terminal=.*|Terminal=true|"                            /usr/share/applications/system-config-firewall.desktop
387
sed -i "s|^Terminal=.*|Terminal=true|"                            /usr/share/applications/system-config-firewall.desktop
386
 
388
 
-
 
389
 
387
#-----------------------------------------------------------------------
390
###-----------------------------------------------------------------------
388
# detecting disk partitions and logical volumes (disabled by default)
391
# detecting disk partitions and logical volumes (disabled by default)
389
# use boot parameter automount to enable it
392
# use boot parameter automount to enable it
390
#-----------------------------------------------------------------------
393
###-----------------------------------------------------------------------
391
 
394
 
392
CreateDesktopIconHD()
395
CreateDesktopIconHD()
393
{
396
{
394
cat > /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop << EOF_HDicon
397
cat > /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop << EOF_HDicon
395
[Desktop Entry]
398
[Desktop Entry]
Line 503... Line 506...
503
		echo "No logical volumes found"
506
		echo "No logical volumes found"
504
	    fi
507
	    fi
505
	fi
508
	fi
506
fi
509
fi
507
 
510
 
508
# give back ownership to the default user
511
### give back ownership to the default user
509
chown -R \\\$LIVECD_USER:\\\$LIVECD_USER /home/\\\$LIVECD_USER
512
chown -R \\\$LIVECD_USER:\\\$LIVECD_USER /home/\\\$LIVECD_USER
510
 
513
 
511
EOF_initscript
514
EOF_initscript
512
#***********************************************************************
515
#***********************************************************************
513
# End of livesys script
516
# End of livesys script
Line 600... Line 603...
600
rm -f /boot/initrd*
603
rm -f /boot/initrd*
601
rm -f /boot/initramfs*
604
rm -f /boot/initramfs*
602
# make sure there aren't core files lying around
605
# make sure there aren't core files lying around
603
rm -f /core*
606
rm -f /core*
604
 
607
 
-
 
608
# clean up yum
-
 
609
yum clean all
-
 
610
 
605
# convince readahead not to collect
611
# convince readahead not to collect
606
rm -f /.readahead_collect
612
rm -f /.readahead_collect
607
touch /var/lib/readahead/early.sorted
613
touch /var/lib/readahead/early.sorted
608
 
614
 
609
# workaround clock syncing on shutdown that we don't want (#297421)
615
# workaround clock syncing on shutdown that we don't want (#297421)