From 611914da1521a30655f11802f25491ce46a4116e Mon Sep 17 00:00:00 2001 From: Tomasz Sterna Date: Tue, 19 Apr 2011 00:11:45 +0200 Subject: [PATCH 1/2] Disable unnecessary Upstart, Init and XDG Autostart serices. #209 Move unneded /etc/init/*.conf services to /etc/init/*.conf.disabled. Start CUPS only in AppVM and UtilityVM. Start XDG Autostart applications only in domains that makes sense for them. --- rpm_spec/core-commonvm.spec | 52 +++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/rpm_spec/core-commonvm.spec b/rpm_spec/core-commonvm.spec index 0da0f39..eb073cd 100644 --- a/rpm_spec/core-commonvm.spec +++ b/rpm_spec/core-commonvm.spec @@ -80,8 +80,56 @@ cp /var/lib/qubes/serial.conf /etc/init/serial.conf %post -# Disable gpk-update-icon -sed 's/^NotShowIn=KDE;$/\0QUBES;/' -i /etc/xdg/autostart/gpk-update-icon.desktop +# disable some Upstart services +for F in plymouth-shutdown prefdm splash-manager start-ttys tty ; do + if [ -e /etc/init/$F.conf ]; then + mv -f /etc/init/$F.conf /etc/init/$F.conf.disabled + fi +done + +remove_ShowIn () { + if [ -e /etc/xdg/autostart/$1.desktop ]; then + sed -i '/^\(Not\|Only\)ShowIn/d' /etc/xdg/autostart/$1.desktop + fi +} + +# don't want it at all +for F in abrt-applet deja-dup-monitor imsettings-start krb5-auth-dialog pulseaudio restorecond sealertauto ; do + if [ -e /etc/xdg/autostart/$F.desktop ]; then + remove_ShowIn $F + echo 'NotShowIn=QUBES' >> /etc/xdg/autostart/$F.desktop + fi +done + +# don't want it in DisposableVM +for F in gcm-apply ; do + if [ -e /etc/xdg/autostart/$F.desktop ]; then + remove_ShowIn $F + echo 'NotShowIn=DisposableVM' >> /etc/xdg/autostart/$F.desktop + fi +done + +# want it in AppVM and StandaloneVM only +for F in gnome-keyring-gpg gnome-keyring-pkcs11 gnome-keyring-secrets gnome-keyring-ssh gnome-settings-daemon user-dirs-update-gtk gsettings-data-convert ; do + if [ -e /etc/xdg/autostart/$F.desktop ]; then + remove_ShowIn $F + echo 'OnlyShowIn=GNOME;AppVM;StandaloneVM;' >> /etc/xdg/autostart/$F.desktop + fi +done + +# remove existing rule to add own later +for F in gpk-update-icon nm-applet print-applet ; do + remove_ShowIn $F +done + +echo 'OnlyShowIn=GNOME;StandaloneVM;TemplateVM;' >> /etc/xdg/autostart/gpk-update-icon.desktop || : +echo 'OnlyShowIn=GNOME;NetVM;' >> /etc/xdg/autostart/nm-applet.desktop || : +echo 'OnlyShowIn=GNOME;AppVM;UtilityVM;' >> /etc/xdg/autostart/print-applet.desktop || : + +# start cups only in AppVM and UtilityVM +if [ -e /etc/init.d/cups ] && ! grep -q xenstore-read /etc/init.d/cups ; then + sed -i '/echo.*Starting /s#^#\ntype=$(/usr/bin/xenstore-read qubes_vm_type)\nif [ "$type" != "AppVM" -a "$type" != "UtilityVM" ]; then\nreturn 0\nfi\n\n#' /etc/init.d/cups +fi if [ "$1" != 1 ] ; then # do this whole %post thing only when updating for the first time... From 705a66af63371676f76487a0bbeabe7ae0d79c15 Mon Sep 17 00:00:00 2001 From: Tomasz Sterna Date: Wed, 20 Apr 2011 00:56:58 +0200 Subject: [PATCH 2/2] We do not want to have StandaloneVM and UtilityVM types. --- rpm_spec/core-commonvm.spec | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/rpm_spec/core-commonvm.spec b/rpm_spec/core-commonvm.spec index eb073cd..bd0a540 100644 --- a/rpm_spec/core-commonvm.spec +++ b/rpm_spec/core-commonvm.spec @@ -109,27 +109,21 @@ for F in gcm-apply ; do fi done -# want it in AppVM and StandaloneVM only +# want it in AppVM only for F in gnome-keyring-gpg gnome-keyring-pkcs11 gnome-keyring-secrets gnome-keyring-ssh gnome-settings-daemon user-dirs-update-gtk gsettings-data-convert ; do if [ -e /etc/xdg/autostart/$F.desktop ]; then remove_ShowIn $F - echo 'OnlyShowIn=GNOME;AppVM;StandaloneVM;' >> /etc/xdg/autostart/$F.desktop + echo 'OnlyShowIn=GNOME;AppVM;' >> /etc/xdg/autostart/$F.desktop fi done # remove existing rule to add own later -for F in gpk-update-icon nm-applet print-applet ; do +for F in gpk-update-icon nm-applet ; do remove_ShowIn $F done -echo 'OnlyShowIn=GNOME;StandaloneVM;TemplateVM;' >> /etc/xdg/autostart/gpk-update-icon.desktop || : +echo 'OnlyShowIn=GNOME;UpdateableVM;' >> /etc/xdg/autostart/gpk-update-icon.desktop || : echo 'OnlyShowIn=GNOME;NetVM;' >> /etc/xdg/autostart/nm-applet.desktop || : -echo 'OnlyShowIn=GNOME;AppVM;UtilityVM;' >> /etc/xdg/autostart/print-applet.desktop || : - -# start cups only in AppVM and UtilityVM -if [ -e /etc/init.d/cups ] && ! grep -q xenstore-read /etc/init.d/cups ; then - sed -i '/echo.*Starting /s#^#\ntype=$(/usr/bin/xenstore-read qubes_vm_type)\nif [ "$type" != "AppVM" -a "$type" != "UtilityVM" ]; then\nreturn 0\nfi\n\n#' /etc/init.d/cups -fi if [ "$1" != 1 ] ; then # do this whole %post thing only when updating for the first time...