core-dom0.spec 10 KB

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