core-vm.spec 18 KB

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