core-vm.spec 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. #
  2. # The Qubes OS Project, http://www.qubes-os.org
  3. #
  4. # Copyright (C) 2010 Joanna Rutkowska <joanna@invisiblethingslab.com>
  5. # Copyright (C) 2010 Rafal Wojtczuk <rafal@invisiblethingslab.com>
  6. #
  7. # This program is free software; you can redistribute it and/or
  8. # modify it under the terms of the GNU General Public License
  9. # as published by the Free Software Foundation; either version 2
  10. # of the License, or (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  20. #
  21. #
  22. %{!?version: %define version %(cat version)}
  23. Name: qubes-core-vm
  24. Version: %{version}
  25. Release: 1.1%{dist}
  26. Summary: The Qubes core files for VM
  27. Group: Qubes
  28. Vendor: Invisible Things Lab
  29. License: GPL
  30. URL: http://www.qubes-os.org
  31. Requires: /usr/bin/xenstore-read
  32. Requires: fedora-release
  33. Requires: yum-plugin-post-transaction-actions
  34. Requires: NetworkManager >= 0.8.1-1
  35. %if %{fedora} >= 18
  36. # Fedora >= 18 defaults to firewalld, which isn't supported nor needed by Qubes
  37. Requires: iptables-services
  38. Conflicts: firewalld
  39. %endif
  40. Requires: /usr/bin/mimeopen
  41. Requires: ethtool
  42. Requires: tinyproxy
  43. Requires: ntpdate
  44. Requires: net-tools
  45. Requires: nautilus-actions
  46. Requires: qubes-core-vm-kernel-placeholder
  47. Requires: qubes-utils
  48. Provides: qubes-core-vm
  49. Obsoletes: qubes-core-commonvm
  50. Obsoletes: qubes-core-appvm
  51. Obsoletes: qubes-core-netvm
  52. Obsoletes: qubes-core-proxyvm
  53. Obsoletes: qubes-upgrade-vm < 2.0
  54. BuildRequires: xen-devel
  55. BuildRequires: qubes-utils-devel
  56. %define _builddir %(pwd)
  57. %define kde_service_dir /usr/share/kde4/services
  58. %description
  59. The Qubes core files for installation inside a Qubes VM.
  60. %prep
  61. # we operate on the current directory, so no need to unpack anything
  62. # symlink is to generate useful debuginfo packages
  63. rm -f %{name}-%{version}
  64. ln -sf . %{name}-%{version}
  65. %setup -T -D
  66. %build
  67. for dir in qubes-rpc qrexec misc; do
  68. (cd $dir; make)
  69. done
  70. %pre
  71. if [ "$1" != 1 ] ; then
  72. # do this whole %pre thing only when updating for the first time...
  73. exit 0
  74. fi
  75. mkdir -p /var/lib/qubes
  76. if [ -e /etc/fstab ] ; then
  77. mv /etc/fstab /var/lib/qubes/fstab.orig
  78. fi
  79. adduser --create-home user
  80. %install
  81. (cd qrexec; make install DESTDIR=$RPM_BUILD_ROOT)
  82. make install-vm DESTDIR=$RPM_BUILD_ROOT
  83. %triggerin -- initscripts
  84. cp /usr/lib/qubes/serial.conf /etc/init/serial.conf
  85. %post
  86. # disable some Upstart services
  87. for F in plymouth-shutdown prefdm splash-manager start-ttys tty ; do
  88. if [ -e /etc/init/$F.conf ]; then
  89. mv -f /etc/init/$F.conf /etc/init/$F.conf.disabled
  90. fi
  91. done
  92. remove_ShowIn () {
  93. if [ -e /etc/xdg/autostart/$1.desktop ]; then
  94. sed -i '/^\(Not\|Only\)ShowIn/d' /etc/xdg/autostart/$1.desktop
  95. fi
  96. }
  97. # don't want it at all
  98. for F in abrt-applet deja-dup-monitor imsettings-start krb5-auth-dialog pulseaudio restorecond sealertauto gnome-power-manager gnome-sound-applet gnome-screensaver orca-autostart; do
  99. if [ -e /etc/xdg/autostart/$F.desktop ]; then
  100. remove_ShowIn $F
  101. echo 'NotShowIn=QUBES;' >> /etc/xdg/autostart/$F.desktop
  102. fi
  103. done
  104. # don't want it in DisposableVM
  105. for F in gcm-apply ; do
  106. if [ -e /etc/xdg/autostart/$F.desktop ]; then
  107. remove_ShowIn $F
  108. echo 'NotShowIn=DisposableVM;' >> /etc/xdg/autostart/$F.desktop
  109. fi
  110. done
  111. # want it in AppVM only
  112. for F in gnome-keyring-gpg gnome-keyring-pkcs11 gnome-keyring-secrets gnome-keyring-ssh gnome-settings-daemon user-dirs-update-gtk gsettings-data-convert ; do
  113. if [ -e /etc/xdg/autostart/$F.desktop ]; then
  114. remove_ShowIn $F
  115. echo 'OnlyShowIn=GNOME;AppVM;' >> /etc/xdg/autostart/$F.desktop
  116. fi
  117. done
  118. # remove existing rule to add own later
  119. for F in gpk-update-icon nm-applet ; do
  120. remove_ShowIn $F
  121. done
  122. echo 'OnlyShowIn=GNOME;UpdateableVM;' >> /etc/xdg/autostart/gpk-update-icon.desktop || :
  123. echo 'OnlyShowIn=GNOME;NetVM;' >> /etc/xdg/autostart/nm-applet.desktop || :
  124. usermod -p '' root
  125. usermod -L user
  126. # Create NetworkManager configuration if we do not have it
  127. if ! [ -e /etc/NetworkManager/NetworkManager.conf ]; then
  128. echo '[main]' > /etc/NetworkManager/NetworkManager.conf
  129. echo 'plugins = keyfile' >> /etc/NetworkManager/NetworkManager.conf
  130. echo '[keyfile]' >> /etc/NetworkManager/NetworkManager.conf
  131. fi
  132. /usr/lib/qubes/qubes-fix-nm-conf.sh
  133. # Remove ip_forward setting from sysctl, so NM will not reset it
  134. sed 's/^net.ipv4.ip_forward.*/#\0/' -i /etc/sysctl.conf
  135. # Install firmware link only on system which haven't it yet
  136. if ! [ -e /lib/firmware/updates ]; then
  137. ln -s /lib/modules/firmware /lib/firmware/updates
  138. fi
  139. if ! grep -q '/etc/yum\.conf\.d/qubes-proxy\.conf' /etc/yum.conf; then
  140. echo >> /etc/yum.conf
  141. echo '# Yum does not support inclusion of config dir...' >> /etc/yum.conf
  142. echo 'include=file:///etc/yum.conf.d/qubes-proxy.conf' >> /etc/yum.conf
  143. fi
  144. # Revert 'Prevent unnecessary updates in VMs':
  145. sed -i -e '/^exclude = kernel/d' /etc/yum.conf
  146. # qubes-core-vm has been broken for some time - it overrides /etc/hosts; restore original content
  147. if ! grep -q localhost /etc/hosts; then
  148. cat <<EOF > /etc/hosts
  149. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 `hostname`
  150. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  151. EOF
  152. fi
  153. if [ "$1" != 1 ] ; then
  154. # do the rest of %post thing only when updating for the first time...
  155. exit 0
  156. fi
  157. if [ -e /etc/init/serial.conf ] && ! [ -f /var/lib/qubes/serial.orig ] ; then
  158. cp /etc/init/serial.conf /var/lib/qubes/serial.orig
  159. fi
  160. #echo "--> Disabling SELinux..."
  161. sed -e s/^SELINUX=.*$/SELINUX=disabled/ </etc/selinux/config >/etc/selinux/config.processed
  162. mv /etc/selinux/config.processed /etc/selinux/config
  163. setenforce 0 2>/dev/null
  164. # Remove most of the udev scripts to speed up the VM boot time
  165. # Just leave the xen* scripts, that are needed if this VM was
  166. # ever used as a net backend (e.g. as a VPN domain in the future)
  167. #echo "--> Removing unnecessary udev scripts..."
  168. mkdir -p /var/lib/qubes/removed-udev-scripts
  169. for f in /etc/udev/rules.d/*
  170. do
  171. if [ $(basename $f) == "xen-backend.rules" ] ; then
  172. continue
  173. fi
  174. if [ $(basename $f) == "50-qubes-misc.rules" ] ; then
  175. continue
  176. fi
  177. if echo $f | grep -q qubes; then
  178. continue
  179. fi
  180. mv $f /var/lib/qubes/removed-udev-scripts/
  181. done
  182. mkdir -p /rw
  183. #rm -f /etc/mtab
  184. #echo "--> Removing HWADDR setting from /etc/sysconfig/network-scripts/ifcfg-eth0"
  185. #mv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.orig
  186. #grep -v HWADDR /etc/sysconfig/network-scripts/ifcfg-eth0.orig > /etc/sysconfig/network-scripts/ifcfg-eth0
  187. %preun
  188. if [ "$1" = 0 ] ; then
  189. # no more packages left
  190. if [ -e /var/lib/qubes/fstab.orig ] ; then
  191. mv /var/lib/qubes/fstab.orig /etc/fstab
  192. fi
  193. mv /var/lib/qubes/removed-udev-scripts/* /etc/udev/rules.d/
  194. if [ -e /var/lib/qubes/serial.orig ] ; then
  195. mv /var/lib/qubes/serial.orig /etc/init/serial.conf
  196. fi
  197. fi
  198. %postun
  199. if [ $1 -eq 0 ] ; then
  200. /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
  201. if [ -l /lib/firmware/updates ]; then
  202. rm /lib/firmware/updates
  203. fi
  204. fi
  205. %posttrans
  206. /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
  207. %clean
  208. rm -rf $RPM_BUILD_ROOT
  209. rm -f %{name}-%{version}
  210. %files
  211. %defattr(-,root,root,-)
  212. %dir /var/lib/qubes
  213. %dir /var/run/qubes
  214. %dir %attr(0775,user,user) /var/lib/qubes/dom0-updates
  215. %{kde_service_dir}/qvm-copy.desktop
  216. %{kde_service_dir}/qvm-dvm.desktop
  217. /etc/NetworkManager/dispatcher.d/30-qubes-external-ip
  218. /etc/NetworkManager/dispatcher.d/qubes-nmhook
  219. /etc/X11/xorg-preload-apps.conf
  220. /etc/dispvm-dotfiles.tbz
  221. /etc/dhclient.d/qubes-setup-dnat-to-ns.sh
  222. /etc/fstab
  223. /etc/pki/rpm-gpg/RPM-GPG-KEY-qubes*
  224. /etc/polkit-1/localauthority/50-local.d/qubes-allow-all.pkla
  225. /etc/polkit-1/rules.d/00-qubes-allow-all.rules
  226. %dir /etc/qubes-rpc
  227. /etc/qubes-rpc/qubes.Filecopy
  228. /etc/qubes-rpc/qubes.OpenInVM
  229. /etc/qubes-rpc/qubes.GetAppmenus
  230. /etc/qubes-rpc/qubes.VMShell
  231. /etc/qubes-rpc/qubes.SyncNtpClock
  232. /etc/qubes-rpc/qubes.SuspendPre
  233. /etc/qubes-rpc/qubes.SuspendPost
  234. /etc/qubes-rpc/qubes.WaitForSession
  235. /etc/qubes-rpc/qubes.DetachPciDevice
  236. /etc/qubes-rpc/qubes.Backup
  237. /etc/qubes-rpc/qubes.Restore
  238. /etc/sudoers.d/qubes
  239. %config(noreplace) /etc/sysconfig/iptables
  240. %config(noreplace) /etc/sysconfig/ip6tables
  241. /etc/sysconfig/modules/qubes-core.modules
  242. /etc/sysconfig/modules/qubes-misc.modules
  243. %config(noreplace) /etc/tinyproxy/filter-qubes-yum
  244. %config(noreplace) /etc/tinyproxy/tinyproxy-qubes-yum.conf
  245. /etc/udev/rules.d/50-qubes-misc.rules
  246. /etc/udev/rules.d/99-qubes-network.rules
  247. /etc/xdg/nautilus-actions/nautilus-actions.conf
  248. /etc/xen/scripts/vif-route-qubes
  249. %config(noreplace) /etc/yum.conf.d/qubes-proxy.conf
  250. %config(noreplace) /etc/yum.repos.d/qubes-r2-beta2.repo
  251. %config(noreplace) /etc/yum.repos.d/qubes-r2-beta3.repo
  252. /etc/yum/pluginconf.d/yum-qubes-hooks.conf
  253. /etc/yum/post-actions/qubes-trigger-sync-appmenus.action
  254. /usr/sbin/qubes-serial-login
  255. /usr/bin/qvm-copy-to-vm
  256. /usr/bin/qvm-open-in-dvm
  257. /usr/bin/qvm-open-in-vm
  258. /usr/bin/qvm-run
  259. /usr/bin/qvm-mru-entry
  260. /usr/bin/xenstore-watch-qubes
  261. %dir /usr/lib/qubes
  262. /usr/lib/qubes/vusb-ctl.py*
  263. /usr/lib/qubes/dispvm-prerun.sh
  264. /usr/lib/qubes/sync-ntp-clock
  265. /usr/lib/qubes/prepare-suspend
  266. /usr/lib/qubes/network-manager-prepare-conf-dir
  267. /usr/lib/qubes/qrexec-agent
  268. /usr/lib/qubes/qrexec-client-vm
  269. /usr/lib/qubes/qrexec_client_vm
  270. /usr/lib/qubes/qubes-rpc-multiplexer
  271. /usr/lib/qubes/qfile-agent
  272. %attr(4755,root,root) /usr/lib/qubes/qfile-unpacker
  273. /usr/lib/qubes/qopen-in-vm
  274. /usr/lib/qubes/qrun-in-vm
  275. /usr/lib/qubes/qubes-download-dom0-updates.sh
  276. /usr/lib/qubes/qubes-fix-nm-conf.sh
  277. /usr/lib/qubes/qubes-setup-dnat-to-ns
  278. /usr/lib/qubes/qubes-trigger-sync-appmenus.sh
  279. /usr/lib/qubes/qvm-copy-to-vm.gnome
  280. /usr/lib/qubes/qvm-copy-to-vm.kde
  281. /usr/lib/qubes/serial.conf
  282. /usr/lib/qubes/setup-ip
  283. /usr/lib/qubes/tar2qfile
  284. /usr/lib/qubes/vm-file-editor
  285. /usr/lib/qubes/wrap-in-html-if-url.sh
  286. /usr/lib/qubes/iptables-yum-proxy
  287. /usr/lib/yum-plugins/yum-qubes-hooks.py*
  288. /usr/sbin/qubes-firewall
  289. /usr/sbin/qubes-netwatcher
  290. /usr/share/glib-2.0/schemas/org.gnome.settings-daemon.plugins.updates.gschema.override
  291. /usr/share/file-manager/actions/qvm-copy-gnome.desktop
  292. /usr/share/file-manager/actions/qvm-dvm-gnome.desktop
  293. %dir /usr/share/qubes
  294. /usr/share/qubes/mime-override/globs
  295. %dir /home_volatile
  296. %attr(700,user,user) /home_volatile/user
  297. %dir /mnt/removable
  298. %package sysvinit
  299. Summary: Qubes unit files for SysV init style or upstart
  300. License: GPL v2 only
  301. Group: Qubes
  302. Requires: upstart
  303. Requires: qubes-core-vm
  304. Provides: qubes-core-vm-init-scripts
  305. Conflicts: qubes-core-vm-systemd
  306. %description sysvinit
  307. The Qubes core startup configuration for SysV init (or upstart).
  308. %files sysvinit
  309. /etc/init.d/qubes-core
  310. /etc/init.d/qubes-core-appvm
  311. /etc/init.d/qubes-core-netvm
  312. /etc/init.d/qubes-firewall
  313. /etc/init.d/qubes-netwatcher
  314. /etc/init.d/qubes-yum-proxy
  315. /etc/init.d/qubes-qrexec-agent
  316. %post sysvinit
  317. #echo "--> Turning off unnecessary services..."
  318. # FIXME: perhaps there is more elegant way to do this?
  319. for f in /etc/init.d/*
  320. do
  321. srv=`basename $f`
  322. [ $srv = 'functions' ] && continue
  323. [ $srv = 'killall' ] && continue
  324. [ $srv = 'halt' ] && continue
  325. [ $srv = 'single' ] && continue
  326. [ $srv = 'reboot' ] && continue
  327. [ $srv = 'qubes-gui' ] && continue
  328. chkconfig $srv off
  329. done
  330. #echo "--> Enabling essential services..."
  331. chkconfig rsyslog on
  332. chkconfig haldaemon on
  333. chkconfig messagebus on
  334. chkconfig iptables on
  335. chkconfig ip6tables on
  336. chkconfig --add qubes-core || echo "WARNING: Cannot add service qubes-core!"
  337. chkconfig qubes-core on || echo "WARNING: Cannot enable service qubes-core!"
  338. chkconfig --add qubes-core-netvm || echo "WARNING: Cannot add service qubes-core-netvm!"
  339. chkconfig qubes-core-netvm on || echo "WARNING: Cannot enable service qubes-core-netvm!"
  340. chkconfig --add qubes-core-appvm || echo "WARNING: Cannot add service qubes-core-appvm!"
  341. chkconfig qubes-core-appvm on || echo "WARNING: Cannot enable service qubes-core-appvm!"
  342. chkconfig --add qubes-firewall || echo "WARNING: Cannot add service qubes-firewall!"
  343. chkconfig qubes-firewall on || echo "WARNING: Cannot enable service qubes-firewall!"
  344. chkconfig --add qubes-netwatcher || echo "WARNING: Cannot add service qubes-netwatcher!"
  345. chkconfig qubes-netwatcher on || echo "WARNING: Cannot enable service qubes-netwatcher!"
  346. chkconfig --add qubes-yum-proxy || echo "WARNING: Cannot add service qubes-yum-proxy!"
  347. chkconfig qubes-yum-proxy on || echo "WARNING: Cannot enable service qubes-yum-proxy!"
  348. chkconfig --add qubes-qrexec-agent || echo "WARNING: Cannot add service qubes-qrexec-agent!"
  349. chkconfig qubes-qrexec-agent on || echo "WARNING: Cannot enable service qubes-qrexec-agent!"
  350. # TODO: make this not display the silly message about security context...
  351. sed -i s/^id:.:initdefault:/id:3:initdefault:/ /etc/inittab
  352. %preun sysvinit
  353. if [ "$1" = 0 ] ; then
  354. # no more packages left
  355. chkconfig qubes-core off
  356. chkconfig qubes-core-netvm off
  357. chkconfig qubes-core-appvm off
  358. chkconfig qubes-firewall off
  359. chkconfig qubes-netwatcher off
  360. chkconfig qubes-yum-proxy off
  361. chkconfig qubes-qrexec-agent off
  362. fi
  363. %package systemd
  364. Summary: Qubes unit files for SystemD init style
  365. License: GPL v2 only
  366. Group: Qubes
  367. Requires: systemd
  368. Requires(post): systemd-units
  369. Requires(preun): systemd-units
  370. Requires(postun): systemd-units
  371. Requires: qubes-core-vm
  372. Provides: qubes-core-vm-init-scripts
  373. Conflicts: qubes-core-vm-sysvinit
  374. %description systemd
  375. The Qubes core startup configuration for SystemD init.
  376. %files systemd
  377. %defattr(-,root,root,-)
  378. /lib/systemd/system/qubes-dvm.service
  379. /lib/systemd/system/qubes-misc-post.service
  380. /lib/systemd/system/qubes-firewall.service
  381. /lib/systemd/system/qubes-netwatcher.service
  382. /lib/systemd/system/qubes-network.service
  383. /lib/systemd/system/qubes-sysinit.service
  384. /lib/systemd/system/qubes-update-check.service
  385. /lib/systemd/system/qubes-update-check.timer
  386. /lib/systemd/system/qubes-yum-proxy.service
  387. /lib/systemd/system/qubes-qrexec-agent.service
  388. %dir /usr/lib/qubes/init
  389. /usr/lib/qubes/init/prepare-dvm.sh
  390. /usr/lib/qubes/init/network-proxy-setup.sh
  391. /usr/lib/qubes/init/misc-post.sh
  392. /usr/lib/qubes/init/misc-post-stop.sh
  393. /usr/lib/qubes/init/qubes-sysinit.sh
  394. /usr/lib/qubes/init/NetworkManager.service
  395. /usr/lib/qubes/init/NetworkManager-wait-online.service
  396. /usr/lib/qubes/init/cups.service
  397. /usr/lib/qubes/init/cups.socket
  398. /usr/lib/qubes/init/cups.path
  399. /usr/lib/qubes/init/ntpd.service
  400. /usr/lib/qubes/init/chronyd.service
  401. %ghost %attr(0644,root,root) /etc/systemd/system/NetworkManager.service
  402. %ghost %attr(0644,root,root) /etc/systemd/system/NetworkManager-wait-online.service
  403. %ghost %attr(0644,root,root) /etc/systemd/system/cups.service
  404. %ghost %attr(0644,root,root) /etc/systemd/system/cups.socket
  405. %ghost %attr(0644,root,root) /etc/systemd/system/cups.path
  406. %post systemd
  407. for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-netwatcher qubes-network qubes-firewall qubes-yum-proxy qubes-qrexec-agent; do
  408. /bin/systemctl enable $srv.service 2> /dev/null
  409. done
  410. /bin/systemctl enable qubes-update-check.timer 2> /dev/null
  411. UNITDIR=/lib/systemd/system
  412. OVERRIDEDIR=/usr/lib/qubes/init
  413. # Install overriden services only when original exists
  414. for srv in cups NetworkManager NetworkManager-wait-online ntpd chronyd; do
  415. if [ -f $UNITDIR/$srv.service ]; then
  416. cp $OVERRIDEDIR/$srv.service /etc/systemd/system/
  417. fi
  418. if [ -f $UNITDIR/$srv.socket -a -f $OVERRIDEDIR/$srv.socket ]; then
  419. cp $OVERRIDEDIR/$srv.socket /etc/systemd/system/
  420. fi
  421. if [ -f $UNITDIR/$srv.path -a -f $OVERRIDEDIR/$srv.path ]; then
  422. cp $OVERRIDEDIR/$srv.service /etc/systemd/system/
  423. fi
  424. done
  425. # Set default "runlevel"
  426. rm -f /etc/systemd/system/default.target
  427. ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
  428. DISABLE_SERVICES="alsa-store alsa-restore auditd avahi avahi-daemon backuppc cpuspeed crond"
  429. DISABLE_SERVICES="$DISABLE_SERVICES fedora-autorelabel fedora-autorelabel-mark ipmi hwclock-load hwclock-save"
  430. DISABLE_SERVICES="$DISABLE_SERVICES mdmonitor multipathd openct rpcbind mcelog fedora-storage-init fedora-storage-init-late"
  431. DISABLE_SERVICES="$DISABLE_SERVICES plymouth-start plymouth-read-write plymouth-quit plymouth-quit-wait"
  432. DISABLE_SERVICES="$DISABLE_SERVICES sshd tcsd sm-client sendmail mdmonitor-takeover"
  433. DISABLE_SERVICES="$DISABLE_SERVICES rngd smartd upower irqbalance colord"
  434. for srv in $DISABLE_SERVICES; do
  435. if [ -f /lib/systemd/system/$srv.service ]; then
  436. if fgrep -q '[Install]' /lib/systemd/system/$srv.service; then
  437. /bin/systemctl disable $srv.service 2> /dev/null
  438. else
  439. # forcibly disable
  440. ln -sf /dev/null /etc/systemd/system/$srv.service
  441. fi
  442. fi
  443. done
  444. rm -f /etc/systemd/system/getty.target.wants/getty@tty*.service
  445. # Enable some services
  446. /bin/systemctl enable iptables.service 2> /dev/null
  447. /bin/systemctl enable ip6tables.service 2> /dev/null
  448. /bin/systemctl enable rsyslog.service 2> /dev/null
  449. /bin/systemctl enable ntpd.service 2> /dev/null
  450. # Disable original service to enable overriden one
  451. /bin/systemctl disable NetworkManager.service 2> /dev/null
  452. # Disable D-BUS activation of NetworkManager - in AppVm it causes problems (eg PackageKit timeouts)
  453. /bin/systemctl mask dbus-org.freedesktop.NetworkManager.service 2> /dev/null
  454. /bin/systemctl enable NetworkManager.service 2> /dev/null
  455. # Fix for https://bugzilla.redhat.com/show_bug.cgi?id=974811
  456. /bin/systemctl enable NetworkManager-dispatcher.service 2> /dev/null
  457. # Enable cups only when it is real SystemD service
  458. [ -e /lib/systemd/system/cups.service ] && /bin/systemctl enable cups.service 2> /dev/null
  459. exit 0
  460. %postun systemd
  461. #Do not run this part on upgrades
  462. if [ "$1" != 0 ] ; then
  463. exit 0
  464. fi
  465. for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-netwatcher qubes-network qubes-qrexec-agent; do
  466. /bin/systemctl disable $srv.service
  467. do