core-dom0.spec 8.2 KB

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