core-dom0.spec 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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. # TODO: R: qubes-gui-dom0 >= 2.1.11
  52. Conflicts: qubes-gui-dom0 < 1.1.13
  53. Requires: libvirt-python
  54. %if x%{?backend_vmm} == xxen
  55. Requires: xen-runtime
  56. Requires: xen-hvm
  57. Requires: libvirt-daemon-xen >= 1.2.12-3
  58. %endif
  59. Requires: createrepo
  60. Requires: gnome-packagekit
  61. Requires: cronie
  62. Requires: bsdtar
  63. # for qubes-hcl-report
  64. Requires: dmidecode
  65. Requires: PyQt4
  66. # for property's docstrings
  67. Requires: python-docutils
  68. # Prevent preupgrade from installation (it pretend to provide distribution upgrade)
  69. Obsoletes: preupgrade < 2.0
  70. Provides: preupgrade = 2.0
  71. %define _builddir %(pwd)
  72. %description
  73. The Qubes core files for installation on Dom0.
  74. %prep
  75. # we operate on the current directory, so no need to unpack anything
  76. # symlink is to generate useful debuginfo packages
  77. rm -f %{name}-%{version}
  78. ln -sf . %{name}-%{version}
  79. %setup -T -D
  80. %build
  81. make all
  82. %install
  83. make install \
  84. DESTDIR=$RPM_BUILD_ROOT \
  85. UNITDIR=%{_unitdir} \
  86. PYTHON_SITEPATH=%{python_sitearch} \
  87. SYSCONFDIR=%{_sysconfdir}
  88. %post
  89. # Create NetworkManager configuration if we do not have it
  90. if ! [ -e /etc/NetworkManager/NetworkManager.conf ]; then
  91. echo '[main]' > /etc/NetworkManager/NetworkManager.conf
  92. echo 'plugins = keyfile' >> /etc/NetworkManager/NetworkManager.conf
  93. echo '[keyfile]' >> /etc/NetworkManager/NetworkManager.conf
  94. fi
  95. sed '/^autoballoon=/d;/^lockfile=/d' -i /etc/xen/xl.conf
  96. echo 'autoballoon=0' >> /etc/xen/xl.conf
  97. echo 'lockfile="/var/run/qubes/xl-lock"' >> /etc/xen/xl.conf
  98. sed 's/^PRELINKING\s*=.*/PRELINKING=no/' -i /etc/sysconfig/prelink
  99. systemctl --no-reload enable qubes-core.service >/dev/null 2>&1
  100. systemctl --no-reload enable qubes-netvm.service >/dev/null 2>&1
  101. systemctl --no-reload enable qubes-setupdvm.service >/dev/null 2>&1
  102. # Conflicts with libxl stack, so disable it
  103. systemctl --no-reload disable xend.service >/dev/null 2>&1
  104. systemctl --no-reload disable xendomains.service >/dev/null 2>&1
  105. systemctl daemon-reload >/dev/null 2>&1 || :
  106. HAD_SYSCONFIG_NETWORK=yes
  107. if ! [ -e /etc/sysconfig/network ]; then
  108. HAD_SYSCONFIG_NETWORK=no
  109. # supplant empty one so NetworkManager init script does not complain
  110. touch /etc/sysconfig/network
  111. fi
  112. # Load evtchn module - xenstored needs it
  113. modprobe evtchn 2> /dev/null || modprobe xen-evtchn
  114. service xenstored start
  115. if ! [ -e /var/lib/qubes/qubes.xml ]; then
  116. # echo "Initializing Qubes DB..."
  117. umask 007; sg qubes -c qvm-init-storage
  118. qubes-prefs -s default-kernel `ls /var/lib/qubes/vm-kernels|head -n 1` 2> /dev/null
  119. fi
  120. # Because we now have an installer
  121. # this script is always executed during upgrade
  122. # and we decided not to restart core during upgrade
  123. #service qubes_core start
  124. if [ "x"$HAD_SYSCONFIG_NETWORK = "xno" ]; then
  125. rm -f /etc/sysconfig/network
  126. fi
  127. %clean
  128. rm -rf $RPM_BUILD_ROOT
  129. rm -f %{name}-%{version}
  130. %pre
  131. if ! grep -q ^qubes: /etc/group ; then
  132. groupadd qubes
  133. fi
  134. %triggerin -- xen-runtime
  135. sed -i 's/\/block /\/block.qubes /' /etc/udev/rules.d/xen-backend.rules
  136. /usr/lib/qubes/fix-dir-perms.sh
  137. %preun
  138. if [ "$1" = 0 ] ; then
  139. # no more packages left
  140. service qubes_netvm stop
  141. service qubes_core stop
  142. fi
  143. %postun
  144. if [ "$1" = 0 ] ; then
  145. # no more packages left
  146. chgrp root /etc/xen
  147. chmod 700 /etc/xen
  148. groupdel qubes
  149. sed -i 's/\/block.qubes /\/block /' /etc/udev/rules.d/xen-backend.rules
  150. fi
  151. %files
  152. %defattr(-,root,root,-)
  153. %config(noreplace) %attr(0664,root,qubes) %{_sysconfdir}/qubes/qmemman.conf
  154. /usr/bin/qvm-*
  155. /usr/bin/qubes-*
  156. %dir %{python_sitearch}/qubes
  157. %{python_sitearch}/qubes/__init__.py*
  158. %{python_sitearch}/qubes/_pluginloader.py*
  159. %{python_sitearch}/qubes/config.py*
  160. %{python_sitearch}/qubes/dochelpers.py*
  161. %{python_sitearch}/qubes/events.py*
  162. %{python_sitearch}/qubes/log.py*
  163. %{python_sitearch}/qubes/plugins.py*
  164. %{python_sitearch}/qubes/rngdoc.py*
  165. %{python_sitearch}/qubes/utils.py*
  166. %dir %{python_sitearch}/qubes/vm
  167. %{python_sitearch}/qubes/vm/__init__.py*
  168. %{python_sitearch}/qubes/vm/adminvm.py*
  169. %{python_sitearch}/qubes/vm/appvm.py*
  170. %{python_sitearch}/qubes/vm/dispvm.py*
  171. %{python_sitearch}/qubes/vm/hvm.py*
  172. %{python_sitearch}/qubes/vm/netvm.py*
  173. %{python_sitearch}/qubes/vm/proxyvm.py*
  174. %{python_sitearch}/qubes/vm/qubesvm.py*
  175. %{python_sitearch}/qubes/vm/templatehvm.py*
  176. %{python_sitearch}/qubes/vm/templatevm.py*
  177. %dir %{python_sitearch}/qubes/storage
  178. %{python_sitearch}/qubes/storage/__init__.py*
  179. %{python_sitearch}/qubes/storage/xen.py*
  180. %dir %{python_sitearch}/qubes/tools
  181. %{python_sitearch}/qubes/tools/__init__.py*
  182. %{python_sitearch}/qubes/tools/qubes_create.py*
  183. %{python_sitearch}/qubes/tools/qvm_ls.py*
  184. %dir %{python_sitearch}/qubes/ext
  185. %{python_sitearch}/qubes/ext/__init__.py*
  186. %dir %{python_sitearch}/qubes/tests
  187. %{python_sitearch}/qubes/tests/__init__.py*
  188. %{python_sitearch}/qubes/tests/run.py*
  189. %{python_sitearch}/qubes/tests/events.py*
  190. %{python_sitearch}/qubes/tests/init.py*
  191. %dir %{python_sitearch}/qubes/tests/vm
  192. %{python_sitearch}/qubes/tests/vm/__init__.py*
  193. %{python_sitearch}/qubes/tests/vm/init.py*
  194. %{python_sitearch}/qubes/tests/vm/adminvm.py*
  195. %{python_sitearch}/qubes/tests/vm/qubesvm.py*
  196. %dir %{python_sitearch}/qubes/tests/tools
  197. %{python_sitearch}/qubes/tests/tools/__init__.py*
  198. %{python_sitearch}/qubes/tests/tools/qvm_ls.py*
  199. # qmemman
  200. %{python_sitearch}/qubes/qmemman.py*
  201. %{python_sitearch}/qubes/qmemman_algo.py*
  202. %{python_sitearch}/qubes/qmemman_client.py*
  203. %{python_sitearch}/qubes/qmemman_server.py*
  204. /usr/lib/qubes/unbind-pci-device.sh
  205. /usr/lib/qubes/cleanup-dispvms
  206. /usr/lib/qubes/qmemman_daemon.py*
  207. /usr/lib/qubes/qfile-daemon-dvm*
  208. /usr/lib/qubes/block-cleaner-daemon.py*
  209. /usr/lib/qubes/vusb-ctl.py*
  210. /usr/lib/qubes/xl-qvm-usb-attach.py*
  211. /usr/lib/qubes/xl-qvm-usb-detach.py*
  212. /usr/lib/qubes/fix-dir-perms.sh
  213. /usr/lib/qubes/startup-dvm.sh
  214. /usr/lib/qubes/startup-misc.sh
  215. /usr/lib/qubes/prepare-volatile-img.sh
  216. /usr/libexec/qubes/qubes-notify-tools
  217. /usr/libexec/qubes/qubes-notify-updates
  218. %{_unitdir}/qubes-block-cleaner.service
  219. %{_unitdir}/qubes-core.service
  220. %{_unitdir}/qubes-setupdvm.service
  221. %{_unitdir}/qubes-netvm.service
  222. %{_unitdir}/qubes-qmemman.service
  223. %{_unitdir}/qubes-vm@.service
  224. %{_unitdir}/qubes-reload-firewall@.service
  225. %{_unitdir}/qubes-reload-firewall@.timer
  226. %attr(2770,root,qubes) %dir /var/lib/qubes
  227. %attr(2770,root,qubes) %dir /var/lib/qubes/vm-templates
  228. %attr(2770,root,qubes) %dir /var/lib/qubes/appvms
  229. %attr(2770,root,qubes) %dir /var/lib/qubes/servicevms
  230. %attr(2770,root,qubes) %dir /var/lib/qubes/backup
  231. %attr(2770,root,qubes) %dir /var/lib/qubes/dvmdata
  232. %attr(2770,root,qubes) %dir /var/lib/qubes/vm-kernels
  233. /usr/share/qubes/vm-template.xml
  234. /usr/share/qubes/vm-template-hvm.xml
  235. /usr/lib/tmpfiles.d/qubes.conf
  236. /usr/lib/qubes/qubes-prepare-saved-domain.sh
  237. /usr/lib/qubes/qubes-update-dispvm-savefile-with-progress.sh
  238. /etc/xen/scripts/block.qubes
  239. /etc/xen/scripts/block-snapshot
  240. /etc/xen/scripts/block-origin
  241. /etc/xen/scripts/vif-route-qubes
  242. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.Filecopy
  243. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.GetImageRGBA
  244. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.OpenInVM
  245. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.NotifyTools
  246. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.NotifyUpdates
  247. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.VMShell
  248. /etc/qubes-rpc/qubes.NotifyTools
  249. /etc/qubes-rpc/qubes.NotifyUpdates
  250. %attr(2770,root,qubes) %dir /var/log/qubes
  251. %attr(0770,root,qubes) %dir /var/run/qubes
  252. /etc/xdg/autostart/qubes-guid.desktop
  253. /usr/share/doc/qubes/relaxng/*.rng