From f22a06d8ad1ff54ae5779d0d79944fd8d1b075d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 9 Mar 2015 13:38:09 +0100 Subject: [PATCH] Store root image named 'root.img' inside of tar archive Prevent renaming at installation, this will make the process cleaner. --- Makefile | 12 ++++++------ qubeize_image | 3 ++- templates.spec | 9 ++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 457e794..d88b39c 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ TEMPLATE_NAME := $(TEMPLATE_NAME)-$(TEMPLATE_FLAVOR) endif endif -# Make sure names are < 32 characters +# Make sure names are < 32 characters, process aliases fix_up := $(shell TEMPLATE_NAME=$(TEMPLATE_NAME) ./builder_fix_filenames) TEMPLATE_NAME := $(word 1,$(fix_up)) @@ -31,13 +31,13 @@ help: @echo "make clean -- copy newly generated rpm to installer repo" -rpms: +prepare: @echo $(TIMESTAMP) > build_timestamp_$(DIST) + +rpms: prepare rootimg-build @echo "Building template: $(TEMPLATE_NAME)" - sudo -E ./prepare_image prepared_images/$(TEMPLATE_NAME).img && \ - sudo -E ./qubeize_image prepared_images/$(TEMPLATE_NAME).img $(TEMPLATE_NAME) && \ - ./build_template_rpm $(TEMPLATE_NAME) || exit 1; \ - ./create_template_list.sh || : \ + ./build_template_rpm $(TEMPLATE_NAME) + ./create_template_list.sh || : rootimg-build: sudo -E ./prepare_image prepared_images/$(TEMPLATE_NAME).img && \ diff --git a/qubeize_image b/qubeize_image index 20ebd4d..64c533b 100755 --- a/qubeize_image +++ b/qubeize_image @@ -57,7 +57,8 @@ trap cleanup ERR # ------------------------------------------------------------------------------ # Mount qubeized_image # ------------------------------------------------------------------------------ -export IMG="qubeized_images/$NAME-root.img" +export IMG="qubeized_images/$NAME/root.img" +mkdir -p "qubeized_images/$NAME" echo "--> Copying $CLEANIMG to $IMG..." cp "$CLEANIMG" "$IMG" || exit 1 diff --git a/templates.spec b/templates.spec index a60a18d..3288bf2 100644 --- a/templates.spec +++ b/templates.spec @@ -33,16 +33,16 @@ Obsoletes: %{name} > %{version}-%{release} Qubes template for %{template_name} %build -cd qubeized_images +pushd qubeized_images/%{template_name} rm -f root.img.part.* -tar --sparse --dereference -cf - %{template_name}-root.img | split -d -b 1G - root.img.part. -cd .. +tar --sparse --dereference -cf - root.img | split -d -b 1G - root.img.part. +popd %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{dest_dir} -for i in qubeized_images/root.img.part.* ; do ln $i $RPM_BUILD_ROOT/%{dest_dir}/`basename $i` ; done +for i in qubeized_images/%{template_name}/root.img.part.* ; do mv $i $RPM_BUILD_ROOT/%{dest_dir}/ ; done 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 @@ -69,7 +69,6 @@ fi echo "--> Processing the root.img... (this might take a while)" cat %{dest_dir}/root.img.part.* | tar --sparse -xf - -C %{dest_dir} rm -f %{dest_dir}/root.img.part.* -mv %{dest_dir}/%{template_name}-root.img %{dest_dir}/root.img chown root.qubes %{dest_dir}/root.img chmod 0660 %{dest_dir}/root.img