core-dom0.spec 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. #
  2. # This is the SPEC file for creating binary RPMs for the Dom0.
  3. #
  4. #
  5. # The Qubes OS Project, http://www.qubes-os.org
  6. #
  7. # Copyright (C) 2010 Joanna Rutkowska <joanna@invisiblethingslab.com>
  8. # Copyright (C) 2010 Rafal Wojtczuk <rafal@invisiblethingslab.com>
  9. #
  10. # This program is free software; you can redistribute it and/or
  11. # modify it under the terms of the GNU General Public License
  12. # as published by the Free Software Foundation; either version 2
  13. # of the License, or (at your option) any later version.
  14. #
  15. # This program is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. # GNU General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU General Public License
  21. # along with this program; if not, write to the Free Software
  22. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  23. #
  24. #
  25. %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
  26. %{!?version: %define version %(cat version)}
  27. %define _dracutmoddir /usr/lib/dracut/modules.d
  28. %if %{fedora} < 17
  29. %define _dracutmoddir /usr/share/dracut/modules.d
  30. %endif
  31. Name: qubes-core-dom0
  32. Version: %{version}
  33. Release: 1%{dist}
  34. Summary: The Qubes core files (Dom0-side)
  35. Group: Qubes
  36. Vendor: Invisible Things Lab
  37. License: GPL
  38. URL: http://www.qubes-os.org
  39. BuildRequires: ImageMagick
  40. BuildRequires: systemd-units
  41. # for building documentation
  42. BuildRequires: python-sphinx
  43. BuildRequires: libvirt-python
  44. Requires(post): systemd-units
  45. Requires(preun): systemd-units
  46. Requires(postun): systemd-units
  47. Requires: python, pciutils, python-inotify, python-daemon
  48. Requires: qubes-core-dom0-linux >= 2.0.24
  49. Requires: qubes-db-dom0
  50. Requires: python-lxml
  51. Requires: python-psutil
  52. # TODO: R: qubes-gui-dom0 >= 2.1.11
  53. Conflicts: qubes-gui-dom0 < 1.1.13
  54. Requires: libvirt-python
  55. %if x%{?backend_vmm} == xxen
  56. Requires: xen-runtime
  57. Requires: xen-hvm
  58. Requires: libvirt-daemon-xen >= 1.2.12-3
  59. %endif
  60. Requires: createrepo
  61. Requires: gnome-packagekit
  62. Requires: cronie
  63. Requires: bsdtar
  64. # for qubes-hcl-report
  65. Requires: dmidecode
  66. Requires: PyQt4
  67. # for property's docstrings
  68. Requires: python-docutils
  69. # Prevent preupgrade from installation (it pretend to provide distribution upgrade)
  70. Obsoletes: preupgrade < 2.0
  71. Provides: preupgrade = 2.0
  72. %define _builddir %(pwd)
  73. %description
  74. The Qubes core files for installation on Dom0.
  75. %prep
  76. # we operate on the current directory, so no need to unpack anything
  77. # symlink is to generate useful debuginfo packages
  78. rm -f %{name}-%{version}
  79. ln -sf . %{name}-%{version}
  80. %setup -T -D
  81. %build
  82. make all
  83. %install
  84. make install \
  85. DESTDIR=$RPM_BUILD_ROOT \
  86. UNITDIR=%{_unitdir} \
  87. PYTHON_SITEPATH=%{python_sitearch} \
  88. SYSCONFDIR=%{_sysconfdir}
  89. %post
  90. # Create NetworkManager configuration if we do not have it
  91. if ! [ -e /etc/NetworkManager/NetworkManager.conf ]; then
  92. echo '[main]' > /etc/NetworkManager/NetworkManager.conf
  93. echo 'plugins = keyfile' >> /etc/NetworkManager/NetworkManager.conf
  94. echo '[keyfile]' >> /etc/NetworkManager/NetworkManager.conf
  95. fi
  96. sed '/^autoballoon=/d;/^lockfile=/d' -i /etc/xen/xl.conf
  97. echo 'autoballoon=0' >> /etc/xen/xl.conf
  98. echo 'lockfile="/var/run/qubes/xl-lock"' >> /etc/xen/xl.conf
  99. sed 's/^PRELINKING\s*=.*/PRELINKING=no/' -i /etc/sysconfig/prelink
  100. systemctl --no-reload enable qubes-core.service >/dev/null 2>&1
  101. systemctl --no-reload enable qubes-netvm.service >/dev/null 2>&1
  102. systemctl --no-reload enable qubes-setupdvm.service >/dev/null 2>&1
  103. # Conflicts with libxl stack, so disable it
  104. systemctl --no-reload disable xend.service >/dev/null 2>&1
  105. systemctl --no-reload disable xendomains.service >/dev/null 2>&1
  106. systemctl daemon-reload >/dev/null 2>&1 || :
  107. HAD_SYSCONFIG_NETWORK=yes
  108. if ! [ -e /etc/sysconfig/network ]; then
  109. HAD_SYSCONFIG_NETWORK=no
  110. # supplant empty one so NetworkManager init script does not complain
  111. touch /etc/sysconfig/network
  112. fi
  113. # Load evtchn module - xenstored needs it
  114. modprobe evtchn 2> /dev/null || modprobe xen-evtchn
  115. service xenstored start
  116. if ! [ -e /var/lib/qubes/qubes.xml ]; then
  117. # echo "Initializing Qubes DB..."
  118. umask 007; sg qubes -c qvm-init-storage
  119. qubes-prefs -s default-kernel `ls /var/lib/qubes/vm-kernels|head -n 1` 2> /dev/null
  120. fi
  121. # Because we now have an installer
  122. # this script is always executed during upgrade
  123. # and we decided not to restart core during upgrade
  124. #service qubes_core start
  125. if [ "x"$HAD_SYSCONFIG_NETWORK = "xno" ]; then
  126. rm -f /etc/sysconfig/network
  127. fi
  128. %clean
  129. rm -rf $RPM_BUILD_ROOT
  130. rm -f %{name}-%{version}
  131. %pre
  132. if ! grep -q ^qubes: /etc/group ; then
  133. groupadd qubes
  134. fi
  135. %triggerin -- xen-runtime
  136. sed -i 's/\/block /\/block.qubes /' /etc/udev/rules.d/xen-backend.rules
  137. /usr/lib/qubes/fix-dir-perms.sh
  138. %preun
  139. if [ "$1" = 0 ] ; then
  140. # no more packages left
  141. service qubes_netvm stop
  142. service qubes_core stop
  143. fi
  144. %postun
  145. if [ "$1" = 0 ] ; then
  146. # no more packages left
  147. chgrp root /etc/xen
  148. chmod 700 /etc/xen
  149. groupdel qubes
  150. sed -i 's/\/block.qubes /\/block /' /etc/udev/rules.d/xen-backend.rules
  151. fi
  152. %files
  153. %defattr(-,root,root,-)
  154. %config(noreplace) %attr(0664,root,qubes) %{_sysconfdir}/qubes/qmemman.conf
  155. /usr/bin/qvm-*
  156. /usr/bin/qubes-*
  157. %dir %{python_sitearch}/qubes
  158. %{python_sitearch}/qubes/__init__.py*
  159. %{python_sitearch}/qubes/_pluginloader.py*
  160. %{python_sitearch}/qubes/config.py*
  161. %{python_sitearch}/qubes/dochelpers.py*
  162. %{python_sitearch}/qubes/events.py*
  163. %{python_sitearch}/qubes/log.py*
  164. %{python_sitearch}/qubes/plugins.py*
  165. %{python_sitearch}/qubes/rngdoc.py*
  166. %{python_sitearch}/qubes/utils.py*
  167. %dir %{python_sitearch}/qubes/vm
  168. %{python_sitearch}/qubes/vm/__init__.py*
  169. %{python_sitearch}/qubes/vm/adminvm.py*
  170. %{python_sitearch}/qubes/vm/appvm.py*
  171. %{python_sitearch}/qubes/vm/dispvm.py*
  172. %{python_sitearch}/qubes/vm/hvm.py*
  173. %{python_sitearch}/qubes/vm/netvm.py*
  174. %{python_sitearch}/qubes/vm/proxyvm.py*
  175. %{python_sitearch}/qubes/vm/qubesvm.py*
  176. %{python_sitearch}/qubes/vm/templatehvm.py*
  177. %{python_sitearch}/qubes/vm/templatevm.py*
  178. %dir %{python_sitearch}/qubes/ext
  179. %{python_sitearch}/qubes/ext/__init__.py*
  180. %dir %{python_sitearch}/qubes/tests
  181. %{python_sitearch}/qubes/tests/__init__.py*
  182. %{python_sitearch}/qubes/tests/run.py*
  183. %{python_sitearch}/qubes/tests/events.py*
  184. %{python_sitearch}/qubes/tests/init.py*
  185. %dir %{python_sitearch}/qubes/tests/vm
  186. %{python_sitearch}/qubes/tests/vm/__init__.py*
  187. %{python_sitearch}/qubes/tests/vm/init.py*
  188. %{python_sitearch}/qubes/tests/vm/qubesvm.py*
  189. # qmemman
  190. %{python_sitearch}/qubes/qmemman.py*
  191. %{python_sitearch}/qubes/qmemman_algo.py*
  192. %{python_sitearch}/qubes/qmemman_client.py*
  193. %{python_sitearch}/qubes/qmemman_server.py*
  194. /usr/lib/qubes/unbind-pci-device.sh
  195. /usr/lib/qubes/cleanup-dispvms
  196. /usr/lib/qubes/qmemman_daemon.py*
  197. /usr/lib/qubes/qfile-daemon-dvm*
  198. /usr/lib/qubes/block-cleaner-daemon.py*
  199. /usr/lib/qubes/vusb-ctl.py*
  200. /usr/lib/qubes/xl-qvm-usb-attach.py*
  201. /usr/lib/qubes/xl-qvm-usb-detach.py*
  202. /usr/lib/qubes/fix-dir-perms.sh
  203. /usr/lib/qubes/startup-dvm.sh
  204. /usr/lib/qubes/startup-misc.sh
  205. /usr/lib/qubes/prepare-volatile-img.sh
  206. /usr/libexec/qubes/qubes-notify-tools
  207. /usr/libexec/qubes/qubes-notify-updates
  208. %{_unitdir}/qubes-block-cleaner.service
  209. %{_unitdir}/qubes-core.service
  210. %{_unitdir}/qubes-setupdvm.service
  211. %{_unitdir}/qubes-netvm.service
  212. %{_unitdir}/qubes-qmemman.service
  213. %{_unitdir}/qubes-vm@.service
  214. %{_unitdir}/qubes-reload-firewall@.service
  215. %{_unitdir}/qubes-reload-firewall@.timer
  216. %attr(2770,root,qubes) %dir /var/lib/qubes
  217. %attr(2770,root,qubes) %dir /var/lib/qubes/vm-templates
  218. %attr(2770,root,qubes) %dir /var/lib/qubes/appvms
  219. %attr(2770,root,qubes) %dir /var/lib/qubes/servicevms
  220. %attr(2770,root,qubes) %dir /var/lib/qubes/backup
  221. %attr(2770,root,qubes) %dir /var/lib/qubes/dvmdata
  222. %attr(2770,root,qubes) %dir /var/lib/qubes/vm-kernels
  223. /usr/share/qubes/vm-template.xml
  224. /usr/share/qubes/vm-template-hvm.xml
  225. /usr/lib/tmpfiles.d/qubes.conf
  226. /usr/lib/qubes/qubes-prepare-saved-domain.sh
  227. /usr/lib/qubes/qubes-update-dispvm-savefile-with-progress.sh
  228. /etc/xen/scripts/block.qubes
  229. /etc/xen/scripts/block-snapshot
  230. /etc/xen/scripts/block-origin
  231. /etc/xen/scripts/vif-route-qubes
  232. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.Filecopy
  233. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.GetImageRGBA
  234. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.OpenInVM
  235. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.NotifyTools
  236. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.NotifyUpdates
  237. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.VMShell
  238. /etc/qubes-rpc/qubes.NotifyTools
  239. /etc/qubes-rpc/qubes.NotifyUpdates
  240. %attr(2770,root,qubes) %dir /var/log/qubes
  241. %attr(0770,root,qubes) %dir /var/run/qubes
  242. /etc/xdg/autostart/qubes-guid.desktop
  243. /usr/share/doc/qubes/relaxng/*.rng