Makefile 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. RPMS_DIR=rpm/
  2. VERSION := $(shell cat version)
  3. DIST ?= fc18
  4. KDESERVICEDIR ?= /usr/share/kde4/services
  5. SBINDIR ?= /usr/sbin
  6. LIBDIR ?= /usr/lib
  7. SYSLIBDIR ?= /lib
  8. PYTHON = /usr/bin/python2
  9. PYTHON_SITEARCH = `python2 -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1)'`
  10. PYTHON2_SITELIB = `python2 -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib()'`
  11. PYTHON3_SITELIB = `python3 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())'`
  12. # This makefile uses some bash-isms, make uses /bin/sh by default.
  13. SHELL = /bin/bash
  14. help:
  15. @echo "make rpms -- generate binary rpm packages"
  16. @echo "make rpms-vm -- generate binary rpm packages for VM"
  17. @echo "make clean -- cleanup"
  18. @echo "make install-vm -- install VM related files"
  19. @echo ""
  20. @echo "You must have lsb_release, rpm-sign and pandoc installed."
  21. rpms: rpms-vm
  22. rpms-vm:
  23. [ "$$BACKEND_VMM" != "" ] || { echo "error: you must define variable BACKEND_VMM" >&2 ; exit 1 ; }
  24. lsb_release >/dev/null 2>&1 || { echo "error: you need lsb_release installed" >&2 ; exit 1 ; }
  25. type pandoc >/dev/null 2>&1 || { echo "error: you need pandoc installed" >&2 ; exit 1 ; }
  26. type rpmsign >/dev/null 2>&1 || { echo "error: you need rpm-sign installed" >&2 ; exit 1 ; }
  27. rpmbuild --define "_rpmdir $(RPMS_DIR)" -bb rpm_spec/core-vm.spec
  28. rpmbuild --define "_rpmdir $(RPMS_DIR)" -bb rpm_spec/core-vm-doc.spec
  29. [ "$$SKIP_SIGNING" = "" ] || rpm --addsign \
  30. $(RPMS_DIR)/x86_64/qubes-core-vm-*$(VERSION)*.rpm \
  31. $(RPMS_DIR)/x86_64/qubes-core-vm-doc-*$(VERSION)*.rpm
  32. rpms-dom0:
  33. @true
  34. clean:
  35. make -C misc clean
  36. make -C qrexec clean
  37. make -C qubes-rpc clean
  38. all:
  39. make -C misc
  40. make -C qrexec
  41. make -C qubes-rpc
  42. # Dropin Directory
  43. DROPIN_DIR ?= "lib/systemd"
  44. SYSTEM_DROPINS := chronyd.service crond.service cups.service cups.path cups.socket ModemManager.service
  45. SYSTEM_DROPINS += NetworkManager.service NetworkManager-wait-online.service ntpd.service getty@tty.service
  46. SYSTEM_DROPINS += tinyproxy.service
  47. SYSTEM_DROPINS += tmp.mount
  48. SYSTEM_DROPINS += org.cups.cupsd.service org.cups.cupsd.path org.cups.cupsd.socket
  49. SYSTEM_DROPINS += systemd-random-seed.service
  50. SYSTEM_DROPINS += tor.service tor@default.service
  51. USER_DROPINS := pulseaudio.service pulseaudio.socket
  52. # Debian Dropins
  53. ifeq ($(shell lsb_release -is), Debian)
  54. # Don't have 'ntpd' in Debian
  55. SYSTEM_DROPINS := $(filter-out ntpd.service, $(SYSTEM_DROPINS))
  56. # 'crond.service' is named 'cron.service in Debian
  57. SYSTEM_DROPINS := $(strip $(patsubst crond.service, cron.service, $(SYSTEM_DROPINS)))
  58. # Wheezy System Dropins
  59. # Disable sysinit 'network-manager.service' since systemd 'NetworkManager.service' is already installed
  60. SYSTEM_DROPINS += $(strip $(if $(filter wheezy, $(shell lsb_release -cs)), network-manager.service,))
  61. # handled by qubes-iptables service now
  62. SYSTEM_DROPINS += netfilter-persistent.service
  63. endif
  64. install-systemd-dropins:
  65. # Install system dropins
  66. @for dropin in $(SYSTEM_DROPINS); do \
  67. install -d $(DESTDIR)/$(DROPIN_DIR)/system/$${dropin}.d ;\
  68. install -m 0644 vm-systemd/$${dropin}.d/*.conf $(DESTDIR)/$(DROPIN_DIR)/system/$${dropin}.d/ ;\
  69. done
  70. # Install user dropins
  71. @for dropin in $(USER_DROPINS); do \
  72. install -d $(DESTDIR)/$(DROPIN_DIR)/user/$${dropin}.d ;\
  73. install -m 0644 vm-systemd/user/$${dropin}.d/*.conf $(DESTDIR)/$(DROPIN_DIR)/user/$${dropin}.d/ ;\
  74. done
  75. install-init:
  76. install -d $(DESTDIR)$(LIBDIR)/qubes/init
  77. # FIXME: do a source code move vm-systemd/*.sh to init/
  78. # since those scripts are shared between sysvinit and systemd.
  79. install -m 0755 init/*.sh vm-systemd/*.sh $(DESTDIR)$(LIBDIR)/qubes/init/
  80. install -m 0644 init/functions $(DESTDIR)$(LIBDIR)/qubes/init/
  81. install-systemd: install-init
  82. install -d $(DESTDIR)$(SYSLIBDIR)/systemd/system{,-preset} $(DESTDIR)$(LIBDIR)/qubes/init $(DESTDIR)$(SYSLIBDIR)/modules-load.d
  83. install -m 0644 vm-systemd/qubes-*.service $(DESTDIR)$(SYSLIBDIR)/systemd/system/
  84. install -m 0644 vm-systemd/qubes-*.timer $(DESTDIR)$(SYSLIBDIR)/systemd/system/
  85. install -m 0644 vm-systemd/75-qubes-vm.preset $(DESTDIR)$(SYSLIBDIR)/systemd/system-preset/
  86. install -m 0644 vm-systemd/qubes-core.conf $(DESTDIR)$(SYSLIBDIR)/modules-load.d/
  87. install -m 0644 vm-systemd/qubes-misc.conf $(DESTDIR)$(SYSLIBDIR)/modules-load.d/
  88. install -m 0755 network/qubes-iptables $(DESTDIR)$(LIBDIR)/qubes/init/
  89. install -D -m 0644 vm-systemd/qubes-core-agent-linux.tmpfiles \
  90. $(DESTDIR)/usr/lib/tmpfiles.d/qubes-core-agent-linux.conf
  91. install-sysvinit: install-init
  92. install -d $(DESTDIR)/etc/init.d
  93. install vm-init.d/qubes-sysinit $(DESTDIR)/etc/init.d/
  94. install vm-init.d/qubes-core-early $(DESTDIR)/etc/init.d/
  95. install vm-init.d/qubes-core $(DESTDIR)/etc/init.d/
  96. install vm-init.d/qubes-core-netvm $(DESTDIR)/etc/init.d/
  97. install vm-init.d/qubes-firewall $(DESTDIR)/etc/init.d/
  98. install vm-init.d/qubes-netwatcher $(DESTDIR)/etc/init.d/
  99. install vm-init.d/qubes-qrexec-agent $(DESTDIR)/etc/init.d/
  100. install vm-init.d/qubes-updates-proxy $(DESTDIR)/etc/init.d/
  101. install vm-init.d/qubes-dvm $(DESTDIR)/etc/init.d/
  102. install -D vm-init.d/qubes-core.modules $(DESTDIR)/etc/sysconfig/modules/qubes-core.modules
  103. install -D vm-init.d/qubes-misc.modules $(DESTDIR)/etc/sysconfig/modules/qubes-misc.modules
  104. install network/qubes-iptables $(DESTDIR)/etc/init.d/
  105. install-rh: install-systemd install-systemd-dropins install-sysvinit
  106. install -D -m 0644 misc/qubes-r3.repo $(DESTDIR)/etc/yum.repos.d/qubes-r3.repo
  107. install -d $(DESTDIR)/usr/share/glib-2.0/schemas/
  108. install -m 0644 misc/org.gnome.settings-daemon.plugins.updates.gschema.override $(DESTDIR)/usr/share/glib-2.0/schemas/
  109. install -m 0644 misc/org.gnome.nautilus.gschema.override $(DESTDIR)/usr/share/glib-2.0/schemas/
  110. install -m 0644 misc/org.mate.NotificationDaemon.gschema.override $(DESTDIR)/usr/share/glib-2.0/schemas/
  111. install -d $(DESTDIR)$(LIBDIR)/yum-plugins/
  112. install -m 0644 misc/yum-qubes-hooks.py* $(DESTDIR)$(LIBDIR)/yum-plugins/
  113. install -D -m 0644 misc/yum-qubes-hooks.conf $(DESTDIR)/etc/yum/pluginconf.d/yum-qubes-hooks.conf
  114. install -d -m 755 $(DESTDIR)/etc/pki/rpm-gpg
  115. install -m 644 misc/RPM-GPG-KEY-qubes* $(DESTDIR)/etc/pki/rpm-gpg/
  116. install -D -m 644 misc/session-stop-timeout.conf $(DESTDIR)$(LIBDIR)/systemd/system/user@.service.d/90-session-stop-timeout.conf
  117. install -d $(DESTDIR)/etc/yum.conf.d
  118. touch $(DESTDIR)/etc/yum.conf.d/qubes-proxy.conf
  119. install -D -m 0644 misc/qubes-trigger-sync-appmenus.action $(DESTDIR)/etc/yum/post-actions/qubes-trigger-sync-appmenus.action
  120. install -D -m 0644 misc/serial.conf $(DESTDIR)/usr/share/qubes/serial.conf
  121. install -D misc/qubes-serial-login $(DESTDIR)/$(SBINDIR)/qubes-serial-login
  122. install -D -m 0644 misc/dracut-qubes.conf \
  123. $(DESTDIR)/usr/lib/dracut/dracut.conf.d/30-qubes.conf
  124. install -D -m 0644 misc/dnf-qubes-hooks.py \
  125. $(DESTDIR)$(PYTHON2_SITELIB)/dnf-plugins/qubes-hooks.py
  126. install -D -m 0644 misc/dnf-qubes-hooks.py \
  127. $(DESTDIR)$(PYTHON3_SITELIB)/dnf-plugins/qubes-hooks.py
  128. install -D -m 0644 misc/dnf-qubes-hooks.conf $(DESTDIR)/etc/dnf/plugins/qubes-hooks.conf
  129. install-common:
  130. $(MAKE) -C autostart-dropins install
  131. install -m 0644 -D misc/fstab $(DESTDIR)/etc/fstab
  132. install -D -m 0440 misc/qubes.sudoers $(DESTDIR)/etc/sudoers.d/qubes
  133. install -D -m 0440 misc/sudoers.d_qt_x11_no_mitshm $(DESTDIR)/etc/sudoers.d/qt_x11_no_mitshm
  134. install -D -m 0644 misc/20_tcp_timestamps.conf $(DESTDIR)/etc/sysctl.d/20_tcp_timestamps.conf
  135. install -d $(DESTDIR)/var/lib/qubes
  136. install -D misc/xenstore-watch $(DESTDIR)/usr/bin/xenstore-watch-qubes
  137. install -d $(DESTDIR)/etc/udev/rules.d
  138. install -m 0644 misc/udev-qubes-misc.rules $(DESTDIR)/etc/udev/rules.d/50-qubes-misc.rules
  139. install -d $(DESTDIR)$(LIBDIR)/qubes/
  140. install misc/vusb-ctl.py $(DESTDIR)$(LIBDIR)/qubes/
  141. install misc/qubes-trigger-sync-appmenus.sh $(DESTDIR)$(LIBDIR)/qubes/
  142. install -D -m 0644 misc/polkit-1-qubes-allow-all.pkla $(DESTDIR)/etc/polkit-1/localauthority/50-local.d/qubes-allow-all.pkla
  143. install -D -m 0644 misc/polkit-1-qubes-allow-all.rules $(DESTDIR)/etc/polkit-1/rules.d/00-qubes-allow-all.rules
  144. install -D -m 0644 misc/mime-globs $(DESTDIR)/usr/share/qubes/mime-override/globs
  145. install misc/qubes-download-dom0-updates.sh $(DESTDIR)$(LIBDIR)/qubes/
  146. install -g user -m 2775 -d $(DESTDIR)/var/lib/qubes/dom0-updates
  147. install -D -m 0644 misc/qubes-master-key.asc $(DESTDIR)/usr/share/qubes/qubes-master-key.asc
  148. install misc/dispvm-prerun.sh $(DESTDIR)$(LIBDIR)/qubes/dispvm-prerun.sh
  149. install misc/close-window $(DESTDIR)$(LIBDIR)/qubes/close-window
  150. install misc/upgrades-installed-check $(DESTDIR)$(LIBDIR)/qubes/upgrades-installed-check
  151. install misc/upgrades-status-notify $(DESTDIR)$(LIBDIR)/qubes/upgrades-status-notify
  152. install -m 0644 network/udev-qubes-network.rules $(DESTDIR)/etc/udev/rules.d/99-qubes-network.rules
  153. install network/qubes-setup-dnat-to-ns $(DESTDIR)$(LIBDIR)/qubes
  154. install network/qubes-fix-nm-conf.sh $(DESTDIR)$(LIBDIR)/qubes
  155. install network/setup-ip $(DESTDIR)$(LIBDIR)/qubes/
  156. install network/network-manager-prepare-conf-dir $(DESTDIR)$(LIBDIR)/qubes/
  157. install -d $(DESTDIR)/etc/dhclient.d
  158. ln -s /usr/lib/qubes/qubes-setup-dnat-to-ns $(DESTDIR)/etc/dhclient.d/qubes-setup-dnat-to-ns.sh
  159. install -d $(DESTDIR)/etc/NetworkManager/dispatcher.d/
  160. install network/{qubes-nmhook,30-qubes-external-ip} $(DESTDIR)/etc/NetworkManager/dispatcher.d/
  161. install -d $(DESTDIR)/usr/lib/NetworkManager/conf.d
  162. install -m 0644 network/nm-30-qubes.conf $(DESTDIR)/usr/lib/NetworkManager/conf.d/30-qubes.conf
  163. install -D network/vif-route-qubes $(DESTDIR)/etc/xen/scripts/vif-route-qubes
  164. install -m 0644 -D network/tinyproxy-updates.conf $(DESTDIR)/etc/tinyproxy/tinyproxy-updates.conf
  165. install -m 0644 -D network/updates-blacklist $(DESTDIR)/etc/tinyproxy/updates-blacklist
  166. install -m 0755 -D network/iptables-updates-proxy $(DESTDIR)$(LIBDIR)/qubes/iptables-updates-proxy
  167. install -d $(DESTDIR)/etc/xdg/autostart
  168. install -m 0755 network/show-hide-nm-applet.sh $(DESTDIR)$(LIBDIR)/qubes/show-hide-nm-applet.sh
  169. install -m 0644 network/show-hide-nm-applet.desktop $(DESTDIR)/etc/xdg/autostart/00-qubes-show-hide-nm-applet.desktop
  170. install -m 0400 -D network/iptables $(DESTDIR)/etc/qubes/iptables.rules
  171. install -m 0400 -D network/ip6tables $(DESTDIR)/etc/qubes/ip6tables.rules
  172. install -m 0755 network/update-proxy-configs $(DESTDIR)$(LIBDIR)/qubes/
  173. install -d $(DESTDIR)/$(SBINDIR)
  174. install network/qubes-firewall $(DESTDIR)/$(SBINDIR)/
  175. install network/qubes-netwatcher $(DESTDIR)/$(SBINDIR)/
  176. install -d $(DESTDIR)/usr/bin
  177. install -m 0755 misc/qubes-session-autostart $(DESTDIR)/usr/bin/qubes-session-autostart
  178. install qubes-rpc/{qvm-open-in-dvm,qvm-open-in-vm,qvm-copy-to-vm,qvm-move-to-vm,qvm-run,qvm-mru-entry} $(DESTDIR)/usr/bin
  179. install qubes-rpc/qvm-copy-to-vm.kde $(DESTDIR)$(LIBDIR)/qubes
  180. install qubes-rpc/qvm-copy-to-vm.gnome $(DESTDIR)$(LIBDIR)/qubes
  181. install qubes-rpc/qvm-move-to-vm.kde $(DESTDIR)$(LIBDIR)/qubes
  182. install qubes-rpc/qvm-move-to-vm.gnome $(DESTDIR)$(LIBDIR)/qubes
  183. install qubes-rpc/xdg-icon $(DESTDIR)$(LIBDIR)/qubes
  184. install qubes-rpc/{vm-file-editor,qfile-agent,qopen-in-vm} $(DESTDIR)$(LIBDIR)/qubes
  185. install qubes-rpc/qubes-open $(DESTDIR)/usr/bin
  186. install qubes-rpc/tar2qfile $(DESTDIR)$(LIBDIR)/qubes
  187. # Install qfile-unpacker as SUID - because it will fail to receive files from other vm
  188. install -m 4755 qubes-rpc/qfile-unpacker $(DESTDIR)$(LIBDIR)/qubes
  189. install qubes-rpc/qrun-in-vm $(DESTDIR)$(LIBDIR)/qubes
  190. install qubes-rpc/sync-ntp-clock $(DESTDIR)$(LIBDIR)/qubes
  191. install qubes-rpc/prepare-suspend $(DESTDIR)$(LIBDIR)/qubes
  192. install -m 0644 misc/qubes-suspend-module-blacklist $(DESTDIR)/etc/qubes-suspend-module-blacklist
  193. install -d $(DESTDIR)/$(KDESERVICEDIR)
  194. install -m 0644 qubes-rpc/{qvm-copy.desktop,qvm-move.desktop,qvm-dvm.desktop} $(DESTDIR)/$(KDESERVICEDIR)
  195. install -d $(DESTDIR)/etc/qubes-rpc
  196. install -m 0644 qubes-rpc/{qubes.Filecopy,qubes.OpenInVM,qubes.VMShell,qubes.SyncNtpClock} $(DESTDIR)/etc/qubes-rpc
  197. install -m 0755 qubes-rpc/qubes.OpenURL $(DESTDIR)/etc/qubes-rpc
  198. install -m 0644 qubes-rpc/{qubes.SuspendPre,qubes.SuspendPost,qubes.GetAppmenus} $(DESTDIR)/etc/qubes-rpc
  199. install -m 0755 qubes-rpc/qubes.SuspendPreAll $(DESTDIR)/etc/qubes-rpc
  200. install -m 0755 qubes-rpc/qubes.SuspendPostAll $(DESTDIR)/etc/qubes-rpc
  201. install -m 0644 qubes-rpc/qubes.WaitForSession $(DESTDIR)/etc/qubes-rpc
  202. install -m 0644 qubes-rpc/qubes.DetachPciDevice $(DESTDIR)/etc/qubes-rpc
  203. install -m 0644 qubes-rpc/qubes.{Backup,Restore} $(DESTDIR)/etc/qubes-rpc
  204. install -m 0644 qubes-rpc/qubes.Select{File,Directory} $(DESTDIR)/etc/qubes-rpc
  205. install -m 0644 qubes-rpc/qubes.GetImageRGBA $(DESTDIR)/etc/qubes-rpc
  206. install -m 0644 qubes-rpc/qubes.SetDateTime $(DESTDIR)/etc/qubes-rpc
  207. install -m 0755 qubes-rpc/qubes.InstallUpdatesGUI $(DESTDIR)/etc/qubes-rpc
  208. install -d $(DESTDIR)/etc/qubes/suspend-pre.d
  209. install -m 0644 qubes-rpc/suspend-pre.README $(DESTDIR)/etc/qubes/suspend-pre.d/README
  210. install -d $(DESTDIR)/etc/qubes/suspend-post.d
  211. install -m 0644 qubes-rpc/suspend-post.README $(DESTDIR)/etc/qubes/suspend-post.d/README
  212. install -d $(DESTDIR)/usr/share/nautilus-python/extensions
  213. install -m 0644 qubes-rpc/*_nautilus.py $(DESTDIR)/usr/share/nautilus-python/extensions
  214. install -D -m 0755 misc/qubes-desktop-run $(DESTDIR)/usr/bin/qubes-desktop-run
  215. mkdir -p $(DESTDIR)/$(PYTHON_SITEARCH)/qubes/
  216. ifeq ($(shell lsb_release -is), Debian)
  217. install -m 0644 misc/xdg.py $(DESTDIR)/$(PYTHON_SITEARCH)/qubes/
  218. else
  219. install -m 0644 misc/py2/xdg.py* $(DESTDIR)/$(PYTHON_SITEARCH)/qubes/
  220. endif
  221. install -d $(DESTDIR)/mnt/removable
  222. install -D -m 0644 misc/xorg-preload-apps.conf $(DESTDIR)/etc/X11/xorg-preload-apps.conf
  223. install -d $(DESTDIR)/usr/lib/qubes-bind-dirs.d
  224. install -D -m 0644 misc/30_cron.conf $(DESTDIR)/usr/lib/qubes-bind-dirs.d/30_cron.conf
  225. install -d $(DESTDIR)/var/run/qubes
  226. install -d $(DESTDIR)/home_volatile/user
  227. install -d $(DESTDIR)/rw
  228. install-deb: install-common install-systemd install-systemd-dropins
  229. mkdir -p $(DESTDIR)/etc/apt/sources.list.d
  230. sed -e "s/@DIST@/`lsb_release -cs`/" misc/qubes-r3.list.in > $(DESTDIR)/etc/apt/sources.list.d/qubes-r3.list
  231. install -D -m 644 misc/qubes-archive-keyring.gpg $(DESTDIR)/etc/apt/trusted.gpg.d/qubes-archive-keyring.gpg
  232. install -D -m 644 network/00notify-hook $(DESTDIR)/etc/apt/apt.conf.d/00notify-hook
  233. install -d $(DESTDIR)/etc/sysctl.d
  234. install -m 644 network/80-qubes.conf $(DESTDIR)/etc/sysctl.d/
  235. install -D -m 644 misc/profile.d_qt_x11_no_mitshm.sh $(DESTDIR)/etc/profile.d/qt_x11_no_mitshm.sh
  236. install -D -m 440 misc/sudoers.d_umask $(DESTDIR)/etc/sudoers.d/umask
  237. install -d $(DESTDIR)/etc/pam.d
  238. install -m 0644 misc/pam.d_su.qubes $(DESTDIR)/etc/pam.d/su.qubes
  239. install -d $(DESTDIR)/etc/needrestart/conf.d
  240. install -D -m 0644 misc/50_qubes.conf $(DESTDIR)/etc/needrestart/conf.d/50_qubes.conf
  241. install-vm: install-rh install-common