From c9809c7d6e4e53c1fd4aabb6d450d1a5f0d51602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 7 Mar 2015 03:43:33 +0100 Subject: [PATCH] Minimize data contained in the template package 1. Remove appmenus - regenerate them at installation time (start the template for that) 2. Remove volatile.img - regenerate it at installation time This way, the only real data carried in template rpm is root.img. --- convert_app2template.sh | 19 ------------------- create_apps_templates.sh | 12 ------------ qubeize_image | 9 --------- templates.spec | 16 ++++++++++------ 4 files changed, 10 insertions(+), 46 deletions(-) delete mode 100755 convert_app2template.sh delete mode 100755 create_apps_templates.sh diff --git a/convert_app2template.sh b/convert_app2template.sh deleted file mode 100755 index 9511fce..0000000 --- a/convert_app2template.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -SRC=$1 -DSTDIR=$2 -DST=$DSTDIR/$(basename $SRC) - -if ! grep -q ^Name $SRC ; then - echo "WARNING: app $SRC doesn't have Name keyword, skipping..." - exit 0 -fi - -sed -n -e "/^\[Desktop Entry\]$/p" \ - -e "s/^\(Name.*\)=\(.*\)/\1=%VMNAME%: \2/p" \ - -e "s/^\(GenericName.*\)=\(.*\)/\1=%VMNAME%: \2/p" \ - -e "s/^Exec=\(.*\)/Exec=qvm-run -q --tray -a %VMNAME% \'\1\'/p" \ - -e "/^Comment.*=/p" \ - -e "/Categories=/p" <$SRC >$DST - -echo X-Qubes-VmName=%VMNAME% >> $DST -echo Icon=%VMDIR%/icon.png >> $DST diff --git a/create_apps_templates.sh b/create_apps_templates.sh deleted file mode 100755 index fccbaa3..0000000 --- a/create_apps_templates.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -APPSORIG=$1 -APPSTMPL=$2 - -if [ $# != 2 ]; then - echo "usage $0 " - exit 0 -fi - -rm -f $APPSTMPL/* -mkdir -p $APPSTMPL -find $APPSORIG/ -name "*.desktop" -exec ./convert_app2template.sh {} $APPSTMPL \; diff --git a/qubeize_image b/qubeize_image index 35e38eb..20ebd4d 100755 --- a/qubeize_image +++ b/qubeize_image @@ -75,15 +75,6 @@ export INSTALLDIR=mnt # ------------------------------------------------------------------------------ # Create App Menus # ------------------------------------------------------------------------------ -echo "--> Copying the Apps Menu shortcuts..." -export APPSORIG="qubeized_images/$NAME-apps.orig" -export APPSTEMPL="qubeized_images/$NAME-apps.templates" -mkdir -p "$APPSORIG" -cp -r "$(pwd)"/mnt/usr/share/applications/* "$APPSORIG" - -echo "--> Creating the Apps Menu templates..." -"./create_apps_templates.sh" "$APPSORIG" "$APPSTEMPL" - echo "--> Choosing appmenus whitelists..." rm -f appmenus if [ -d "appmenus_${DIST}_${TEMPLATE_FLAVOR}" ]; then diff --git a/templates.spec b/templates.spec index c6bb3cb..a60a18d 100644 --- a/templates.spec +++ b/templates.spec @@ -46,13 +46,11 @@ for i in qubeized_images/root.img.part.* ; do ln $i $RPM_BUILD_ROOT/%{dest_dir}/ touch $RPM_BUILD_ROOT/%{dest_dir}/root.img # we will create the real file in %post touch $RPM_BUILD_ROOT/%{dest_dir}/private.img # we will create the real file in %post touch $RPM_BUILD_ROOT/%{dest_dir}/volatile.img # we will create the real file in %post - -cp clean-volatile.img.tar $RPM_BUILD_ROOT/%{dest_dir}/clean-volatile.img.tar +touch $RPM_BUILD_ROOT/%{dest_dir}/clean-volatile.img.tar # we will create the real file in %post mkdir -p $RPM_BUILD_ROOT/%{dest_dir}/apps.templates mkdir -p $RPM_BUILD_ROOT/%{dest_dir}/apps.tempicons mkdir -p $RPM_BUILD_ROOT/%{dest_dir}/apps -cp -r qubeized_images/%{template_name}-apps.templates/* $RPM_BUILD_ROOT/%{dest_dir}/apps.templates cp appmenus/whitelisted-appmenus.list appmenus/vm-whitelisted-appmenus.list $RPM_BUILD_ROOT/%{dest_dir}/ cp appmenus/netvm-whitelisted-appmenus.list $RPM_BUILD_ROOT/%{dest_dir}/ touch $RPM_BUILD_ROOT/%{dest_dir}/icon.png @@ -76,9 +74,12 @@ chown root.qubes %{dest_dir}/root.img chmod 0660 %{dest_dir}/root.img echo "--> Processing the volatile.img..." -tar --sparse -xf %{dest_dir}/clean-volatile.img.tar -C %{dest_dir} +/usr/lib/qubes/prepare-volatile-img.sh chown root.qubes %{dest_dir}/volatile.img chmod 0660 %{dest_dir}/volatile.img +tar --sparse -cf %{dest_dir}/clean-volatile.img.tar -C %{dest_dir} volatile.img +chown root.qubes %{dest_dir}/clean-volatile.img.tar +chmod 0660 %{dest_dir}/clean-volatile.img.tar if [ "$1" = 1 ] ; then # installing for the first time @@ -94,7 +95,6 @@ export XDG_DATA_DIRS=/usr/share/ echo "--> Instaling menu shortcuts..." ln -sf /usr/share/qubes/icons/template.png %{dest_dir}/icon.png -/usr/libexec/qubes-appmenus/create-apps-for-appvm.sh %{dest_dir}/apps.templates %{template_name} vm-templates if [ "$1" = 1 ] ; then # installing for the first time @@ -106,6 +106,11 @@ if [ "`stat -c %d:%i /`" != "`stat -c %d:%i /proc/1/root/.`" ]; then qvm-template-commit --offline-mode %{template_name} else qvm-template-commit %{template_name} + qvm-start --no-guid %{template_name} + qvm-sync-appmenus --force-root %{template_name} + qvm-shutdown --wait %{template_name} + chgrp -R qubes %{dest_dir} + chmod g+rwX -R %{dest_dir} fi %preun @@ -147,7 +152,6 @@ rm -rf $RPM_BUILD_ROOT %attr (775,root,qubes) %dir %{dest_dir}/apps %attr (775,root,qubes) %dir %{dest_dir}/apps.templates %attr (775,root,qubes) %dir %{dest_dir}/apps.tempicons -%attr (664,root,qubes) %{dest_dir}/apps.templates/* %attr (664,root,qubes) %{dest_dir}/whitelisted-appmenus.list %attr (664,root,qubes) %{dest_dir}/vm-whitelisted-appmenus.list %attr (664,root,qubes) %{dest_dir}/netvm-whitelisted-appmenus.list