Call qvm-template-postprocess if present instead of internal script

Actions required after template installation differs between Qubes
releases. Lets keep template builder universal and just call appropriate
command provided by version-specific component (probably
qubes-core-dom0 package), if present. Otherwise use old script (for
Qubes before 4.0).

Add --really parameter to prevent misuse. This tool may override
template data without further confirmation.

QubesOS/qubes-issues#2412
This commit is contained in:
Marek Marczykowski-Górecki 2016-11-02 06:07:00 +01:00
parent 819757e754
commit bb836e5d46
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -64,6 +64,12 @@ fi
%post %post
if command -v qvm-template-postprocess >/dev/null 2>&1; then
qvm-template-postprocess --really post-install %{template_name} %{dest_dir}
exit $?
fi
echo "--> Processing the root.img... (this might take a while)" echo "--> Processing the root.img... (this might take a while)"
cat %{dest_dir}/root.img.part.* | tar --sparse -xf - -C %{dest_dir} cat %{dest_dir}/root.img.part.* | tar --sparse -xf - -C %{dest_dir}
rm -f %{dest_dir}/root.img.part.* rm -f %{dest_dir}/root.img.part.*
@ -133,6 +139,12 @@ exit 0
%preun %preun
if [ "$1" = 0 ] ; then if [ "$1" = 0 ] ; then
# no more packages left # no more packages left
if command -v qvm-template-postprocess >/dev/null 2>&1; then
qvm-template-postprocess --really pre-remove %{template_name} %{dest_dir}
exit $?
fi
# First remove DispVM template (even if not exists...) # First remove DispVM template (even if not exists...)
qvm-remove --force-root -q %{template_name}-dvm qvm-remove --force-root -q %{template_name}-dvm