From 85694a87d27e432e33e6ea665a12cc57e78da4d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 30 Jan 2014 02:41:58 +0100 Subject: [PATCH 1/6] Hide nm-applet when NetworkManager is disabled It isn't done automatically by nm-applet itself since nm-applet 0.9.9.0 (fc19+), this one commit: https://git.gnome.org/browse/network-manager-applet/commit?id=276a702000ee9e509321891f5ffa9789acfb053c At the same time they've introduced option to manually hide the icon: https://git.gnome.org/browse/network-manager-applet/commit?id=e7331a3f33ab422ea6c1bbc015ad44d8d9c83bc3 --- vm-systemd/misc-post.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vm-systemd/misc-post.sh b/vm-systemd/misc-post.sh index e0c2909..35b0505 100755 --- a/vm-systemd/misc-post.sh +++ b/vm-systemd/misc-post.sh @@ -48,6 +48,11 @@ fi # Start services which haven't own proper systemd unit: +# Hide nm-applet when network-manager is disabled +nm_enabled=false +[ -f /var/run/qubes-service/network-manager ] && nm_enabled=true +su -c "gsettings set org.gnome.nm-applet show-applet $nm_enabled" user 2> /dev/null + # Start AppVM specific services if [ ! -f /etc/systemd/system/cups.service ]; then if [ -f /var/run/qubes-service/cups ]; then From 99708afc528b49dd178a1b1dbd306d418220b9df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 30 Jan 2014 02:53:08 +0100 Subject: [PATCH 2/6] systemd: disable ModemManager in non-NetVM Previously ModemManager was started by NetworkManager, but in fc20+ it is a separate service, so disable it when not needed. --- Makefile | 1 + rpm_spec/core-vm.spec | 6 +++++- vm-systemd/ModemManager.service | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 vm-systemd/ModemManager.service diff --git a/Makefile b/Makefile index 3173e21..bf1a824 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,7 @@ install-vm: install -m 0755 vm-systemd/*.sh $(DESTDIR)/usr/lib/qubes/init/ install -m 0644 vm-systemd/qubes-*.service $(DESTDIR)/lib/systemd/system/ install -m 0644 vm-systemd/qubes-*.timer $(DESTDIR)/lib/systemd/system/ + install -m 0644 vm-systemd/ModemManager.service $(DESTDIR)/usr/lib/qubes/init/ install -m 0644 vm-systemd/NetworkManager.service $(DESTDIR)/usr/lib/qubes/init/ install -m 0644 vm-systemd/NetworkManager-wait-online.service $(DESTDIR)/usr/lib/qubes/init/ install -m 0644 vm-systemd/cups.* $(DESTDIR)/usr/lib/qubes/init/ diff --git a/rpm_spec/core-vm.spec b/rpm_spec/core-vm.spec index 835f656..fe79628 100644 --- a/rpm_spec/core-vm.spec +++ b/rpm_spec/core-vm.spec @@ -448,6 +448,7 @@ The Qubes core startup configuration for SystemD init. /usr/lib/qubes/init/misc-post.sh /usr/lib/qubes/init/misc-post-stop.sh /usr/lib/qubes/init/qubes-sysinit.sh +/usr/lib/qubes/init/ModemManager.service /usr/lib/qubes/init/NetworkManager.service /usr/lib/qubes/init/NetworkManager-wait-online.service /usr/lib/qubes/init/cups.service @@ -455,6 +456,7 @@ The Qubes core startup configuration for SystemD init. /usr/lib/qubes/init/cups.path /usr/lib/qubes/init/ntpd.service /usr/lib/qubes/init/chronyd.service +%ghost %attr(0644,root,root) /etc/systemd/system/ModemManager.service %ghost %attr(0644,root,root) /etc/systemd/system/NetworkManager.service %ghost %attr(0644,root,root) /etc/systemd/system/NetworkManager-wait-online.service %ghost %attr(0644,root,root) /etc/systemd/system/cups.service @@ -473,7 +475,7 @@ UNITDIR=/lib/systemd/system OVERRIDEDIR=/usr/lib/qubes/init # Install overriden services only when original exists -for srv in cups NetworkManager NetworkManager-wait-online ntpd chronyd; do +for srv in cups ModemManager NetworkManager NetworkManager-wait-online ntpd chronyd; do if [ -f $UNITDIR/$srv.service ]; then cp $OVERRIDEDIR/$srv.service /etc/systemd/system/ fi @@ -514,9 +516,11 @@ rm -f /etc/systemd/system/getty.target.wants/getty@tty*.service /bin/systemctl enable rsyslog.service 2> /dev/null /bin/systemctl enable ntpd.service 2> /dev/null # Disable original service to enable overriden one +/bin/systemctl disable ModemManager.service 2> /dev/null /bin/systemctl disable NetworkManager.service 2> /dev/null # Disable D-BUS activation of NetworkManager - in AppVm it causes problems (eg PackageKit timeouts) /bin/systemctl mask dbus-org.freedesktop.NetworkManager.service 2> /dev/null +/bin/systemctl enable ModemManager.service 2> /dev/null /bin/systemctl enable NetworkManager.service 2> /dev/null # Fix for https://bugzilla.redhat.com/show_bug.cgi?id=974811 /bin/systemctl enable NetworkManager-dispatcher.service 2> /dev/null diff --git a/vm-systemd/ModemManager.service b/vm-systemd/ModemManager.service new file mode 100644 index 0000000..f530073 --- /dev/null +++ b/vm-systemd/ModemManager.service @@ -0,0 +1,4 @@ +.include /lib/systemd/system/ModemManager.service +[Unit] +ConditionPathExists=|/var/run/qubes-service/network-manager +ConditionPathExists=|/var/run/qubes-service/modem-manager From 948555bdea51db507f591431871b5c3981958dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 30 Jan 2014 02:54:16 +0100 Subject: [PATCH 3/6] systemd: fix handling of .path units overrides --- rpm_spec/core-vm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpm_spec/core-vm.spec b/rpm_spec/core-vm.spec index fe79628..4442af9 100644 --- a/rpm_spec/core-vm.spec +++ b/rpm_spec/core-vm.spec @@ -483,7 +483,7 @@ for srv in cups ModemManager NetworkManager NetworkManager-wait-online ntpd chro cp $OVERRIDEDIR/$srv.socket /etc/systemd/system/ fi if [ -f $UNITDIR/$srv.path -a -f $OVERRIDEDIR/$srv.path ]; then - cp $OVERRIDEDIR/$srv.service /etc/systemd/system/ + cp $OVERRIDEDIR/$srv.path /etc/systemd/system/ fi done From 453ab0f22cb24e29558e63b703d1fe6546189d73 Mon Sep 17 00:00:00 2001 From: Wojciech Zygmunt Porczyk Date: Thu, 30 Jan 2014 16:30:17 +0100 Subject: [PATCH 4/6] qubes.GetImageRGBA for appicons --- Makefile | 1 + qubes-rpc/qubes.GetImageRGBA | 31 +++++++++++++++++++++++++++++++ rpm_spec/core-vm.spec | 2 ++ 3 files changed, 34 insertions(+) create mode 100644 qubes-rpc/qubes.GetImageRGBA diff --git a/Makefile b/Makefile index 553c552..789bb74 100644 --- a/Makefile +++ b/Makefile @@ -138,6 +138,7 @@ install-vm: install -m 0644 qubes-rpc/qubes.WaitForSession $(DESTDIR)/etc/qubes-rpc install -m 0644 qubes-rpc/qubes.DetachPciDevice $(DESTDIR)/etc/qubes-rpc install -m 0644 qubes-rpc/qubes.{Backup,Restore} $(DESTDIR)/etc/qubes-rpc + install -m 0644 qubes-rpc/qubes.GetImageRGBA $(DESTDIR)/etc/qubes-rpc install -d $(DESTDIR)/usr/share/file-manager/actions install -m 0644 qubes-rpc/*-gnome.desktop $(DESTDIR)/usr/share/file-manager/actions diff --git a/qubes-rpc/qubes.GetImageRGBA b/qubes-rpc/qubes.GetImageRGBA new file mode 100644 index 0000000..5b3d809 --- /dev/null +++ b/qubes-rpc/qubes.GetImageRGBA @@ -0,0 +1,31 @@ +set -e +read filename + +if [[ "${filename}" = xdgicon:* ]]; then + # get biggest icon from hicolor theme + candidate=$(find /usr/share/icons/hicolor -type f -name "${filename#*:}.png" | xargs ls --sort=size | head -1) + + if [[ ! "$(basename "${candidate}")" = "${filename#*:}.png" ]]; then + # file not found, ls returned garbage + exit 1 + fi + filename="${candidate}" + +elif [[ "${filename}" = "-" ]] || [[ "${filename}" = *":-" ]]; then + tmpfile="$(mktemp /tmp/qimg-XXXXXXXX)" + cat > "${tmpfile}" + if [[ "$filename" = *":-" ]]; then + tmpfile="${filename%:*}:${tmpfile}" + fi + filename="${tmpfile}" + +elif ! [[ -r "${filename}" ]]; then + exit 1 +fi + +identify -format '%w %h' "$filename" +convert -depth 8 "$filename" rgba:- + +[[ -n "${tmpfile}" ]] && rm -f ${tmpfile} || true + +# vim: ft=sh ts=4 sw=4 et diff --git a/rpm_spec/core-vm.spec b/rpm_spec/core-vm.spec index b68071a..27ff723 100644 --- a/rpm_spec/core-vm.spec +++ b/rpm_spec/core-vm.spec @@ -48,6 +48,7 @@ Requires: net-tools Requires: nautilus-actions Requires: qubes-core-vm-kernel-placeholder Requires: qubes-utils +Requires: ImageMagick Provides: qubes-core-vm Obsoletes: qubes-core-commonvm Obsoletes: qubes-core-appvm @@ -279,6 +280,7 @@ rm -f %{name}-%{version} /etc/qubes-rpc/qubes.DetachPciDevice /etc/qubes-rpc/qubes.Backup /etc/qubes-rpc/qubes.Restore +/etc/qubes-rpc/qubes.GetImageRGBA /etc/sudoers.d/qubes %config(noreplace) /etc/sysconfig/iptables %config(noreplace) /etc/sysconfig/ip6tables From 1e291bbdc6969895329435ce381811cd5a475c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 2 Feb 2014 12:17:43 +0100 Subject: [PATCH 5/6] backups: fix timestamp in backup filename (once again...) --- qubes-rpc/qubes.Backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qubes-rpc/qubes.Backup b/qubes-rpc/qubes.Backup index 78c2e3e..cb194d0 100644 --- a/qubes-rpc/qubes.Backup +++ b/qubes-rpc/qubes.Backup @@ -3,7 +3,7 @@ read args echo Arguments: $args if [ -d "$args" ] ; then echo "Performing backup to directory $args" - TARGET="$args/qubes-backup-`date +'%Y-%d-%mT%H%M%S'`" + TARGET="$args/qubes-backup-`date +'%Y-%m-%dT%H%M%S'`" echo "Copying STDIN data to $TARGET" cat > $TARGET else From 27632a0b3bc32af6a77781c05f53d5ceb46044d8 Mon Sep 17 00:00:00 2001 From: Wojciech Zygmunt Porczyk Date: Tue, 4 Feb 2014 00:22:26 +0100 Subject: [PATCH 6/6] qubes.GetImageRGBA: bugfixes - when icon is not found in hicolor theme, search for in in other themes - added -follow to find --- qubes-rpc/qubes.GetImageRGBA | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/qubes-rpc/qubes.GetImageRGBA b/qubes-rpc/qubes.GetImageRGBA index 5b3d809..e032486 100644 --- a/qubes-rpc/qubes.GetImageRGBA +++ b/qubes-rpc/qubes.GetImageRGBA @@ -3,12 +3,18 @@ read filename if [[ "${filename}" = xdgicon:* ]]; then # get biggest icon from hicolor theme - candidate=$(find /usr/share/icons/hicolor -type f -name "${filename#*:}.png" | xargs ls --sort=size | head -1) - if [[ ! "$(basename "${candidate}")" = "${filename#*:}.png" ]]; then - # file not found, ls returned garbage - exit 1 - fi + filename="${filename#*:}.png" + candidate= + for dir in /usr/share/icons/{hicolor/,}; do + candidate=$(find -L "${dir}" -type f -name "${filename}") + if [[ -n "${candidate}" ]]; then + candidate=$(echo "${candidate}" | xargs ls --sort=size | head -1) + break + fi + done + + [[ -n "${candidate}" ]] filename="${candidate}" elif [[ "${filename}" = "-" ]] || [[ "${filename}" = *":-" ]]; then @@ -23,7 +29,9 @@ elif ! [[ -r "${filename}" ]]; then exit 1 fi -identify -format '%w %h' "$filename" +# identify in F18 (6.7) adds implicit '\n' to format, +# whereas identify in F20 (6.8) does not +identify -format '%w %h\n' "$filename" | sed -e '/^$/d' convert -depth 8 "$filename" rgba:- [[ -n "${tmpfile}" ]] && rm -f ${tmpfile} || true