core-agent.spec.in 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039
  1. #
  2. # The Qubes OS Project, http://www.qubes-os.org
  3. #
  4. # Copyright (C) 2010 Joanna Rutkowska <joanna@invisiblethingslab.com>
  5. # Copyright (C) 2010 Rafal Wojtczuk <rafal@invisiblethingslab.com>
  6. #
  7. # This program is free software; you can redistribute it and/or
  8. # modify it under the terms of the GNU General Public License
  9. # as published by the Free Software Foundation; either version 2
  10. # of the License, or (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  20. #
  21. #
  22. %define qubes_services qubes-core qubes-core-netvm qubes-core-early qubes-firewall qubes-iptables qubes-updates-proxy qubes-updates-proxy-forwarder
  23. %define qubes_preset_file 75-qubes-vm.preset
  24. # systemd is used in Fedora and CentOS
  25. %if 0%{?fedora} || 0%{?rhel}
  26. %define with_sysvinit 0
  27. %else
  28. %define with_sysvinit 1
  29. %endif
  30. %if 0%{?rhel} == 8
  31. %define plateform_python3_sitelib %(/usr/libexec/platform-python -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())')
  32. %endif
  33. %define scriptletfuns is_static() { \
  34. [ -f "%{_unitdir}/$1" ] && ! grep -q '^[[].nstall]' "%{_unitdir}/$1" \
  35. } \
  36. \
  37. is_masked() { \
  38. if [ ! -L %{_sysconfdir}/systemd/system/"$1" ] \
  39. then \
  40. return 1 \
  41. fi \
  42. target=`readlink %{_sysconfdir}/systemd/system/"$1" 2>/dev/null` || : \
  43. if [ "$target" = "/dev/null" ] \
  44. then \
  45. return 0 \
  46. fi \
  47. return 1 \
  48. } \
  49. \
  50. mask() { \
  51. ln -sf /dev/null %{_sysconfdir}/systemd/system/"$1" \
  52. } \
  53. \
  54. unmask() { \
  55. if ! is_masked "$1" \
  56. then \
  57. return 0 \
  58. fi \
  59. rm -f %{_sysconfdir}/systemd/system/"$1" \
  60. } \
  61. \
  62. preset_units() { \
  63. local represet= \
  64. cat "$1" | while read action unit_name \
  65. do \
  66. if [ "$action" = "#" -a "$unit_name" = "Units below this line will be re-preset on package upgrade" ] \
  67. then \
  68. represet=1 \
  69. continue \
  70. fi \
  71. echo "$action $unit_name" | grep -q '^[[:space:]]*[^#;]' || continue \
  72. [ -n "$action" -a -n "$unit_name" ] || continue \
  73. if [ "$2" = "initial" -o "$represet" = "1" ] \
  74. then \
  75. if [ "$action" = "disable" ] && is_static "$unit_name" \
  76. then \
  77. if ! is_masked "$unit_name" \
  78. then \
  79. # We must effectively mask these units, even if they are static. \
  80. mask "$unit_name" \
  81. fi \
  82. elif [ "$action" = "enable" ] && is_static "$unit_name" \
  83. then \
  84. if is_masked "$unit_name" \
  85. then \
  86. # We masked this static unit before, now we unmask it. \
  87. unmask "$unit_name" \
  88. fi \
  89. systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || : \
  90. else \
  91. systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || : \
  92. fi \
  93. fi \
  94. done \
  95. } \
  96. \
  97. restore_units() { \
  98. grep '^[[:space:]]*[^#;]' "$1" | while read action unit_name \
  99. do \
  100. if is_static "$unit_name" && is_masked "$unit_name" \
  101. then \
  102. # If the unit had been masked by us, we must unmask it here. \
  103. # Otherwise systemctl preset will fail badly. \
  104. unmask "$unit_name" \
  105. fi \
  106. systemctl --no-reload preset "$unit_name" >/dev/null 2>&1 || : \
  107. done \
  108. } \
  109. Name: qubes-core-agent
  110. Version: @VERSION@
  111. Release: 1%{dist}
  112. Summary: The Qubes core files for VM
  113. Group: Qubes
  114. Vendor: Invisible Things Lab
  115. License: GPL
  116. URL: https://www.qubes-os.org
  117. Conflicts: firewalld
  118. Requires: xdg-utils
  119. Requires: qubes-utils >= 3.1.3
  120. Requires: qubes-utils-libs >= 4.0.16
  121. Requires: initscripts
  122. Requires: gawk
  123. Requires: sed
  124. Requires: util-linux
  125. Requires: e2fsprogs
  126. Requires: hostname
  127. # for Qubes Manager VM updater
  128. Requires: xterm
  129. # for qubes-desktop-run
  130. Requires: python%{python3_pkgversion}-gobject-base
  131. Requires: python%{python3_pkgversion}-dbus
  132. # for qubes-session-autostart, xdg-icon
  133. Requires: python%{python3_pkgversion}-pyxdg
  134. Requires: python%{python3_pkgversion}-daemon
  135. # for qvm-feature-request
  136. Requires: python%{python3_pkgversion}-qubesdb
  137. # for qubes.ShowInTerminal RPC service
  138. Requires: socat
  139. Requires: ImageMagick
  140. Requires: librsvg2-tools
  141. Requires: zenity
  142. Requires: dconf
  143. Requires: qubes-core-qrexec-vm
  144. Requires: qubes-libvchan
  145. Requires: qubes-db-vm
  146. %if 0%{?rhel} == 8
  147. # we need to stick to related DNF python version
  148. # which is python3.6 by default
  149. Requires: python3-dnf-plugins-qubes-hooks
  150. %else
  151. Requires: python%{python3_pkgversion}-dnf-plugins-qubes-hooks
  152. %endif
  153. Requires: python%{python3_pkgversion}-setuptools
  154. # for qubes.ResizeDisk
  155. Requires: parted
  156. Obsoletes: qubes-core-vm-kernel-placeholder <= 1.0
  157. Obsoletes: qubes-upgrade-vm < 3.2
  158. Provides: qubes-core-vm = %{version}-%{release}
  159. Obsoletes: qubes-core-vm < 4.0.0
  160. Provides: qubes-core-vm-doc = %{version}-%{release}
  161. Obsoletes: qubes-core-vm-doc < 4.0.0
  162. Conflicts: qubes-gui-agent < 4.1.6
  163. BuildRequires: gcc
  164. BuildRequires: pandoc
  165. BuildRequires: xen-devel
  166. BuildRequires: libX11-devel
  167. BuildRequires: qubes-utils-devel >= 3.1.3
  168. BuildRequires: qubes-libvchan-@BACKEND_VMM@-devel
  169. BuildRequires: pam-devel
  170. BuildRequires: python%{python3_pkgversion}-setuptools
  171. BuildRequires: systemd
  172. Source0: %{name}-%{version}.tar.gz
  173. %description
  174. The Qubes core files for installation inside a Qubes VM.
  175. %package -n python2-dnf-plugins-qubes-hooks
  176. Summary: DNF plugin for Qubes specific post-installation actions
  177. BuildRequires: python2-devel
  178. %{?python_provide:%python_provide python2-dnf-plugins-qubes-hooks}
  179. %description -n python2-dnf-plugins-qubes-hooks
  180. DNF plugin for Qubes specific post-installation actions:
  181. * notify dom0 that updates were installed
  182. * refresh applications shortcut list
  183. %if 0%{?rhel} == 8
  184. %package -n python3-dnf-plugins-qubes-hooks
  185. Summary: DNF plugin for Qubes specific post-installation actions
  186. BuildRequires: python3-devel
  187. %description -n python3-dnf-plugins-qubes-hooks
  188. DNF plugin for Qubes specific post-installation actions:
  189. * notify dom0 that updates were installed
  190. * refresh applications shortcut list
  191. %else
  192. %package -n python%{python3_pkgversion}-dnf-plugins-qubes-hooks
  193. Summary: DNF plugin for Qubes specific post-installation actions
  194. BuildRequires: python%{python3_pkgversion}-devel
  195. %{?python_provide:%python_provide python%{python3_pkgversion}-dnf-plugins-qubes-hooks}
  196. %description -n python%{python3_pkgversion}-dnf-plugins-qubes-hooks
  197. DNF plugin for Qubes specific post-installation actions:
  198. * notify dom0 that updates were installed
  199. * refresh applications shortcut list
  200. %endif
  201. %package nautilus
  202. Summary: Qubes integration for Nautilus
  203. Requires: qubes-core-agent = %{version}
  204. Requires: nautilus-python
  205. Conflicts: qubes-core-vm < 4.0.0
  206. %description nautilus
  207. Nautilus addons for inter-VM file copy/move/open.
  208. %package dom0-updates
  209. Summary: Scripts required to handle dom0 updates
  210. Requires: qubes-core-agent = %{version}
  211. Requires: fakeroot
  212. Conflicts: qubes-core-vm < 4.0.0
  213. Requires: tar
  214. %description dom0-updates
  215. Scripts required to handle dom0 updates.
  216. %package networking
  217. Summary: Networking support for Qubes VM
  218. Requires: ethtool
  219. Requires: iptables
  220. Requires: net-tools
  221. Requires: iproute
  222. Requires: nftables
  223. Requires: socat
  224. Requires: qubes-core-agent = %{version}
  225. Requires: tinyproxy
  226. Conflicts: qubes-core-vm < 4.0.0
  227. %description networking
  228. This package provides:
  229. * basic network functionality (setting IP address, DNS, default gateway)
  230. * proxy service used by TemplateVMs to download updates
  231. * qubes-firewall service (FirewallVM)
  232. Note: if you want to use NetworkManager (you do want it in NetVM), install also
  233. qubes-core-agent-network-manager.
  234. %package network-manager
  235. Summary: NetworkManager integration for Qubes VM
  236. # to show/hide nm-applet
  237. Requires: NetworkManager >= 0.8.1-1
  238. Requires: glib2
  239. Requires: polkit
  240. Requires: qubes-core-agent-networking = %{version}
  241. Conflicts: qubes-core-vm < 4.0.0
  242. %description network-manager
  243. Integration of NetworkManager for Qubes VM:
  244. * make connections config persistent
  245. * adjust DNS redirections when needed
  246. * show/hide NetworkManager applet icon
  247. %package passwordless-root
  248. Summary: Passwordless root access from normal user
  249. Conflicts: qubes-core-vm < 4.0.0
  250. %description passwordless-root
  251. Configure sudo, PolicyKit and similar tool to not ask for any password when
  252. switching from user to root. Since all the user data in a VM is accessible
  253. already from normal user account, there is not much more to guard there. Qubes
  254. VM is a single user system.
  255. %package thunar
  256. Summary: Thunar support for Qubes VM tools
  257. Requires: Thunar
  258. %description thunar
  259. Thunar support for Qubes VM tools
  260. %define kde_service_dir /usr/share/kde4/services
  261. %define kde5_service_dir /usr/share/kservices5/ServiceMenus
  262. %prep
  263. %setup -q
  264. %build
  265. %{?set_build_flags}
  266. for dir in qubes-rpc misc; do
  267. make -C $dir BACKEND_VMM=@BACKEND_VMM@
  268. done
  269. make -C doc manpages
  270. %pre
  271. # Make sure there is a qubes group
  272. groupadd --force --system --gid 98 qubes
  273. id -u 'user' >/dev/null 2>&1 || {
  274. useradd --user-group --create-home --shell /bin/bash user
  275. }
  276. usermod -a --groups qubes user
  277. if [ "$1" != 1 ] ; then
  278. # do this whole %%pre thing only when updating for the first time...
  279. exit 0
  280. fi
  281. mkdir -p /var/lib/qubes
  282. if [ -e /etc/fstab ] ; then
  283. mv /etc/fstab /var/lib/qubes/fstab.orig
  284. fi
  285. usermod -L user
  286. %pre passwordless-root
  287. usermod -L root
  288. %install
  289. make install-vm PYTHON=%{__python3} DESTDIR=$RPM_BUILD_ROOT
  290. make -C app-menu DESTDIR=$RPM_BUILD_ROOT install
  291. make -C boot/redhat DESTDIR=$RPM_BUILD_ROOT install
  292. make -C config-overrides DESTDIR=$RPM_BUILD_ROOT install
  293. make -C filesystem DESTDIR=$RPM_BUILD_ROOT install
  294. make -C misc DESTDIR=$RPM_BUILD_ROOT install
  295. make -C network DESTDIR=$RPM_BUILD_ROOT install
  296. make -C passwordless-root DESTDIR=$RPM_BUILD_ROOT install install-rh
  297. make -C qubes-rpc DESTDIR=$RPM_BUILD_ROOT install
  298. make -C qubes-rpc/kde DESTDIR=$RPM_BUILD_ROOT install
  299. make -C qubes-rpc/nautilus DESTDIR=$RPM_BUILD_ROOT install
  300. make -C qubes-rpc/thunar DESTDIR=$RPM_BUILD_ROOT install
  301. make -C package-managers PYTHON=%{__python3} DESTDIR=$RPM_BUILD_ROOT install install-dnf
  302. %if 0%{?rhel} == 7
  303. make -C package-managers DESTDIR=$RPM_BUILD_ROOT install-yum
  304. %endif
  305. %if 0%{?rhel} >= 7
  306. sed -i \
  307. -e 's:-primary:-centos:' \
  308. -e 's:/fc:/centos:' \
  309. $RPM_BUILD_ROOT/etc/yum.repos.d/qubes-*.repo
  310. %endif
  311. install -D -m 0644 boot/dracut-qubes.conf $RPM_BUILD_ROOT/usr/lib/dracut/dracut.conf.d/30-qubes.conf
  312. install -D -m 0644 boot/grub.qubes $RPM_BUILD_ROOT/etc/default/grub.qubes
  313. %if ! %with_sysvinit
  314. rm -rf $RPM_BUILD_ROOT/etc/init.d/qubes-* $RPM_BUILD_ROOT/etc/sysconfig/modules/qubes-core.modules
  315. %endif
  316. %triggerin -- initscripts
  317. if [ -e /etc/init/serial.conf ]; then
  318. cp /usr/share/qubes/serial.conf /etc/init/serial.conf
  319. fi
  320. %triggerin -- grub2-tools
  321. if ! grep -q /etc/default/grub.qubes /etc/default/grub 2>/dev/null; then
  322. # do not keep Qubes-related settings directly in user-controlled config,
  323. # include another file
  324. echo '. /etc/default/grub.qubes' >> /etc/default/grub
  325. fi
  326. %triggerin passwordless-root -- util-linux
  327. qubesfile=/etc/pam.d/su.qubes
  328. origfile=${qubesfile%.qubes}
  329. backupfile=${origfile}.qubes-orig
  330. if [ -r "$origfile" -a ! -r "$backupfile" ]; then
  331. mv -f "$origfile" "$backupfile"
  332. fi
  333. ln -sf "$qubesfile" "$origfile"
  334. %post
  335. # disable some Upstart services
  336. for F in plymouth-shutdown prefdm splash-manager start-ttys tty ; do
  337. if [ -e /etc/init/$F.conf ]; then
  338. mv -f /etc/init/$F.conf /etc/init/$F.conf.disabled
  339. fi
  340. done
  341. chgrp user /var/lib/qubes/dom0-updates
  342. # Remove old firmware updates link
  343. if [ -L /lib/firmware/updates ]; then
  344. rm -f /lib/firmware/updates
  345. fi
  346. # convert /usr/local symlink to a mount point
  347. if [ -L /usr/local ]; then
  348. rm -f /usr/local
  349. mkdir /usr/local
  350. mount /usr/local || :
  351. fi
  352. # workaround for Fedora's systemd package bug
  353. # https://bugzilla.redhat.com/1559286
  354. if [ -d /var/lib/private ]; then
  355. chmod 700 /var/lib/private
  356. fi
  357. if test -f /etc/yum.conf && ! grep -q '/etc/yum\.conf\.d/qubes-proxy\.conf' /etc/yum.conf; then
  358. echo >> /etc/yum.conf
  359. echo '# Yum does not support inclusion of config dir...' >> /etc/yum.conf
  360. echo 'include=file:///etc/yum.conf.d/qubes-proxy.conf' >> /etc/yum.conf
  361. fi
  362. if ! [ -r /etc/dconf/profile/user ]; then
  363. mkdir -p /etc/dconf/profile
  364. echo "user-db:user" >> /etc/dconf/profile/user
  365. echo "system-db:local" >> /etc/dconf/profile/user
  366. fi
  367. dconf update &> /dev/null || :
  368. # And actually setup the proxy usage in package managers
  369. /usr/lib/qubes/update-proxy-configs
  370. # Location of files which contains list of protected files
  371. mkdir -p /etc/qubes/protected-files.d
  372. . /usr/lib/qubes/init/functions
  373. # qubes-core-vm has been broken for some time - it overrides /etc/hosts; restore original content
  374. if ! is_protected_file /etc/hosts ; then
  375. if ! grep -q localhost /etc/hosts; then
  376. cat <<EOF > /etc/hosts
  377. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 `hostname`
  378. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  379. EOF
  380. fi
  381. fi
  382. # ensure that hostname resolves to 127.0.0.1 resp. ::1 and that /etc/hosts is
  383. # in the form expected by qubes-sysinit.sh
  384. if ! is_protected_file /etc/hostname ; then
  385. for ip in '127\.0\.0\.1' '::1'; do
  386. if grep -q "^${ip}\(\s\|$\)" /etc/hosts; then
  387. sed -i "/^${ip}\s/,+0s/\(\s`hostname`\)\+\(\s\|$\)/\2/g" /etc/hosts
  388. sed -i "s/^${ip}\(\s\|$\).*$/\0 `hostname`/" /etc/hosts
  389. else
  390. echo "${ip} `hostname`" >> /etc/hosts
  391. fi
  392. done
  393. fi
  394. if [ "$1" != 1 ] ; then
  395. # do the rest of %%post thing only when updating for the first time...
  396. exit 0
  397. fi
  398. if [ -e /etc/init/serial.conf ] && ! [ -f /var/lib/qubes/serial.orig ] ; then
  399. cp /etc/init/serial.conf /var/lib/qubes/serial.orig
  400. fi
  401. # Remove most of the udev scripts to speed up the VM boot time
  402. # Just leave the xen* scripts, that are needed if this VM was
  403. # ever used as a net backend (e.g. as a VPN domain in the future)
  404. #echo "--> Removing unnecessary udev scripts..."
  405. mkdir -p /var/lib/qubes/removed-udev-scripts
  406. for f in /etc/udev/rules.d/*
  407. do
  408. if [ $(basename $f) == "xen-backend.rules" ] ; then
  409. continue
  410. fi
  411. if echo $f | grep -q qubes; then
  412. continue
  413. fi
  414. mv $f /var/lib/qubes/removed-udev-scripts/
  415. done
  416. mkdir -p /rw
  417. #rm -f /etc/mtab
  418. #echo "--> Removing HWADDR setting from /etc/sysconfig/network-scripts/ifcfg-eth0"
  419. #mv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.orig
  420. #grep -v HWADDR /etc/sysconfig/network-scripts/ifcfg-eth0.orig > /etc/sysconfig/network-scripts/ifcfg-eth0
  421. %triggerin -- notification-daemon
  422. # Enable autostart of notification-daemon when installed
  423. if [ ! -e /etc/xdg/autostart/notification-daemon.desktop ]; then
  424. ln -s /usr/share/applications/notification-daemon.desktop /etc/xdg/autostart/
  425. fi
  426. exit 0
  427. %triggerin -- selinux-policy
  428. #echo "--> Disabling SELinux..."
  429. sed -e s/^SELINUX=.*$/SELINUX=disabled/ </etc/selinux/config >/etc/selinux/config.processed
  430. mv /etc/selinux/config.processed /etc/selinux/config
  431. setenforce 0 2>/dev/null
  432. exit 0
  433. %post network-manager
  434. # Create NetworkManager configuration if we do not have it
  435. if ! [ -e /etc/NetworkManager/NetworkManager.conf ]; then
  436. echo '[main]' > /etc/NetworkManager/NetworkManager.conf
  437. echo 'plugins = keyfile' >> /etc/NetworkManager/NetworkManager.conf
  438. echo '[keyfile]' >> /etc/NetworkManager/NetworkManager.conf
  439. fi
  440. # Remove ip_forward setting from sysctl, so NM will not reset it
  441. sed 's/^net.ipv4.ip_forward.*/#\0/' -i /etc/sysctl.conf
  442. /usr/lib/qubes/qubes-fix-nm-conf.sh
  443. %post networking
  444. %systemd_post qubes-firewall.service
  445. %systemd_post qubes-iptables.service
  446. %systemd_post qubes-network.service
  447. %systemd_post qubes-updates-proxy.service
  448. %post thunar
  449. if [ "$1" = 1 ]; then
  450. # There is no system-wide Thunar custom actions. There is only a default
  451. # file and a user file created from the default one. Qubes actions need
  452. # to be placed after all already defined actions and before </actions>
  453. # the end of file.
  454. if [ -f /etc/xdg/Thunar/uca.xml ] ; then
  455. cp -p /etc/xdg/Thunar/uca.xml{,.bak}
  456. sed -i '$e cat /usr/lib/qubes/uca_qubes.xml' /etc/xdg/Thunar/uca.xml
  457. fi
  458. if [ -f /home/user/.config/Thunar/uca.xml ] ; then
  459. cp -p /home/user/.config/Thunar/uca.xml{,.bak}
  460. sed -i '$e cat /usr/lib/qubes/uca_qubes.xml' /home/user/.config/Thunar/uca.xml
  461. fi
  462. fi
  463. %preun
  464. if [ "$1" = 0 ] ; then
  465. # no more packages left
  466. if [ -e /var/lib/qubes/fstab.orig ] ; then
  467. mv /var/lib/qubes/fstab.orig /etc/fstab
  468. fi
  469. mv /var/lib/qubes/removed-udev-scripts/* /etc/udev/rules.d/
  470. if [ -e /var/lib/qubes/serial.orig ] ; then
  471. mv /var/lib/qubes/serial.orig /etc/init/serial.conf
  472. fi
  473. fi
  474. %preun networking
  475. %systemd_preun qubes-firewall.service
  476. %systemd_preun qubes-iptables.service
  477. %systemd_preun qubes-network.service
  478. %systemd_preun qubes-updates-proxy.service
  479. %postun thunar
  480. if [ "$1" = 0 ]; then
  481. if [ -f /etc/xdg/Thunar/uca.xml ] ; then
  482. mv /etc/xdg/Thunar/uca.xml{,.uninstall}
  483. mv /etc/xdg/Thunar/uca.xml{.bak,}
  484. fi
  485. if [ -f /home/user/.config/Thunar/uca.xml ] ; then
  486. mv /home/user/.config/Thunar/uca.xml{,.uninstall}
  487. mv /home/user/.config/Thunar/uca.xml{.bak,}
  488. fi
  489. fi
  490. %postun
  491. if [ $1 -eq 0 ] ; then
  492. /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
  493. if [ -L /lib/firmware/updates ]; then
  494. rm /lib/firmware/updates
  495. fi
  496. rm -rf /var/lib/qubes/xdg
  497. fi
  498. %postun passwordless-root
  499. if [ $1 -eq 0 ]; then
  500. usermod -p '*' root
  501. fi
  502. qubesfile=/etc/pam.d/su.qubes
  503. origfile=${qubesfile%.qubes}
  504. backupfile=${origfile}.qubes-orig
  505. if [ -f "$backupfile" ]; then
  506. mv -f "$backupfile" "$origfile"
  507. fi
  508. %posttrans
  509. /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
  510. %clean
  511. rm -rf $RPM_BUILD_ROOT
  512. rm -f %{name}-%{version}
  513. %files
  514. %defattr(-,root,root,-)
  515. %dir /var/lib/qubes
  516. %{kde_service_dir}/qvm-copy.desktop
  517. %{kde_service_dir}/qvm-move.desktop
  518. %{kde_service_dir}/qvm-dvm.desktop
  519. %{kde5_service_dir}/qvm-copy.desktop
  520. %{kde5_service_dir}/qvm-move.desktop
  521. %{kde5_service_dir}/qvm-dvm.desktop
  522. /etc/fstab
  523. /etc/pki/rpm-gpg/RPM-GPG-KEY-qubes*
  524. %dir /etc/qubes-rpc
  525. %config(noreplace) /etc/qubes-rpc/qubes.ShowInTerminal
  526. %config(noreplace) /etc/qubes-rpc/qubes.Filecopy
  527. %config(noreplace) /etc/qubes-rpc/qubes.OpenInVM
  528. %config(noreplace) /etc/qubes-rpc/qubes.OpenURL
  529. %config(noreplace) /etc/qubes-rpc/qubes.GetAppmenus
  530. %config(noreplace) /etc/qubes-rpc/qubes.ConnectTCP
  531. %config(noreplace) /etc/qubes-rpc/qubes.VMShell
  532. %config(noreplace) /etc/qubes-rpc/qubes.VMExec
  533. %config(noreplace) /etc/qubes-rpc/qubes.VMExecGUI
  534. %config(noreplace) /etc/qubes-rpc/qubes.VMRootShell
  535. %config(noreplace) /etc/qubes-rpc/qubes.SuspendPre
  536. %config(noreplace) /etc/qubes-rpc/qubes.SuspendPreAll
  537. %config(noreplace) /etc/qubes-rpc/qubes.SuspendPost
  538. %config(noreplace) /etc/qubes-rpc/qubes.SuspendPostAll
  539. %config(noreplace) /etc/qubes-rpc/qubes.WaitForSession
  540. %config(noreplace) /etc/qubes-rpc/qubes.DetachPciDevice
  541. %config(noreplace) /etc/qubes-rpc/qubes.Backup
  542. %config(noreplace) /etc/qubes-rpc/qubes.Restore
  543. %config(noreplace) /etc/qubes-rpc/qubes.RegisterBackupLocation
  544. %config(noreplace) /etc/qubes-rpc/qubes.RestoreById
  545. %config(noreplace) /etc/qubes-rpc/qubes.SelectFile
  546. %config(noreplace) /etc/qubes-rpc/qubes.SelectDirectory
  547. %config(noreplace) /etc/qubes-rpc/qubes.GetImageRGBA
  548. %config(noreplace) /etc/qubes-rpc/qubes.SetDateTime
  549. %config(noreplace) /etc/qubes-rpc/qubes.InstallUpdatesGUI
  550. %config(noreplace) /etc/qubes-rpc/qubes.ResizeDisk
  551. %config(noreplace) /etc/qubes-rpc/qubes.StartApp
  552. %config(noreplace) /etc/qubes-rpc/qubes.PostInstall
  553. %config(noreplace) /etc/qubes-rpc/qubes.GetDate
  554. %config(noreplace) /etc/qubes-rpc/qubes.TemplateSearch
  555. %config(noreplace) /etc/qubes-rpc/qubes.TemplateDownload
  556. %config(noreplace) /etc/qubes/rpc-config/qubes.OpenInVM
  557. %config(noreplace) /etc/qubes/rpc-config/qubes.OpenURL
  558. %config(noreplace) /etc/qubes/rpc-config/qubes.SelectFile
  559. %config(noreplace) /etc/qubes/rpc-config/qubes.SelectDirectory
  560. %config(noreplace) /etc/qubes/rpc-config/qubes.ShowInTerminal
  561. %config(noreplace) /etc/qubes/rpc-config/qubes.StartApp
  562. %config(noreplace) /etc/qubes/rpc-config/qubes.InstallUpdatesGUI
  563. %config(noreplace) /etc/qubes/rpc-config/qubes.VMShell+WaitForSession
  564. %config(noreplace) /etc/qubes/rpc-config/qubes.VMExecGUI
  565. %config(noreplace) /etc/default/grub.qubes
  566. %dir /etc/qubes/autostart
  567. /etc/qubes/autostart/README.txt
  568. %config /etc/qubes/autostart/*.desktop.d/30_qubes.conf
  569. %dir /etc/qubes/applications
  570. /etc/qubes/applications/README.txt
  571. %config /etc/qubes/applications/*.desktop.d/30_qubes.conf
  572. %dir /etc/qubes/suspend-pre.d
  573. /etc/qubes/suspend-pre.d/README
  574. %dir /etc/qubes/suspend-post.d
  575. /etc/qubes/suspend-post.d/README
  576. /etc/qubes/suspend-post.d/qvm-sync-clock.sh
  577. %dir /etc/qubes/post-install.d
  578. /etc/qubes/post-install.d/README
  579. /etc/qubes/post-install.d/*.sh
  580. %config(noreplace) /etc/profile.d/qt_x11_no_mitshm.sh
  581. %config(noreplace) /etc/sudoers.d/qt_x11_no_mitshm
  582. %config(noreplace) /etc/sudoers.d/umask
  583. %config(noreplace) /etc/sysctl.d/20_tcp_timestamps.conf
  584. %config(noreplace) /etc/qubes-suspend-module-blacklist
  585. %config(noreplace) /etc/yum.conf.d/qubes-proxy.conf
  586. %config(noreplace) /etc/yum.repos.d/qubes-r4.repo
  587. %if 0%{?rhel} == 7
  588. /etc/yum/pluginconf.d/yum-qubes-hooks.conf
  589. /usr/lib/yum-plugins/yum-qubes-hooks.py*
  590. %endif
  591. %config(noreplace) /etc/dnf/plugins/qubes-hooks.conf
  592. %config(noreplace) /etc/dconf/db/local.d/dpi
  593. /lib/udev/rules.d/50-qubes-mem-hotplug.rules
  594. /usr/lib/systemd/system/user@.service.d/90-session-stop-timeout.conf
  595. /usr/sbin/qubes-serial-login
  596. /usr/bin/qvm-copy-to-vm
  597. /usr/bin/qvm-move-to-vm
  598. /usr/bin/qvm-copy
  599. /usr/bin/qvm-move
  600. /usr/bin/qvm-open-in-dvm
  601. /usr/bin/qvm-open-in-vm
  602. /usr/bin/qvm-run-vm
  603. /usr/bin/qvm-features-request
  604. /usr/bin/qvm-sync-clock
  605. /usr/bin/qubes-desktop-run
  606. /usr/bin/qubes-run-terminal
  607. /usr/bin/qubes-run-gnome-terminal
  608. /usr/bin/qubes-open
  609. /usr/bin/qubes-session-autostart
  610. /usr/bin/qvm-connect-tcp
  611. /usr/bin/qubes-vmexec
  612. %dir /usr/lib/qubes
  613. /usr/lib/qubes/prepare-suspend
  614. /usr/lib/qubes/qfile-agent
  615. %attr(4755,root,root) /usr/lib/qubes/qfile-unpacker
  616. /usr/lib/qubes/qopen-in-vm
  617. /usr/lib/qubes/qrun-in-vm
  618. /usr/lib/qubes/qubes-trigger-sync-appmenus.sh
  619. /usr/lib/qubes/qvm-copy-to-vm.kde
  620. /usr/lib/qubes/qvm-move-to-vm.kde
  621. /usr/lib/qubes/tar2qfile
  622. /usr/lib/qubes/vm-file-editor
  623. /usr/lib/qubes/xdg-icon
  624. /usr/lib/qubes/update-proxy-configs
  625. /usr/lib/qubes/upgrades-installed-check
  626. /usr/lib/qubes/upgrades-status-notify
  627. /usr/lib/qubes/qubes-sync-clock
  628. /usr/lib/qubes/resize-rootfs
  629. /usr/lib/qubes/tinyproxy-wrapper
  630. /usr/lib/qubes/qvm-template-repo-query
  631. /usr/lib/dracut/dracut.conf.d/30-qubes.conf
  632. %dir /usr/lib/qubes/init
  633. /usr/lib/qubes/init/bind-dirs.sh
  634. /usr/lib/qubes/init/control-printer-icon.sh
  635. /usr/lib/qubes/init/functions
  636. /usr/lib/qubes/init/misc-post-stop.sh
  637. /usr/lib/qubes/init/misc-post.sh
  638. /usr/lib/qubes/init/mount-dirs.sh
  639. /usr/lib/qubes/init/qubes-early-vm-config.sh
  640. /usr/lib/qubes/init/qubes-random-seed.sh
  641. /usr/lib/qubes/init/qubes-sysinit.sh
  642. /usr/lib/qubes/init/resize-rootfs-if-needed.sh
  643. /usr/lib/qubes/init/setup-rw.sh
  644. /usr/lib/qubes/init/setup-rwdev.sh
  645. %dir /usr/lib/qubes-bind-dirs.d
  646. /usr/lib/qubes-bind-dirs.d/30_cron.conf
  647. /usr/share/applications/qubes-run-terminal.desktop
  648. /usr/share/applications/qubes-open-file-manager.desktop
  649. /usr/share/qubes/serial.conf
  650. /usr/share/qubes/marker-vm
  651. /usr/share/glib-2.0/schemas/20_org.gnome.settings-daemon.plugins.updates.qubes.gschema.override
  652. /usr/share/glib-2.0/schemas/20_org.gnome.nautilus.qubes.gschema.override
  653. /usr/share/glib-2.0/schemas/20_org.mate.NotificationDaemon.qubes.gschema.override
  654. /usr/share/glib-2.0/schemas/20_org.gnome.desktop.wm.preferences.qubes.gschema.override
  655. %{_mandir}/man1/qvm-*.1*
  656. %dir %{python3_sitelib}/qubesagent-*-py*.egg-info
  657. %{python3_sitelib}/qubesagent-*-py*.egg-info/*
  658. %{python3_sitelib}/qubesagent/__pycache__
  659. %dir %{python3_sitelib}/qubesagent
  660. %{python3_sitelib}/qubesagent/__init__.py*
  661. %{python3_sitelib}/qubesagent/firewall.py*
  662. %{python3_sitelib}/qubesagent/test_firewall.py*
  663. %{python3_sitelib}/qubesagent/vmexec.py*
  664. %{python3_sitelib}/qubesagent/test_vmexec.py*
  665. %{python3_sitelib}/qubesagent/xdg.py*
  666. %{python3_sitelib}/qubesagent/test_xdg.py*
  667. /usr/share/qubes/mime-override/globs
  668. /usr/share/qubes/qubes-master-key.asc
  669. %dir /mnt/removable
  670. %dir /rw
  671. %files -n python2-dnf-plugins-qubes-hooks
  672. %{python2_sitelib}/dnf-plugins/*
  673. %if 0%{?rhel} == 8
  674. %files -n python3-dnf-plugins-qubes-hooks
  675. %{plateform_python3_sitelib}/dnf-plugins/*
  676. %else
  677. %files -n python%{python3_pkgversion}-dnf-plugins-qubes-hooks
  678. %{python3_sitelib}/dnf-plugins/*
  679. %endif
  680. %files nautilus
  681. /usr/lib/qubes/qvm-copy-to-vm.gnome
  682. /usr/lib/qubes/qvm-move-to-vm.gnome
  683. /usr/share/nautilus-python/extensions/qvm_copy_nautilus.py*
  684. /usr/share/nautilus-python/extensions/qvm_move_nautilus.py*
  685. /usr/share/nautilus-python/extensions/qvm_dvm_nautilus.py*
  686. /usr/lib/qubes/qvm_nautilus_bookmark.sh
  687. %files thunar
  688. /usr/lib/qubes/qvm-actions.sh
  689. /usr/lib/qubes/uca_qubes.xml
  690. /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/thunar.xml
  691. %files dom0-updates
  692. %dir %attr(0775,user,user) /var/lib/qubes/dom0-updates
  693. /usr/lib/qubes/qubes-download-dom0-updates.sh
  694. %files networking
  695. %config(noreplace) /etc/qubes-rpc/qubes.UpdatesProxy
  696. %config(noreplace) /etc/qubes/ip6tables.rules
  697. %config(noreplace) /etc/qubes/ip6tables-enabled.rules
  698. %config(noreplace) /etc/qubes/iptables.rules
  699. %config(noreplace) /etc/tinyproxy/tinyproxy-updates.conf
  700. %config(noreplace) /etc/tinyproxy/updates-blacklist
  701. %config(noreplace) /etc/udev/rules.d/99-qubes-network.rules
  702. /etc/dhclient.d/qubes-setup-dnat-to-ns.sh
  703. /etc/xen/scripts/vif-qubes-nat.sh
  704. /etc/xen/scripts/vif-route-qubes
  705. /lib/systemd/system/qubes-firewall.service
  706. /lib/systemd/system/qubes-iptables.service
  707. /lib/systemd/system/qubes-network.service
  708. /lib/systemd/system/qubes-network-uplink.service
  709. /lib/systemd/system/qubes-network-uplink@.service
  710. /lib/systemd/system/qubes-updates-proxy.service
  711. /usr/lib/qubes/init/network-proxy-setup.sh
  712. /usr/lib/qubes/init/network-proxy-stop.sh
  713. /usr/lib/qubes/init/network-uplink-wait.sh
  714. /usr/lib/qubes/init/qubes-iptables
  715. /usr/lib/qubes/iptables-updates-proxy
  716. /usr/lib/qubes/qubes-setup-dnat-to-ns
  717. /usr/lib/qubes/setup-ip
  718. /usr/lib/tmpfiles.d/qubes-core-agent-linux.conf
  719. /usr/bin/qubes-firewall
  720. %files network-manager
  721. /etc/NetworkManager/dispatcher.d/30-qubes-external-ip
  722. /etc/NetworkManager/dispatcher.d/qubes-nmhook
  723. /etc/xdg/autostart/00-qubes-show-hide-nm-applet.desktop
  724. /usr/lib/NetworkManager/conf.d/30-qubes.conf
  725. /usr/lib/qubes/network-manager-prepare-conf-dir
  726. /usr/lib/qubes/qubes-fix-nm-conf.sh
  727. /usr/lib/qubes/show-hide-nm-applet.sh
  728. %files passwordless-root
  729. %config(noreplace) /etc/polkit-1/localauthority/50-local.d/qubes-allow-all.pkla
  730. %config(noreplace) /etc/polkit-1/rules.d/00-qubes-allow-all.rules
  731. %config(noreplace) /etc/sudoers.d/qubes
  732. %config(noreplace) /etc/pam.d/su.qubes
  733. %if %with_sysvinit
  734. %package sysvinit
  735. Summary: Qubes unit files for SysV init style or upstart
  736. License: GPL v2 only
  737. Group: Qubes
  738. Requires: upstart
  739. Requires: qubes-core-agent = %{version}
  740. Requires: qubes-core-qrexec-vm
  741. Requires: qubes-core-agent-networking = %{version}
  742. Provides: qubes-core-agent-init-scripts
  743. Conflicts: qubes-core-agent-systemd
  744. Provides: qubes-core-vm-sysvinit = %{version}-%{release}
  745. Obsoletes: qubes-core-vm-sysvinit < 4.0.0
  746. %description sysvinit
  747. The Qubes core startup configuration for SysV init (or upstart).
  748. %files sysvinit
  749. /etc/init.d/qubes-sysinit
  750. /etc/init.d/qubes-core-early
  751. /etc/init.d/qubes-core
  752. /etc/init.d/qubes-core-netvm
  753. /etc/init.d/qubes-firewall
  754. /etc/init.d/qubes-iptables
  755. /etc/init.d/qubes-updates-proxy
  756. /etc/init.d/qubes-updates-proxy-forwarder
  757. /etc/sysconfig/modules/qubes-core.modules
  758. %post sysvinit
  759. #echo "--> Turning off unnecessary services..."
  760. # FIXME: perhaps there is more elegant way to do this?
  761. for f in /etc/init.d/*
  762. do
  763. srv=`basename $f`
  764. [ $srv = 'functions' ] && continue
  765. [ $srv = 'killall' ] && continue
  766. [ $srv = 'halt' ] && continue
  767. [ $srv = 'single' ] && continue
  768. [ $srv = 'reboot' ] && continue
  769. [ $srv = 'qubes-gui' ] && continue
  770. chkconfig $srv off
  771. done
  772. #echo "--> Enabling essential services..."
  773. chkconfig rsyslog on
  774. chkconfig haldaemon on
  775. chkconfig messagebus on
  776. for svc in %qubes_services ; do
  777. if [ "$1" = 1 ] ; then
  778. chkconfig --add $svc || echo "WARNING: Cannot add service $svc!"
  779. else
  780. chkconfig $svc resetpriorities || echo "WARNING: Cannot reset priorities of service $svc!"
  781. fi
  782. done
  783. # TODO: make this not display the silly message about security context...
  784. sed -i s/^id:.:initdefault:/id:3:initdefault:/ /etc/inittab
  785. %preun sysvinit
  786. if [ "$1" = 0 ] ; then
  787. # no more packages left
  788. for svc in %qubes_services ; do
  789. chkconfig --del $svc
  790. done
  791. fi
  792. %endif
  793. %package systemd
  794. Summary: Qubes unit files for SystemD init style
  795. License: GPL v2 only
  796. Group: Qubes
  797. Requires: systemd
  798. Requires(post): systemd-units
  799. Requires(preun): systemd-units
  800. Requires(postun): systemd-units
  801. Requires: qubes-core-agent = %{version}
  802. Provides: qubes-core-agent-init-scripts
  803. Conflicts: qubes-core-agent-sysvinit
  804. Provides: qubes-core-vm-systemd = %{version}-%{release}
  805. Obsoletes: qubes-core-vm-systemd < 4.0.0
  806. Conflicts: qubes-gui-agent < 4.1.0
  807. %description systemd
  808. The Qubes core startup configuration for SystemD init.
  809. %files systemd
  810. %defattr(-,root,root,-)
  811. /etc/systemd/system/xendriverdomain.service
  812. /lib/systemd/system/dev-xvdc1-swap.service
  813. /lib/systemd/system/qubes-misc-post.service
  814. /lib/systemd/system/qubes-mount-dirs.service
  815. /lib/systemd/system/qubes-rootfs-resize.service
  816. /lib/systemd/system/qubes-sysinit.service
  817. /lib/systemd/system/qubes-early-vm-config.service
  818. /lib/systemd/system/qubes-update-check.service
  819. /lib/systemd/system/qubes-update-check.timer
  820. /lib/systemd/system/qubes-sync-time.service
  821. /lib/systemd/system/qubes-sync-time.timer
  822. /lib/systemd/system/qubes-updates-proxy-forwarder@.service
  823. /lib/systemd/system/qubes-updates-proxy-forwarder.socket
  824. /lib/systemd/system-preset/%qubes_preset_file
  825. /lib/modules-load.d/qubes-core.conf
  826. /lib/systemd/system/boot.automount.d/30_qubes.conf
  827. /lib/systemd/system/chronyd.service.d/30_qubes.conf
  828. /lib/systemd/system/crond.service.d/30_qubes.conf
  829. /lib/systemd/system/cups.service.d/30_qubes.conf
  830. /lib/systemd/system/cups.socket.d/30_qubes.conf
  831. /lib/systemd/system/cups.path.d/30_qubes.conf
  832. /lib/systemd/system/cups-browsed.service.d/30_qubes.conf
  833. /lib/systemd/system/org.cups.cupsd.service.d/30_qubes.conf
  834. /lib/systemd/system/org.cups.cupsd.socket.d/30_qubes.conf
  835. /lib/systemd/system/org.cups.cupsd.path.d/30_qubes.conf
  836. /lib/systemd/system/getty@tty.service.d/30_qubes.conf
  837. /lib/systemd/system/ModemManager.service.d/30_qubes.conf
  838. /lib/systemd/system/NetworkManager.service.d/30_qubes.conf
  839. /lib/systemd/system/NetworkManager-wait-online.service.d/30_qubes.conf
  840. /lib/systemd/system/serial-getty@.service.d/30_qubes.conf
  841. /lib/systemd/system/systemd-random-seed.service.d/30_qubes.conf
  842. /lib/systemd/system/systemd-timesyncd.service.d/30_qubes.conf
  843. /lib/systemd/system/tinyproxy.service.d/30_not_needed_in_qubes_by_default.conf
  844. /lib/systemd/system/tor.service.d/30_qubes.conf
  845. /lib/systemd/system/tor@default.service.d/30_qubes.conf
  846. /lib/systemd/system/tmp.mount.d/30_qubes.conf
  847. /usr/lib/systemd/user/pulseaudio.service.d/30_qubes.conf
  848. /usr/lib/systemd/user/pulseaudio.socket.d/30_qubes.conf
  849. %post systemd
  850. changed=
  851. %scriptletfuns
  852. if [ $1 -eq 1 ]
  853. then
  854. preset_units %{_presetdir}/%qubes_preset_file initial
  855. changed=true
  856. else
  857. preset_units %{_presetdir}/%qubes_preset_file upgrade
  858. changed=true
  859. # Upgrade path - now qubes-iptables is used instead
  860. for svc in iptables ip6tables
  861. do
  862. if [ -f "$svc".service ]
  863. then
  864. systemctl --no-reload preset "$svc".service
  865. changed=true
  866. fi
  867. done
  868. fi
  869. if [ $1 -eq 1 ]
  870. then
  871. # First install.
  872. # Set default "runlevel".
  873. # FIXME: this ought to be done via kernel command line.
  874. # The fewer deviations of the template from the seed
  875. # image, the better.
  876. rm -f %{_sysconfdir}/systemd/system/default.target
  877. ln -s %{_unitdir}/multi-user.target %{_sysconfdir}/systemd/system/default.target
  878. changed=true
  879. fi
  880. # remove old symlinks
  881. if [ -L %{_sysconfdir}/systemd/system/sysinit.target.wants/qubes-random-seed.service ]
  882. then
  883. rm -f %{_sysconfdir}/systemd/system/sysinit.target.wants/qubes-random-seed.service
  884. changed=true
  885. fi
  886. if [ -L %{_sysconfdir}/systemd/system/multi-user.target.wants/qubes-mount-home.service ]
  887. then
  888. rm -f %{_sysconfdir}/systemd/system/multi-user.target.wants/qubes-mount-home.service
  889. changed=true
  890. fi
  891. if [ "x$changed" != "x" ]
  892. then
  893. systemctl daemon-reload
  894. fi
  895. %preun systemd
  896. if [ $1 -eq 0 ] ; then
  897. # Run this only during uninstall.
  898. # Save the preset file to later use it to re-preset services there
  899. # once the Qubes OS preset file is removed.
  900. mkdir -p %{_rundir}/qubes-uninstall
  901. cp -f %{_presetdir}/%qubes_preset_file %{_rundir}/qubes-uninstall/
  902. fi
  903. %postun systemd
  904. changed=
  905. %scriptletfuns
  906. if [ -d %{_rundir}/qubes-uninstall ]
  907. then
  908. # We have a saved preset file (or more).
  909. # Re-preset the units mentioned there.
  910. restore_units %{_rundir}/qubes-uninstall/%qubes_preset_file
  911. rm -rf %{_rundir}/qubes-uninstall
  912. changed=true
  913. fi
  914. if [ "x$changed" != "x" ]
  915. then
  916. systemctl daemon-reload
  917. fi
  918. %changelog
  919. @CHANGELOG@