From c518538f59332631145f73bcd9bc47fb46b90194 Mon Sep 17 00:00:00 2001 From: Rafal Wojtczuk Date: Wed, 14 Jul 2010 18:50:48 +0200 Subject: [PATCH] DVM: execute user script before save qubes_prepare_saved_domain.sh now takes optional second argument, the filename. The content of the file will be copied (via xenstore) to DVM and executed just before save. This makes it possible to preload memory with useful apps. --- appvm/qubes_core | 15 ++++++++++++++- rpm_spec/core-appvm.spec | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/appvm/qubes_core b/appvm/qubes_core index 407c9db..2b6a159 100755 --- a/appvm/qubes_core +++ b/appvm/qubes_core @@ -6,6 +6,18 @@ # Source function library. . /etc/rc.d/init.d/functions +possibly_run_save_script() +{ + ENCODED_SCRIPT=$(xenstore-read qubes_save_script) + if [ -z "$ENCODED_SCRIPT" ] ; then return ; fi + echo $ENCODED_SCRIPT|perl -e 'use MIME::Base64 qw(decode_base64); local($/) = undef;print decode_base64()' >/tmp/qubes_save_script + chmod 755 /tmp/qubes_save_script + Xorg -config /etc/X11/xorg-preload-apps.conf :0 & + sleep 2 + DISPLAY=:0 su - user -c /tmp/qubes_save_script + killall Xorg +} + start() { echo -n $"Executing Qubes Core scripts:" @@ -14,7 +26,8 @@ start() echo "ERROR: /usr/bin/xenstore-read not found!" exit 1 fi - if xenstore-read qubes_save_request ; then + if xenstore-read qubes_save_request 2>/dev/null ; then + possibly_run_save_script touch /etc/this_is_dvm dmesg -c >/dev/null # echo 1 >/proc/sys/vm/drop_caches diff --git a/rpm_spec/core-appvm.spec b/rpm_spec/core-appvm.spec index 351e1d2..143aa3d 100644 --- a/rpm_spec/core-appvm.spec +++ b/rpm_spec/core-appvm.spec @@ -81,6 +81,9 @@ cp ../common/qubes_serial_login $RPM_BUILD_ROOT/sbin mkdir -p $RPM_BUILD_ROOT/etc cp ../common/serial.conf $RPM_BUILD_ROOT/var/lib/qubes/ +mkdir -p $RPM_BUILD_ROOT/etc/X11 +cp xorg-preload-apps.conf $RPM_BUILD_ROOT/etc/X11 + mkdir -p $RPM_BUILD_ROOT/home_volatile/user chown 500:500 $RPM_BUILD_ROOT/home_volatile/user @@ -199,3 +202,4 @@ rm -rf $RPM_BUILD_ROOT /usr/bin/qubes_timestamp %dir /home_volatile %attr(700,user,user) /home_volatile/user +/etc/X11/xorg-preload-apps.conf