figless / centos / livemedia

Forked from centos/livemedia 5 years ago
Clone

Blame kickstarts/centos-7-live-gnome-i386.cfg

efc291
efc291
lang en_GB.UTF-8
efc291
keyboard us
efc291
timezone Europe/Brussels --isUtc
efc291
auth --useshadow --enablemd5
efc291
selinux --enforcing
efc291
firewall --enabled --service=mdns
efc291
xconfig --startxonboot
efc291
part / --size 8192 --fstype ext4
efc291
services --enabled=NetworkManager --disabled=network,sshd
efc291
efc291
efc291
# Root password
efc291
rootpw --iscrypted $6$K2nKf02kVKG68960$OywvoaViphSITuro/liKvCj7Pm/CH/xqzz/lsoXyaKSR1lYf0vHAqSUc483a9MCCBkIwfr/hNMfqwxqVO0OEg1
efc291
efc291
# Workaround for the grubby issue on live media (see https://bugzilla.redhat.com/show_bug.cgi?id=1153410)
efc291
repo --name=base --baseurl=http://mirror.centos.org/altarch/7/os/i386/ --excludepkgs=grubby
efc291
repo --name=grubby --baseurl=http://dev.centos.org/c7.00.02/
efc291
repo --name=updates --baseurl=http://mirror.centos.org/altarch/7/updates/i386/
efc291
 
efc291
%packages
efc291
@base
efc291
@core
efc291
@dial-up
efc291
@directory-client
efc291
@fonts
efc291
@gnome-desktop
efc291
@guest-agents
efc291
@guest-desktop-agents
efc291
@input-methods
efc291
@internet-browser
efc291
@java-platform
efc291
@multimedia
efc291
@network-file-system-client
efc291
@print-client
efc291
@x11
efc291
@internet-applications
efc291
@office-suite
efc291
@remote-desktop-clients
efc291
@gnome-apps
efc291
efc291
efc291
#Live install tools
efc291
anaconda
efc291
system-config-keyboard
efc291
firefox
efc291
patch
efc291
efc291
# For UEFI/Secureboot support
efc291
#grub2
efc291
#grub2-efi
efc291
#efibootmgr
efc291
#shim
efc291
efc291
%end
efc291
efc291
%post
efc291
# FIXME: it'd be better to get this installed from a package
efc291
cat > /etc/rc.d/init.d/livesys << EOF
efc291
#!/bin/bash
efc291
#
efc291
# live: Init script for live image
efc291
#
efc291
# chkconfig: 345 00 99
efc291
# description: Init script for live image.
efc291
### BEGIN INIT INFO
efc291
# X-Start-Before: display-manager
efc291
### END INIT INFO
efc291
efc291
. /etc/init.d/functions
efc291
efc291
if ! strstr "\`cat /proc/cmdline\`" rd.live.image || [ "\$1" != "start" ]; then
efc291
    exit 0
efc291
fi
efc291
efc291
if [ -e /.liveimg-configured ] ; then
efc291
    configdone=1
efc291
fi
efc291
efc291
exists() {
efc291
    which \$1 >/dev/null 2>&1 || return
efc291
    \$*
efc291
}
efc291
efc291
# Make sure we don't mangle the hardware clock on shutdown
efc291
ln -sf /dev/null /etc/systemd/system/hwclock-save.service
efc291
efc291
livedir="LiveOS"
efc291
for arg in \`cat /proc/cmdline\` ; do
efc291
  if [ "\${arg##rd.live.dir=}" != "\${arg}" ]; then
efc291
    livedir=\${arg##rd.live.dir=}
efc291
    return
efc291
  fi
efc291
  if [ "\${arg##live_dir=}" != "\${arg}" ]; then
efc291
    livedir=\${arg##live_dir=}
efc291
    return
efc291
  fi
efc291
done
efc291
efc291
# enable swaps unless requested otherwise
efc291
swaps=\`blkid -t TYPE=swap -o device\`
efc291
if ! strstr "\`cat /proc/cmdline\`" noswap && [ -n "\$swaps" ] ; then
efc291
  for s in \$swaps ; do
efc291
    action "Enabling swap partition \$s" swapon \$s
efc291
  done
efc291
fi
efc291
if ! strstr "\`cat /proc/cmdline\`" noswap && [ -f /run/initramfs/live/\${livedir}/swap.img ] ; then
efc291
  action "Enabling swap file" swapon /run/initramfs/live/\${livedir}/swap.img
efc291
fi
efc291
efc291
mountPersistentHome() {
efc291
  # support label/uuid
efc291
  if [ "\${homedev##LABEL=}" != "\${homedev}" -o "\${homedev##UUID=}" != "\${homedev}" ]; then
efc291
    homedev=\`/sbin/blkid -o device -t "\$homedev"\`
efc291
  fi
efc291
efc291
  # if we're given a file rather than a blockdev, loopback it
efc291
  if [ "\${homedev##mtd}" != "\${homedev}" ]; then
efc291
    # mtd devs don't have a block device but get magic-mounted with -t jffs2
efc291
    mountopts="-t jffs2"
efc291
  elif [ ! -b "\$homedev" ]; then
efc291
    loopdev=\`losetup -f\`
efc291
    if [ "\${homedev##/run/initramfs/live}" != "\${homedev}" ]; then
efc291
      action "Remounting live store r/w" mount -o remount,rw /run/initramfs/live
efc291
    fi
efc291
    losetup \$loopdev \$homedev
efc291
    homedev=\$loopdev
efc291
  fi
efc291
efc291
  # if it's encrypted, we need to unlock it
efc291
  if [ "\$(/sbin/blkid -s TYPE -o value \$homedev 2>/dev/null)" = "crypto_LUKS" ]; then
efc291
    echo
efc291
    echo "Setting up encrypted /home device"
efc291
    plymouth ask-for-password --command="cryptsetup luksOpen \$homedev EncHome"
efc291
    homedev=/dev/mapper/EncHome
efc291
  fi
efc291
efc291
  # and finally do the mount
efc291
  mount \$mountopts \$homedev /home
efc291
  # if we have /home under what's passed for persistent home, then
efc291
  # we should make that the real /home.  useful for mtd device on olpc
efc291
  if [ -d /home/home ]; then mount --bind /home/home /home ; fi
efc291
  [ -x /sbin/restorecon ] && /sbin/restorecon /home
efc291
  if [ -d /home/liveuser ]; then USERADDARGS="-M" ; fi
efc291
}
efc291
efc291
findPersistentHome() {
efc291
  for arg in \`cat /proc/cmdline\` ; do
efc291
    if [ "\${arg##persistenthome=}" != "\${arg}" ]; then
efc291
      homedev=\${arg##persistenthome=}
efc291
      return
efc291
    fi
efc291
  done
efc291
}
efc291
efc291
if strstr "\`cat /proc/cmdline\`" persistenthome= ; then
efc291
  findPersistentHome
efc291
elif [ -e /run/initramfs/live/\${livedir}/home.img ]; then
efc291
  homedev=/run/initramfs/live/\${livedir}/home.img
efc291
fi
efc291
efc291
# if we have a persistent /home, then we want to go ahead and mount it
efc291
if ! strstr "\`cat /proc/cmdline\`" nopersistenthome && [ -n "\$homedev" ] ; then
efc291
  action "Mounting persistent /home" mountPersistentHome
efc291
fi
efc291
efc291
# make it so that we don't do writing to the overlay for things which
efc291
# are just tmpdirs/caches
efc291
mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum
efc291
mount -t tmpfs vartmp /var/tmp
efc291
[ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /var/tmp >/dev/null 2>&1
efc291
efc291
if [ -n "\$configdone" ]; then
efc291
  exit 0
efc291
fi
efc291
efc291
# add fedora user with no passwd
efc291
action "Adding live user" useradd \$USERADDARGS -c "Live System User" liveuser
efc291
passwd -d liveuser > /dev/null
efc291
usermod -aG wheel liveuser > /dev/null
efc291
efc291
# Remove root password lock
efc291
passwd -d root > /dev/null
efc291
efc291
# turn off firstboot for livecd boots
efc291
systemctl --no-reload disable firstboot-text.service 2> /dev/null || :
efc291
systemctl --no-reload disable firstboot-graphical.service 2> /dev/null || :
efc291
systemctl stop firstboot-text.service 2> /dev/null || :
efc291
systemctl stop firstboot-graphical.service 2> /dev/null || :
efc291
efc291
# don't use prelink on a running live image
efc291
sed -i 's/PRELINKING=yes/PRELINKING=no/' /etc/sysconfig/prelink &>/dev/null || :
efc291
efc291
# turn off mdmonitor by default
efc291
systemctl --no-reload disable mdmonitor.service 2> /dev/null || :
efc291
systemctl --no-reload disable mdmonitor-takeover.service 2> /dev/null || :
efc291
systemctl stop mdmonitor.service 2> /dev/null || :
efc291
systemctl stop mdmonitor-takeover.service 2> /dev/null || :
efc291
efc291
# don't enable the gnome-settings-daemon packagekit plugin
efc291
gsettings set org.gnome.settings-daemon.plugins.updates active 'false' || :
efc291
efc291
# don't start cron/at as they tend to spawn things which are
efc291
# disk intensive that are painful on a live image
efc291
systemctl --no-reload disable crond.service 2> /dev/null || :
efc291
systemctl --no-reload disable atd.service 2> /dev/null || :
efc291
systemctl stop crond.service 2> /dev/null || :
efc291
systemctl stop atd.service 2> /dev/null || :
efc291
efc291
# Mark things as configured
efc291
touch /.liveimg-configured
efc291
efc291
# add static hostname to work around xauth bug
efc291
# https://bugzilla.redhat.com/show_bug.cgi?id=679486
efc291
echo "localhost" > /etc/hostname
efc291
efc291
# Fixing the lang install issue when other lang than English is selected . See http://bugs.centos.org/view.php?id=7217
efc291
/usr/bin/cp /usr/lib/python2.7/site-packages/blivet/size.py /usr/lib/python2.7/site-packages/blivet/size.py.orig
efc291
/usr/bin/sed -i "s#return self.humanReadable()#return self.humanReadable().encode('utf-8')#g" /usr/lib/python2.7/site-packages/blivet/size.py
efc291
efc291
EOF
efc291
efc291
# Fixing the logout-prompt issue - https://bugs.centos.org/view.php?id=8834
efc291
cat > /etc/xdg/autostart/gsettings-logout-prompt.desktop << EOF
efc291
[Desktop Entry]
efc291
Version=1.0
efc291
Name=GSettings Logout Prompt workaround
efc291
Comment=Workaround to not display the logout-prompt - https://bugs.centos.org/view.php?id=8834
efc291
Exec=gsettings set org.gnome.SessionManager logout-prompt false
efc291
Terminal=false
efc291
Type=Application
efc291
OnlyShowIn=GNOME;Unity;
efc291
X-GNOME-Autostart-Phase=Initialization
efc291
efc291
EOF
efc291
efc291
# Patching livepayload too https://bugzilla.redhat.com/show_bug.cgi?id=1100504
efc291
cat > /tmp/livepayload.patch <
efc291
--- /usr/lib/python2.7/site-packages/pyanaconda/packaging/livepayload.py.orig	
efc291
+++ /usr/lib/python2.7/site-packages/pyanaconda/packaging/livepayload.py
efc291
@@ -152,6 +152,13 @@
efc291
             self.pct = 100
efc291
         threadMgr.wait(THREAD_LIVE_PROGRESS)
efc291
 
efc291
+        # Live needs to create the rescue image before bootloader is written
efc291
+        for kernel in self.kernelVersionList:
efc291
+            log.info("Generating rescue image for %s", kernel)
efc291
+            iutil.execInSysroot("new-kernel-pkg",
efc291
+                                ["--rpmposttrans", kernel])
efc291
+
efc291
+
efc291
     def postInstall(self):
efc291
         """ Perform post-installation tasks. """
efc291
         progressQ.send_message(_("Performing post-installation setup tasks"))
efc291
@@ -159,12 +166,6 @@
efc291
 
efc291
         super(LiveImagePayload, self).postInstall()
efc291
 
efc291
-        # Live needs to create the rescue image before bootloader is written
efc291
-        for kernel in self.kernelVersionList:
efc291
-            log.info("Generating rescue image for %s", kernel)
efc291
-            iutil.execInSysroot("new-kernel-pkg",
efc291
-                                ["--rpmposttrans", kernel])
efc291
-
efc291
         # Make sure the new system has a machine-id, it won't boot without it
efc291
         if not os.path.exists(iutil.getSysroot()+"/etc/machine-id"):
efc291
             iutil.execInSysroot("systemd-machine-id-setup", [])
efc291
efc291
EOF
efc291
efc291
patch -p0 /usr/lib/python2.7/site-packages/pyanaconda/packaging/livepayload.py /tmp/livepayload.patch 
efc291
efc291
# bah, hal starts way too late
efc291
cat > /etc/rc.d/init.d/livesys-late << EOF
efc291
#!/bin/bash
efc291
#
efc291
# live: Late init script for live image
efc291
#
efc291
# chkconfig: 345 99 01
efc291
# description: Late init script for live image.
efc291
efc291
. /etc/init.d/functions
efc291
efc291
if ! strstr "\`cat /proc/cmdline\`" rd.live.image || [ "\$1" != "start" ] || [ -e /.liveimg-late-configured ] ; then
efc291
    exit 0
efc291
fi
efc291
efc291
exists() {
efc291
    which \$1 >/dev/null 2>&1 || return
efc291
    \$*
efc291
}
efc291
efc291
touch /.liveimg-late-configured
efc291
efc291
# read some variables out of /proc/cmdline
efc291
for o in \`cat /proc/cmdline\` ; do
efc291
    case \$o in
efc291
    ks=*)
efc291
        ks="--kickstart=\${o#ks=}"
efc291
        ;;
efc291
    xdriver=*)
efc291
        xdriver="\${o#xdriver=}"
efc291
        ;;
efc291
    esac
efc291
done
efc291
efc291
# if liveinst or textinst is given, start anaconda
efc291
if strstr "\`cat /proc/cmdline\`" liveinst ; then
efc291
   plymouth --quit
efc291
   /usr/sbin/liveinst \$ks
efc291
fi
efc291
if strstr "\`cat /proc/cmdline\`" textinst ; then
efc291
   plymouth --quit
efc291
   /usr/sbin/liveinst --text \$ks
efc291
fi
efc291
efc291
# configure X, allowing user to override xdriver
efc291
if [ -n "\$xdriver" ]; then
efc291
   cat > /etc/X11/xorg.conf.d/00-xdriver.conf <
efc291
Section "Device"
efc291
	Identifier	"Videocard0"
efc291
	Driver	"\$xdriver"
efc291
EndSection
efc291
FOE
efc291
fi
efc291
efc291
EOF
efc291
efc291
chmod 755 /etc/rc.d/init.d/livesys
efc291
/sbin/restorecon /etc/rc.d/init.d/livesys
efc291
/sbin/chkconfig --add livesys
efc291
efc291
chmod 755 /etc/rc.d/init.d/livesys-late
efc291
/sbin/restorecon /etc/rc.d/init.d/livesys-late
efc291
/sbin/chkconfig --add livesys-late
efc291
efc291
# enable tmpfs for /tmp
efc291
systemctl enable tmp.mount
efc291
efc291
# work around for poor key import UI in PackageKit
efc291
rm -f /var/lib/rpm/__db*
efc291
releasever=$(rpm -q --qf '%{version}\n' --whatprovides system-release)
efc291
basearch=$(uname -i)
efc291
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
efc291
echo "Packages within this LiveCD"
efc291
rpm -qa
efc291
# Note that running rpm recreates the rpm db files which aren't needed or wanted
efc291
rm -f /var/lib/rpm/__db*
efc291
efc291
# go ahead and pre-make the man -k cache (#455968)
efc291
/usr/bin/mandb
efc291
efc291
# save a little bit of space at least...
efc291
rm -f /boot/initramfs*
efc291
# make sure there aren't core files lying around
efc291
rm -f /core*
efc291
efc291
# convince readahead not to collect
efc291
# FIXME: for systemd
efc291
efc291
cat >> /etc/rc.d/init.d/livesys << EOF
efc291
efc291
efc291
# disable updates plugin
efc291
cat >> /usr/share/glib-2.0/schemas/org.gnome.settings-daemon.plugins.updates.gschema.override << FOE
efc291
[org.gnome.settings-daemon.plugins.updates]
efc291
active=false
efc291
FOE
efc291
efc291
# Show the system-config-keyboard tool on the desktop
efc291
mkdir /home/liveuser/Desktop -p >/dev/null
efc291
cat /usr/share/applications/system-config-keyboard.desktop | sed '/NotShowIn/d' |sed 's/Terminal=false/Terminal=true/' > /home/liveuser/Desktop/system-config-keyboard.desktop
efc291
cat /usr/share/applications/liveinst.desktop | sed '/NoDisplay/d' > /home/liveuser/Desktop/liveinst.desktop 
efc291
chmod +x /home/liveuser/Desktop/*.desktop
efc291
chown -R liveuser:liveuser /home/liveuser
efc291
efc291
# Liveuser face
efc291
if [ -e /usr/share/icons/hicolor/96x96/apps/fedora-logo-icon.png ] ; then
efc291
    cp /usr/share/icons/hicolor/96x96/apps/fedora-logo-icon.png /home/liveuser/.face
efc291
    chown liveuser:liveuser /home/liveuser/.face
efc291
fi
efc291
efc291
# make the installer show up
efc291
if [ -f /usr/share/applications/liveinst.desktop ]; then
efc291
  # Show harddisk install in shell dash
efc291
  sed -i -e 's/NoDisplay=true/NoDisplay=false/' /usr/share/applications/liveinst.desktop 
efc291
  # need to move it to anaconda.desktop to make shell happy
efc291
  #cp /usr/share/applications/liveinst.desktop /usr/share/applications/anaconda.desktop
efc291
fi
efc291
  cat >> /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override << FOE
efc291
[org.gnome.shell]
efc291
favorite-apps=['liveinst.desktop','firefox.desktop', 'evolution.desktop', 'empathy.desktop', 'rhythmbox.desktop', 'shotwell.desktop', 'libreoffice-writer.desktop', 'nautilus.desktop', 'gnome-documents.desktop', 'anaconda.desktop']
efc291
FOE
efc291
efc291
efc291
# set up auto-login
efc291
cat > /etc/gdm/custom.conf << FOE
efc291
[daemon]
efc291
AutomaticLoginEnable=True
efc291
AutomaticLogin=liveuser
efc291
FOE
efc291
efc291
# Turn off PackageKit-command-not-found while uninstalled
efc291
if [ -f /etc/PackageKit/CommandNotFound.conf ]; then
efc291
  sed -i -e 's/^SoftwareSourceSearch=true/SoftwareSourceSearch=false/' /etc/PackageKit/CommandNotFound.conf
efc291
fi
efc291
efc291
# make sure to set the right permissions and selinux contexts
efc291
chown -R liveuser:liveuser /home/liveuser/
efc291
restorecon -R /home/liveuser/
efc291
efc291
# Fixing default locale to us
efc291
localectl set-keymap us
efc291
localectl set-x11-keymap us
efc291
EOF
efc291
efc291
# rebuild schema cache with any overrides we installed
efc291
glib-compile-schemas /usr/share/glib-2.0/schemas
efc291
efc291
efc291
%end