Makefile 13 KB

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