runtime-postinstall.tmpl 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. ## runtime-postinstall.tmpl
  2. ## post-install setup required to make the system work.
  3. <%page args="root, basearch, libdir, configdir"/>
  4. <%
  5. stubs = ("list-harddrives", "raidstart", "raidstop")
  6. configdir = configdir + "/common"
  7. %>
  8. ## move_stubs()
  9. move usr/share/anaconda/restart-anaconda usr/bin
  10. %for stub in stubs:
  11. -move usr/share/anaconda/${stub}-stub usr/bin/${stub}
  12. %endfor
  13. ## move_repos()
  14. move etc/yum.repos.d etc/anaconda.repos.d
  15. ## Setup mdadm config to turn off homehost
  16. remove etc/mdadm.conf
  17. append etc/mdadm.conf "HOMEHOST <ignore>\n"
  18. ## Configure systemd to start anaconda
  19. remove etc/systemd/system/default.target
  20. symlink /lib/systemd/system/anaconda.target etc/systemd/system/default.target
  21. ## Make sure tmpfs is enabled
  22. mkdir etc/systemd/system/local-fs.target.wants/
  23. symlink /lib/systemd/system/tmp.mount etc/systemd/system/local-fs.target.wants/tmp.mount
  24. ## Disable unwanted systemd services
  25. systemctl disable systemd-readahead-collect.service \
  26. systemd-readahead-replay.service \
  27. mdmonitor.service \
  28. mdmonitor-takeover.service \
  29. lvm2-monitor.service \
  30. dnf-makecache.timer
  31. ## These services can't be disabled normally (they're linked into place in
  32. ## /usr/lib/systemd rather than /etc/systemd), so we have to mask them.
  33. systemctl mask fedora-configure.service fedora-loadmodules.service \
  34. fedora-autorelabel.service fedora-autorelabel-mark.service \
  35. fedora-wait-storage.service media.mount \
  36. systemd-tmpfiles-clean.service systemd-tmpfiles-clean.timer \
  37. ldconfig.service
  38. ## remove because it cannot be disabled
  39. remove usr/lib/systemd/system-generators/lvm2-activation-generator
  40. ## Remove the more terrible parts of systemd-tmpfiles.
  41. ## etc.conf is written with the assumption that /etc/ is empty, which is
  42. ## ridiculous, and it also creates a broken /etc/resolv.conf, which breaks
  43. ## networking.
  44. remove usr/lib/tmpfiles.d/etc.conf
  45. ## Make logind activate anaconda-shell@.service on switch to empty VT
  46. symlink anaconda-shell@.service lib/systemd/system/autovt@.service
  47. replace "#ReserveVT=6" "ReserveVT=2" etc/systemd/logind.conf
  48. ## Don't write the journal to the overlay, just keep it in RAM
  49. remove var/log/journal
  50. ## install some basic configuration files
  51. append etc/fstab ""
  52. install ${configdir}/i18n etc/sysconfig
  53. install ${configdir}/rsyslog.conf etc
  54. install ${configdir}/bash_history root/.bash_history
  55. install ${configdir}/profile root/.profile
  56. install ${configdir}/libuser.conf etc
  57. install ${configdir}/sysctl.conf etc/sysctl.d/anaconda.conf
  58. install ${configdir}/spice-vdagentd etc/sysconfig
  59. mkdir etc/NetworkManager/conf.d
  60. install ${configdir}/91-anaconda-autoconnect-slaves.conf etc/NetworkManager/conf.d
  61. install ${configdir}/vconsole.conf etc
  62. install ${configdir}/92-anaconda-loglevel-debug.conf etc/NetworkManager/conf.d
  63. ## set up sshd
  64. install ${configdir}/sshd_config.anaconda etc/ssh
  65. install ${configdir}/pam.sshd etc/pam.d/sshd
  66. install ${configdir}/pam.sshd etc/pam.d/login
  67. install ${configdir}/pam.sshd etc/pam.d/remote
  68. ## set up "install" user account
  69. append etc/passwd "install:x:0:0:root:/root:/usr/libexec/anaconda/run-anaconda"
  70. append etc/shadow "install::14438:0:99999:7:::"
  71. ## remove root password
  72. replace "root:\*:" "root::" etc/shadow
  73. ## gsettings settings
  74. install ${configdir}/org.gtk.Settings.Debug.gschema.override usr/share/glib-2.0/schemas
  75. runcmd chroot ${root} glib-compile-schemas /usr/share/glib-2.0/schemas
  76. move usr/libexec/anaconda/auditd sbin
  77. ## for compatibility with Ancient Anaconda Traditions
  78. symlink lib/modules /modules
  79. symlink lib/firmware /firmware
  80. symlink ../run/install mnt/install
  81. ## create_depmod_conf()
  82. append etc/depmod.d/dd.conf "search updates built-in"
  83. ## create multipath.conf so multipath gets auto-started
  84. append etc/multipath.conf "defaults {\n\tfind_multipaths smart\n\tuser_friendly_names yes\n}\n"
  85. ## make lvm auto-activate
  86. remove etc/lvm/archive/*
  87. remove etc/lvm/archive
  88. remove etc/lvm/backup/*
  89. remove etc/lvm/backup
  90. remove etc/lvm/cache/*
  91. remove etc/lvm/cache
  92. remove etc/lvm/lvm.conf
  93. append etc/lvm/lvm.conf "global {\n\tuse_lvmetad = 1\n}\n"
  94. ## Remove machine specific nvme-cli files
  95. remove etc/nvme/hostid
  96. remove etc/nvme/hostnqn
  97. ## Record the package versions used to create the image
  98. ## rpm initializes nss, which requires /dev/urandom to be present, hence the mknod
  99. runcmd chroot ${root} /usr/bin/mknod -m 666 /dev/random c 1 8
  100. runcmd chroot ${root} /usr/bin/mknod -m 666 /dev/urandom c 1 9
  101. runcmd chroot ${root} /usr/bin/rpm -qa --pipe "tee /root/lorax-packages.log"
  102. ## TODO: we could run prelink here if we wanted?