Advertisement
Guest User

flat kickstart for lmc

a guest
Sep 30th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 9.54 KB | None | 0 0
  1. #version=DEVEL
  2. # X Window System configuration information
  3. xconfig  --startxonboot
  4. # Keyboard layouts
  5. keyboard 'es'
  6. # Use network installation
  7. url --mirrorlist="https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch"
  8. # System language
  9. lang es_AR.UTF-8
  10. # Firewall configuration
  11. firewall --disabled
  12. repo --name="fedora" --mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
  13. repo --name="updates" --mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
  14. # Shutdown after installation
  15. shutdown
  16. # System timezone
  17. timezone America/Argentina/Buenos_Aires
  18. # Network information
  19. network  --bootproto=dhcp --device=link --activate
  20. # System authorization information
  21. auth --useshadow --passalgo=sha512
  22. # SELinux configuration
  23. selinux --disabled
  24.  
  25. # System services
  26. services --disabled="network" --enabled="NetworkManager,ModemManager,sshd"
  27. # System bootloader configuration
  28. bootloader --location=none
  29. # Clear the Master Boot Record
  30. zerombr
  31. # Partition clearing information
  32. clearpart --all
  33. # Disk partitioning information
  34. part / --fstype="ext4" --size=5120
  35.  
  36. %post
  37. # FIXME: it'd be better to get this installed from a package
  38. cat > /etc/rc.d/init.d/livesys << EOF
  39. #!/bin/bash
  40. #
  41. # live: Init script for live image
  42. #
  43. # chkconfig: 345 00 99
  44. # description: Init script for live image.
  45. ### BEGIN INIT INFO
  46. # X-Start-Before: display-manager chronyd
  47. ### END INIT INFO
  48.  
  49. . /etc/init.d/functions
  50.  
  51. if ! strstr "\`cat /proc/cmdline\`" rd.live.image || [ "\$1" != "start" ]; then
  52.     exit 0
  53. fi
  54.  
  55. if [ -e /.liveimg-configured ] ; then
  56.     configdone=1
  57. fi
  58.  
  59. exists() {
  60.     which \$1 >/dev/null 2>&1 || return
  61.     \$*
  62. }
  63.  
  64. livedir="LiveOS"
  65. for arg in \`cat /proc/cmdline\` ; do
  66.   if [ "\${arg##rd.live.dir=}" != "\${arg}" ]; then
  67.     livedir=\${arg##rd.live.dir=}
  68.     return
  69.   fi
  70.   if [ "\${arg##live_dir=}" != "\${arg}" ]; then
  71.     livedir=\${arg##live_dir=}
  72.     return
  73.   fi
  74. done
  75.  
  76. # enable swaps unless requested otherwise
  77. swaps=\`blkid -t TYPE=swap -o device\`
  78. if ! strstr "\`cat /proc/cmdline\`" noswap && [ -n "\$swaps" ] ; then
  79.   for s in \$swaps ; do
  80.     action "Enabling swap partition \$s" swapon \$s
  81.   done
  82. fi
  83. if ! strstr "\`cat /proc/cmdline\`" noswap && [ -f /run/initramfs/live/\${livedir}/swap.img ] ; then
  84.   action "Enabling swap file" swapon /run/initramfs/live/\${livedir}/swap.img
  85. fi
  86.  
  87. mountPersistentHome() {
  88.   # support label/uuid
  89.   if [ "\${homedev##LABEL=}" != "\${homedev}" -o "\${homedev##UUID=}" != "\${homedev}" ]; then
  90.     homedev=\`/sbin/blkid -o device -t "\$homedev"\`
  91.   fi
  92.  
  93.   # if we're given a file rather than a blockdev, loopback it
  94.   if [ "\${homedev##mtd}" != "\${homedev}" ]; then
  95.     # mtd devs don't have a block device but get magic-mounted with -t jffs2
  96.     mountopts="-t jffs2"
  97.   elif [ ! -b "\$homedev" ]; then
  98.     loopdev=\`losetup -f\`
  99.     if [ "\${homedev##/run/initramfs/live}" != "\${homedev}" ]; then
  100.       action "Remounting live store r/w" mount -o remount,rw /run/initramfs/live
  101.     fi
  102.     losetup \$loopdev \$homedev
  103.     homedev=\$loopdev
  104.   fi
  105.  
  106.   # if it's encrypted, we need to unlock it
  107.   if [ "\$(/sbin/blkid -s TYPE -o value \$homedev 2>/dev/null)" = "crypto_LUKS" ]; then
  108.     echo
  109.     echo "Setting up encrypted /home device"
  110.     plymouth ask-for-password --command="cryptsetup luksOpen \$homedev EncHome"
  111.     homedev=/dev/mapper/EncHome
  112.   fi
  113.  
  114.   # and finally do the mount
  115.   mount \$mountopts \$homedev /home
  116.   # if we have /home under what's passed for persistent home, then
  117.   # we should make that the real /home.  useful for mtd device on olpc
  118.   if [ -d /home/home ]; then mount --bind /home/home /home ; fi
  119.   [ -x /sbin/restorecon ] && /sbin/restorecon /home
  120.   if [ -d /home/liveuser ]; then USERADDARGS="-M" ; fi
  121. }
  122.  
  123. findPersistentHome() {
  124.   for arg in \`cat /proc/cmdline\` ; do
  125.     if [ "\${arg##persistenthome=}" != "\${arg}" ]; then
  126.       homedev=\${arg##persistenthome=}
  127.       return
  128.     fi
  129.   done
  130. }
  131.  
  132. if strstr "\`cat /proc/cmdline\`" persistenthome= ; then
  133.   findPersistentHome
  134. elif [ -e /run/initramfs/live/\${livedir}/home.img ]; then
  135.   homedev=/run/initramfs/live/\${livedir}/home.img
  136. fi
  137.  
  138. # if we have a persistent /home, then we want to go ahead and mount it
  139. if ! strstr "\`cat /proc/cmdline\`" nopersistenthome && [ -n "\$homedev" ] ; then
  140.   action "Mounting persistent /home" mountPersistentHome
  141. fi
  142.  
  143. if [ -n "\$configdone" ]; then
  144.   exit 0
  145. fi
  146.  
  147. # add fedora user with no passwd
  148. action "Adding live user" useradd \$USERADDARGS -c "Live System User" liveuser
  149. passwd -d liveuser > /dev/null
  150. usermod -aG wheel liveuser > /dev/null
  151.  
  152. # Remove root password lock
  153. passwd -d root > /dev/null
  154.  
  155. # turn off firstboot for livecd boots
  156. systemctl --no-reload disable firstboot-text.service 2> /dev/null || :
  157. systemctl --no-reload disable firstboot-graphical.service 2> /dev/null || :
  158. systemctl stop firstboot-text.service 2> /dev/null || :
  159. systemctl stop firstboot-graphical.service 2> /dev/null || :
  160.  
  161. # don't use prelink on a running live image
  162. sed -i 's/PRELINKING=yes/PRELINKING=no/' /etc/sysconfig/prelink &>/dev/null || :
  163.  
  164. # turn off mdmonitor by default
  165. systemctl --no-reload disable mdmonitor.service 2> /dev/null || :
  166. systemctl --no-reload disable mdmonitor-takeover.service 2> /dev/null || :
  167. systemctl stop mdmonitor.service 2> /dev/null || :
  168. systemctl stop mdmonitor-takeover.service 2> /dev/null || :
  169.  
  170. # don't enable the gnome-settings-daemon packagekit plugin
  171. gsettings set org.gnome.software download-updates 'false' || :
  172.  
  173. # don't start cron/at as they tend to spawn things which are
  174. # disk intensive that are painful on a live image
  175. systemctl --no-reload disable crond.service 2> /dev/null || :
  176. systemctl --no-reload disable atd.service 2> /dev/null || :
  177. systemctl stop crond.service 2> /dev/null || :
  178. systemctl stop atd.service 2> /dev/null || :
  179.  
  180. # Don't sync the system clock when running live (RHBZ #1018162)
  181. sed -i 's/rtcsync//' /etc/chrony.conf
  182.  
  183. # Mark things as configured
  184. touch /.liveimg-configured
  185.  
  186. # add static hostname to work around xauth bug
  187. # https://bugzilla.redhat.com/show_bug.cgi?id=679486
  188. echo "localhost" > /etc/hostname
  189.  
  190. EOF
  191.  
  192. # bah, hal starts way too late
  193. cat > /etc/rc.d/init.d/livesys-late << EOF
  194. #!/bin/bash
  195. #
  196. # live: Late init script for live image
  197. #
  198. # chkconfig: 345 99 01
  199. # description: Late init script for live image.
  200.  
  201. . /etc/init.d/functions
  202.  
  203. if ! strstr "\`cat /proc/cmdline\`" rd.live.image || [ "\$1" != "start" ] || [ -e /.liveimg-late-configured ] ; then
  204.     exit 0
  205. fi
  206.  
  207. exists() {
  208.     which \$1 >/dev/null 2>&1 || return
  209.     \$*
  210. }
  211.  
  212. touch /.liveimg-late-configured
  213.  
  214. # read some variables out of /proc/cmdline
  215. for o in \`cat /proc/cmdline\` ; do
  216.     case \$o in
  217.     ks=*)
  218.         ks="--kickstart=\${o#ks=}"
  219.         ;;
  220.     xdriver=*)
  221.         xdriver="\${o#xdriver=}"
  222.         ;;
  223.     esac
  224. done
  225.  
  226. # if liveinst or textinst is given, start anaconda
  227. if strstr "\`cat /proc/cmdline\`" liveinst ; then
  228.    plymouth --quit
  229.    /usr/sbin/liveinst \$ks
  230. fi
  231. if strstr "\`cat /proc/cmdline\`" textinst ; then
  232.    plymouth --quit
  233.    /usr/sbin/liveinst --text \$ks
  234. fi
  235.  
  236. # configure X, allowing user to override xdriver
  237. if [ -n "\$xdriver" ]; then
  238.    cat > /etc/X11/xorg.conf.d/00-xdriver.conf <<FOE
  239. Section "Device"
  240.     Identifier  "Videocard0"
  241.     Driver  "\$xdriver"
  242. EndSection
  243. FOE
  244. fi
  245.  
  246. EOF
  247.  
  248. chmod 755 /etc/rc.d/init.d/livesys
  249. /sbin/restorecon /etc/rc.d/init.d/livesys
  250. /sbin/chkconfig --add livesys
  251.  
  252. chmod 755 /etc/rc.d/init.d/livesys-late
  253. /sbin/restorecon /etc/rc.d/init.d/livesys-late
  254. /sbin/chkconfig --add livesys-late
  255.  
  256. # enable tmpfs for /tmp
  257. systemctl enable tmp.mount
  258.  
  259. # make it so that we don't do writing to the overlay for things which
  260. # are just tmpdirs/caches
  261. # note https://bugzilla.redhat.com/show_bug.cgi?id=1135475
  262. cat >> /etc/fstab << EOF
  263. vartmp   /var/tmp    tmpfs   defaults   0  0
  264. EOF
  265.  
  266. # work around for poor key import UI in PackageKit
  267. rm -f /var/lib/rpm/__db*
  268. releasever=$(rpm -q --qf '%{version}\n' --whatprovides system-release)
  269. basearch=$(uname -i)
  270. rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
  271. echo "Packages within this LiveCD"
  272. rpm -qa
  273. # Note that running rpm recreates the rpm db files which aren't needed or wanted
  274. rm -f /var/lib/rpm/__db*
  275.  
  276. # go ahead and pre-make the man -k cache (#455968)
  277. /usr/bin/mandb
  278.  
  279. # make sure there aren't core files lying around
  280. rm -f /core*
  281.  
  282. # remove random seed, the newly installed instance should make it's own
  283. rm -f /var/lib/systemd/random-seed
  284.  
  285. # convince readahead not to collect
  286. # FIXME: for systemd
  287.  
  288. echo 'File created by kickstart. See systemd-update-done.service(8).' \
  289.     | tee /etc/.updated >/var/.updated
  290.  
  291. # Drop the rescue kernel and initramfs, we don't need them on the live media itself.
  292. # See bug 1317709
  293. rm -f /boot/*-rescue*
  294.  
  295. %end
  296.  
  297. %post --nochroot
  298. cp $INSTALL_ROOT/usr/share/licenses/*-release/* $LIVE_ROOT/
  299.  
  300. # only works on x86, x86_64
  301. if [ "$(uname -i)" = "i386" -o "$(uname -i)" = "x86_64" ]; then
  302.   if [ ! -d $LIVE_ROOT/LiveOS ]; then mkdir -p $LIVE_ROOT/LiveOS ; fi
  303.   cp /usr/bin/livecd-iso-to-disk $LIVE_ROOT/LiveOS
  304. fi
  305. %end
  306.  
  307. %packages
  308. @anaconda-tools
  309. @base-x
  310. @core
  311. @dial-up
  312. @fonts
  313. @guest-desktop-agents
  314. @hardware-support
  315. @input-methods
  316. @multimedia
  317. @printing
  318. @standard
  319. aajohan-comfortaa-fonts
  320. anaconda
  321. dracut-live
  322. glibc-all-langpacks
  323. grub2-efi
  324. kernel
  325. kernel-modules
  326. kernel-modules-extra
  327. memtest86+
  328. syslinux
  329. samba
  330. krfb
  331. krdc
  332. @kde-apps
  333. @kde-desktop
  334. @kde-media
  335. @kde-office
  336. @kde-telepathy
  337. @networkmanager-submodules
  338. plasma-nm-openvpn
  339. plasma-nm-pptp
  340. openssh-server
  341.  
  342. %end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement