figless / centos / livemedia

Forked from centos/livemedia 4 years ago
Clone

Blame kickstarts/centos-8-livecd-gnome.cfg

ebdb22
lang en_US.UTF-8
ebdb22
keyboard us
ebdb22
timezone US/Eastern
ebdb22
auth --useshadow --passalgo=sha512
ebdb22
selinux --enforcing
ebdb22
firewall --enabled --service=mdns
ebdb22
xconfig --startxonboot
ebdb22
zerombr
ebdb22
clearpart --all
ebdb22
part / --size 10240 --fstype ext4
ebdb22
services --enabled=NetworkManager,ModemManager --disabled=sshd
ebdb22
network --bootproto=dhcp --device=link --activate
ebdb22
rootpw --lock --iscrypted locked
ebdb22
shutdown
ebdb22
ebdb22
url --url http://linuxsoft.cern.ch/centos/8/BaseOS/x86_64/kickstart/
ebdb22
ebdb22
%packages
ebdb22
@base
ebdb22
@core
ebdb22
@dial-up
ebdb22
@fonts
ebdb22
@gnome-desktop
ebdb22
@guest-agents
ebdb22
@guest-desktop-agents
ebdb22
@input-methods
ebdb22
@internet-browser
ebdb22
@java-platform
ebdb22
@multimedia
ebdb22
@network-file-system-client
ebdb22
@print-client
ebdb22
@internet-applications
ebdb22
@office-suite
ebdb22
@remote-desktop-clients
ebdb22
@gnome-apps
ebdb22
-libvirt
ebdb22
-gnome-boxes
ebdb22
dracut-live
ebdb22
grubby
ebdb22
ebdb22
#Live install tools
ebdb22
anaconda
ebdb22
firefox
ebdb22
patch
ebdb22
ebdb22
# For UEFI/Secureboot support
ebdb22
grub2
ebdb22
grub2-efi
ebdb22
grub2-efi-x64-cdboot
ebdb22
efibootmgr
ebdb22
shim
ebdb22
ebdb22
# required for lorax-lmc to build iso correctly
ebdb22
syslinux
ebdb22
memtest86+
ebdb22
ebdb22
%end
ebdb22
ebdb22
%post
ebdb22
# FIXME: it'd be better to get this installed from a package
ebdb22
cat > /etc/rc.d/init.d/livesys << EOF
ebdb22
#!/bin/bash
ebdb22
#
ebdb22
# live: Init script for live image
ebdb22
#
ebdb22
# chkconfig: 345 00 99
ebdb22
# description: Init script for live image.
ebdb22
### BEGIN INIT INFO
ebdb22
# X-Start-Before: display-manager
ebdb22
### END INIT INFO
ebdb22
ebdb22
. /etc/init.d/functions
ebdb22
ebdb22
if ! strstr "\`cat /proc/cmdline\`" rd.live.image || [ "\$1" != "start" ]; then
ebdb22
    exit 0
ebdb22
fi
ebdb22
ebdb22
if [ -e /.liveimg-configured ] ; then
ebdb22
    configdone=1
ebdb22
fi
ebdb22
ebdb22
exists() {
ebdb22
    which \$1 >/dev/null 2>&1 || return
ebdb22
    \$*
ebdb22
}
ebdb22
ebdb22
# Make sure we don't mangle the hardware clock on shutdown
ebdb22
ln -sf /dev/null /etc/systemd/system/hwclock-save.service
ebdb22
ebdb22
livedir="LiveOS"
ebdb22
for arg in \`cat /proc/cmdline\` ; do
ebdb22
  if [ "\${arg##rd.live.dir=}" != "\${arg}" ]; then
ebdb22
    livedir=\${arg##rd.live.dir=}
ebdb22
    return
ebdb22
  fi
ebdb22
  if [ "\${arg##live_dir=}" != "\${arg}" ]; then
ebdb22
    livedir=\${arg##live_dir=}
ebdb22
    return
ebdb22
  fi
ebdb22
done
ebdb22
ebdb22
# enable swaps unless requested otherwise
ebdb22
swaps=\`blkid -t TYPE=swap -o device\`
ebdb22
if ! strstr "\`cat /proc/cmdline\`" noswap && [ -n "\$swaps" ] ; then
ebdb22
  for s in \$swaps ; do
ebdb22
    action "Enabling swap partition \$s" swapon \$s
ebdb22
  done
ebdb22
fi
ebdb22
if ! strstr "\`cat /proc/cmdline\`" noswap && [ -f /run/initramfs/live/\${livedir}/swap.img ] ; then
ebdb22
  action "Enabling swap file" swapon /run/initramfs/live/\${livedir}/swap.img
ebdb22
fi
ebdb22
ebdb22
mountPersistentHome() {
ebdb22
  # support label/uuid
ebdb22
  if [ "\${homedev##LABEL=}" != "\${homedev}" -o "\${homedev##UUID=}" != "\${homedev}" ]; then
ebdb22
    homedev=\`/sbin/blkid -o device -t "\$homedev"\`
ebdb22
  fi
ebdb22
ebdb22
  # if we're given a file rather than a blockdev, loopback it
ebdb22
  if [ "\${homedev##mtd}" != "\${homedev}" ]; then
ebdb22
    # mtd devs don't have a block device but get magic-mounted with -t jffs2
ebdb22
    mountopts="-t jffs2"
ebdb22
  elif [ ! -b "\$homedev" ]; then
ebdb22
    loopdev=\`losetup -f\`
ebdb22
    if [ "\${homedev##/run/initramfs/live}" != "\${homedev}" ]; then
ebdb22
      action "Remounting live store r/w" mount -o remount,rw /run/initramfs/live
ebdb22
    fi
ebdb22
    losetup \$loopdev \$homedev
ebdb22
    homedev=\$loopdev
ebdb22
  fi
ebdb22
ebdb22
  # if it's encrypted, we need to unlock it
ebdb22
  if [ "\$(/sbin/blkid -s TYPE -o value \$homedev 2>/dev/null)" = "crypto_LUKS" ]; then
ebdb22
    echo
ebdb22
    echo "Setting up encrypted /home device"
ebdb22
    plymouth ask-for-password --command="cryptsetup luksOpen \$homedev EncHome"
ebdb22
    homedev=/dev/mapper/EncHome
ebdb22
  fi
ebdb22
ebdb22
  # and finally do the mount
ebdb22
  mount \$mountopts \$homedev /home
ebdb22
  # if we have /home under what's passed for persistent home, then
ebdb22
  # we should make that the real /home.  useful for mtd device on olpc
ebdb22
  if [ -d /home/home ]; then mount --bind /home/home /home ; fi
ebdb22
  [ -x /sbin/restorecon ] && /sbin/restorecon /home
ebdb22
  if [ -d /home/liveuser ]; then USERADDARGS="-M" ; fi
ebdb22
}
ebdb22
ebdb22
findPersistentHome() {
ebdb22
  for arg in \`cat /proc/cmdline\` ; do
ebdb22
    if [ "\${arg##persistenthome=}" != "\${arg}" ]; then
ebdb22
      homedev=\${arg##persistenthome=}
ebdb22
      return
ebdb22
    fi
ebdb22
  done
ebdb22
}
ebdb22
ebdb22
if strstr "\`cat /proc/cmdline\`" persistenthome= ; then
ebdb22
  findPersistentHome
ebdb22
elif [ -e /run/initramfs/live/\${livedir}/home.img ]; then
ebdb22
  homedev=/run/initramfs/live/\${livedir}/home.img
ebdb22
fi
ebdb22
ebdb22
# if we have a persistent /home, then we want to go ahead and mount it
ebdb22
if ! strstr "\`cat /proc/cmdline\`" nopersistenthome && [ -n "\$homedev" ] ; then
ebdb22
  action "Mounting persistent /home" mountPersistentHome
ebdb22
fi
ebdb22
ebdb22
# make it so that we don't do writing to the overlay for things which
ebdb22
# are just tmpdirs/caches
ebdb22
mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum
ebdb22
mount -t tmpfs vartmp /var/tmp
ebdb22
[ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /var/tmp >/dev/null 2>&1
ebdb22
ebdb22
if [ -n "\$configdone" ]; then
ebdb22
  exit 0
ebdb22
fi
ebdb22
ebdb22
# add fedora user with no passwd
ebdb22
action "Adding live user" useradd \$USERADDARGS -c "Live System User" liveuser
ebdb22
passwd -d liveuser > /dev/null
ebdb22
usermod -aG wheel liveuser > /dev/null
ebdb22
ebdb22
# Remove root password lock
ebdb22
passwd -d root > /dev/null
ebdb22
ebdb22
# turn off firstboot for livecd boots
ebdb22
systemctl --no-reload disable firstboot-text.service 2> /dev/null || :
ebdb22
systemctl --no-reload disable firstboot-graphical.service 2> /dev/null || :
ebdb22
systemctl stop firstboot-text.service 2> /dev/null || :
ebdb22
systemctl stop firstboot-graphical.service 2> /dev/null || :
ebdb22
ebdb22
# don't use prelink on a running live image
ebdb22
sed -i 's/PRELINKING=yes/PRELINKING=no/' /etc/sysconfig/prelink &>/dev/null || :
ebdb22
ebdb22
# turn off mdmonitor by default
ebdb22
systemctl --no-reload disable mdmonitor.service 2> /dev/null || :
ebdb22
systemctl --no-reload disable mdmonitor-takeover.service 2> /dev/null || :
ebdb22
systemctl stop mdmonitor.service 2> /dev/null || :
ebdb22
systemctl stop mdmonitor-takeover.service 2> /dev/null || :
ebdb22
ebdb22
# don't enable the gnome-settings-daemon packagekit plugin
ebdb22
gsettings set org.gnome.settings-daemon.plugins.updates active 'false' || :
ebdb22
ebdb22
# don't start cron/at as they tend to spawn things which are
ebdb22
# disk intensive that are painful on a live image
ebdb22
systemctl --no-reload disable crond.service 2> /dev/null || :
ebdb22
systemctl --no-reload disable atd.service 2> /dev/null || :
ebdb22
systemctl stop crond.service 2> /dev/null || :
ebdb22
systemctl stop atd.service 2> /dev/null || :
ebdb22
ebdb22
# Mark things as configured
ebdb22
touch /.liveimg-configured
ebdb22
ebdb22
# add static hostname to work around xauth bug
ebdb22
# https://bugzilla.redhat.com/show_bug.cgi?id=679486
ebdb22
echo "localhost" > /etc/hostname
ebdb22
ebdb22
# Fixing the lang install issue when other lang than English is selected . See http://bugs.centos.org/view.php?id=7217
ebdb22
#/usr/bin/cp /usr/lib/python2.7/site-packages/blivet/size.py /usr/lib/python2.7/site-packages/blivet/size.py.orig
ebdb22
#/usr/bin/sed -i "s#return self.humanReadable()#return self.humanReadable().encode('utf-8')#g" /usr/lib/python2.7/site-packages/blivet/size.py
ebdb22
ebdb22
# Fixing *huge* icons size in gnoe 3.22 due to "design" decision
ebdb22
# https://bugs.centos.org/view.php?id=13768
ebdb22
cat > /etc/dconf/db/distro.d/99-gnome-icon-size << FOE
ebdb22
# To set gnome icon size to small by default
ebdb22
[org/gnome/nautilus/icon-view]
ebdb22
default-zoom-level='small'
ebdb22
FOE
ebdb22
ebdb22
cat > /etc/dconf/db/distro.d/99-disable-gnome-software-download << FOE
ebdb22
# Don't allow gnome software to eat cpu on live session
ebdb22
[org/gnome/software]
ebdb22
download-updates=false
ebdb22
FOE
ebdb22
ebdb22
ebdb22
/usr/bin/dconf update
ebdb22
ebdb22
# Enforcing tracker indexing service to *not* start on Live Media as it uses all CPU and so conflict with proper operation including liveinst
ebdb22
for file in /etc/xdg/autostart/tracker*.desktop ; do sed -i s/X-GNOME-Autostart-enabled=true/X-GNOME-Autostart-enabled=false/g $file ; done
ebdb22
ebdb22
ebdb22
EOF
ebdb22
ebdb22
ebdb22
ebdb22
# bah, hal starts way too late
ebdb22
cat > /etc/rc.d/init.d/livesys-late << EOF
ebdb22
#!/bin/bash
ebdb22
#
ebdb22
# live: Late init script for live image
ebdb22
#
ebdb22
# chkconfig: 345 99 01
ebdb22
# description: Late init script for live image.
ebdb22
ebdb22
. /etc/init.d/functions
ebdb22
ebdb22
if ! strstr "\`cat /proc/cmdline\`" rd.live.image || [ "\$1" != "start" ] || [ -e /.liveimg-late-configured ] ; then
ebdb22
    exit 0
ebdb22
fi
ebdb22
ebdb22
exists() {
ebdb22
    which \$1 >/dev/null 2>&1 || return
ebdb22
    \$*
ebdb22
}
ebdb22
ebdb22
touch /.liveimg-late-configured
ebdb22
ebdb22
# read some variables out of /proc/cmdline
ebdb22
for o in \`cat /proc/cmdline\` ; do
ebdb22
    case \$o in
ebdb22
    ks=*)
ebdb22
        ks="--kickstart=\${o#ks=}"
ebdb22
        ;;
ebdb22
    xdriver=*)
ebdb22
        xdriver="\${o#xdriver=}"
ebdb22
        ;;
ebdb22
    esac
ebdb22
done
ebdb22
ebdb22
# if liveinst or textinst is given, start anaconda
ebdb22
if strstr "\`cat /proc/cmdline\`" liveinst ; then
ebdb22
   plymouth --quit
ebdb22
   /usr/sbin/liveinst \$ks
ebdb22
fi
ebdb22
if strstr "\`cat /proc/cmdline\`" textinst ; then
ebdb22
   plymouth --quit
ebdb22
   /usr/sbin/liveinst --text \$ks
ebdb22
fi
ebdb22
ebdb22
# configure X, allowing user to override xdriver
ebdb22
if [ -n "\$xdriver" ]; then
ebdb22
   cat > /etc/X11/xorg.conf.d/00-xdriver.conf <
ebdb22
Section "Device"
ebdb22
	Identifier	"Videocard0"
ebdb22
	Driver	"\$xdriver"
ebdb22
EndSection
ebdb22
FOE
ebdb22
fi
ebdb22
ebdb22
EOF
ebdb22
ebdb22
chmod 755 /etc/rc.d/init.d/livesys
ebdb22
/sbin/restorecon /etc/rc.d/init.d/livesys
ebdb22
/sbin/chkconfig --add livesys
ebdb22
ebdb22
chmod 755 /etc/rc.d/init.d/livesys-late
ebdb22
/sbin/restorecon /etc/rc.d/init.d/livesys-late
ebdb22
/sbin/chkconfig --add livesys-late
ebdb22
ebdb22
# Patching liveinst https://bugzilla.redhat.com/show_bug.cgi?id=1622248
ebdb22
sed -i 's#^ANACONDA=.*#ANACONDA="${LIVECMD:=anaconda --liveinst --method=livecd:${LIVE_BLOCK}}"#' /usr/sbin/liveinst
ebdb22
ebdb22
# Patching pyanaconda/payload/source/sources.py https://bugzilla.redhat.com/show_bug.cgi?id=1622248
ebdb22
cat >> /tmp/sources.py.patch << 'EOF'
ebdb22
ebdb22
--- /usr/lib64/python3.6/site-packages/pyanaconda/payload/source/sources.py.orig        2018-11-08 10:54:59.000000000 +0000
ebdb22
+++ /usr/lib64/python3.6/site-packages/pyanaconda/payload/source/sources.py     2019-10-30 07:55:30.506944400 +0000
ebdb22
@@ -22,7 +22,7 @@
ebdb22
ebdb22
 class SourceType(Enum):
ebdb22
     CDROM = "cdrom"
ebdb22
-    HARDDRIVE = "Harddrive"
ebdb22
+    HARDDRIVE = "harddrive"
ebdb22
     NFS = "nfs"
ebdb22
     HTTP = "http"
ebdb22
     HTTPS = "https"
ebdb22
@@ -280,7 +280,7 @@
ebdb22
     """Source object for live image sources."""
ebdb22
ebdb22
     def __init__(self, partition):
ebdb22
-        super().__init__(SourceType.LIVECD, "livecd")
ebdb22
+        super().__init__(SourceType.LIVECD, "harddrive")
ebdb22
ebdb22
         self._partition = partition
ebdb22
ebdb22
EOF
ebdb22
patch -p0 /usr/lib64/python3.6/site-packages/pyanaconda/payload/source/sources.py /tmp/sources.py.patch
ebdb22
ebdb22
# enable tmpfs for /tmp
ebdb22
systemctl enable tmp.mount
ebdb22
ebdb22
# work around for poor key import UI in PackageKit
ebdb22
rm -f /var/lib/rpm/__db*
ebdb22
releasever=$(rpm -q --qf '%{version}\n' --whatprovides system-release)
ebdb22
basearch=$(uname -i)
ebdb22
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
ebdb22
echo "Packages within this LiveCD"
ebdb22
rpm -qa
ebdb22
# Note that running rpm recreates the rpm db files which aren't needed or wanted
ebdb22
rm -f /var/lib/rpm/__db*
ebdb22
ebdb22
# go ahead and pre-make the man -k cache (#455968)
ebdb22
/usr/bin/mandb
ebdb22
ebdb22
# save a little bit of space at least...
ebdb22
rm -f /boot/initramfs*
ebdb22
# make sure there aren't core files lying around
ebdb22
rm -f /core*
ebdb22
ebdb22
# convince readahead not to collect
ebdb22
# FIXME: for systemd
ebdb22
ebdb22
cat >> /etc/rc.d/init.d/livesys << EOF
ebdb22
ebdb22
ebdb22
# disable updates plugin
ebdb22
cat >> /usr/share/glib-2.0/schemas/org.gnome.settings-daemon.plugins.updates.gschema.override << FOE
ebdb22
[org.gnome.settings-daemon.plugins.updates]
ebdb22
active=false
ebdb22
FOE
ebdb22
ebdb22
# Show the system-config-keyboard tool on the desktop
ebdb22
mkdir /home/liveuser/Desktop -p >/dev/null
ebdb22
cat /usr/share/applications/system-config-keyboard.desktop | sed '/NotShowIn/d' |sed 's/Terminal=false/Terminal=true/' > /home/liveuser/Desktop/system-config-keyboard.desktop
ebdb22
cat /usr/share/applications/liveinst.desktop | sed '/NoDisplay/d' > /home/liveuser/Desktop/liveinst.desktop 
ebdb22
chmod +x /home/liveuser/Desktop/*.desktop
ebdb22
chown -R liveuser:liveuser /home/liveuser
ebdb22
ebdb22
# Liveuser face
ebdb22
if [ -e /usr/share/icons/hicolor/96x96/apps/fedora-logo-icon.png ] ; then
ebdb22
    cp /usr/share/icons/hicolor/96x96/apps/fedora-logo-icon.png /home/liveuser/.face
ebdb22
    chown liveuser:liveuser /home/liveuser/.face
ebdb22
fi
ebdb22
ebdb22
# make the installer show up
ebdb22
if [ -f /usr/share/applications/liveinst.desktop ]; then
ebdb22
  # Show harddisk install in shell dash
ebdb22
  sed -i -e 's/NoDisplay=true/NoDisplay=false/' /usr/share/applications/liveinst.desktop 
ebdb22
  # need to move it to anaconda.desktop to make shell happy
ebdb22
  #cp /usr/share/applications/liveinst.desktop /usr/share/applications/anaconda.desktop
ebdb22
fi
ebdb22
  cat >> /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override << FOE
ebdb22
[org.gnome.shell]
ebdb22
favorite-apps=['liveinst.desktop','firefox.desktop', 'evolution.desktop', 'empathy.desktop', 'rhythmbox.desktop', 'shotwell.desktop', 'libreoffice-writer.desktop', 'nautilus.desktop', 'gnome-documents.desktop', 'anaconda.desktop']
ebdb22
FOE
ebdb22
ebdb22
ebdb22
# set up auto-login
ebdb22
cat > /etc/gdm/custom.conf << FOE
ebdb22
[daemon]
ebdb22
AutomaticLoginEnable=True
ebdb22
AutomaticLogin=liveuser
ebdb22
FOE
ebdb22
ebdb22
# Turn off PackageKit-command-not-found while uninstalled
ebdb22
if [ -f /etc/PackageKit/CommandNotFound.conf ]; then
ebdb22
  sed -i -e 's/^SoftwareSourceSearch=true/SoftwareSourceSearch=false/' /etc/PackageKit/CommandNotFound.conf
ebdb22
fi
ebdb22
ebdb22
# make sure to set the right permissions and selinux contexts
ebdb22
chown -R liveuser:liveuser /home/liveuser/
ebdb22
restorecon -R /home/liveuser/
ebdb22
ebdb22
# Fixing default locale to us
ebdb22
localectl set-keymap us
ebdb22
localectl set-x11-keymap us
ebdb22
EOF
ebdb22
ebdb22
# rebuild schema cache with any overrides we installed
ebdb22
glib-compile-schemas /usr/share/glib-2.0/schemas
ebdb22
ebdb22
ebdb22
%end