Makefile 14 KB

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