Skip to content

Commit

Permalink
whonix-initializer: cleanup chroot script: fix, better handling in ca…
Browse files Browse the repository at this point in the history
…se download_package failed while the error is skipped as per https://www.whonix.org/forum/index.php/topic,488.msg3861.html#msg3861
  • Loading branch information
Patrick Schleizer committed Sep 8, 2014
1 parent 421aabb commit 98ad409
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 16 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
@@ -1,3 +1,9 @@
whonix-initializer (3:0.4-1) unstable; urgency=low

* New upstream version.

-- Patrick Schleizer <adrelanos@riseup.net> Mon, 08 Sep 2014 11:54:48 +0000

whonix-initializer (3:0.3-1) unstable; urgency=low

* New upstream version.
Expand Down
50 changes: 34 additions & 16 deletions usr/lib/anon-dist/chroot-scripts-post.d/80_cleanup
Expand Up @@ -86,10 +86,20 @@ fi
local package="$1"
if [ "${downloaded[$package]}" = "1" ]; then
true "INFO: Already downloaded $package."
elif [ "${downloaded[$package]}" = "0" ]; then
true "INFO: Download of $package already failed earlier."
else
true "INFO: Downloading $package..."
apt-get $apt_sourcelist_empty $apt_sourceparts $apt_timeout_opts $apt_verify_opts download "$package"
downloaded[$package]="1"
local apt_get_download_exit_code="0"
apt-get $apt_sourcelist_empty $apt_sourceparts $apt_timeout_opts $apt_verify_opts download "$package" || { apt_get_download_exit_code="$?" ; true; };
if [ "$apt_get_download_exit_code" = "0" ]; then
downloaded[$package]="1"
else
downloaded[$package]="0"
local MSG="ERROR: Download of $package failed. (apt_get_download_exit_code: $apt_get_download_exit_code)"
true "$MSG"
error "$MSG"
fi
fi
}

Expand Down Expand Up @@ -155,13 +165,17 @@ fi
true "INFO: $script not executable."
else
download_package "$package"
true "INFO: Running... $script remove"
export DPKG_MAINTSCRIPT_PACKAGE="$package"
## TODO: export DPKG_MAINTSCRIPT_ARCH="?"
export DPKG_MAINTSCRIPT_NAME="prerm"
## Example:
## /var/lib/dpkg/info/fontconfig.prerm remove
"$script" remove
if [ "${downloaded[$package]}" = "1" ]; then
true "INFO: Running... $script remove"
export DPKG_MAINTSCRIPT_PACKAGE="$package"
## TODO: export DPKG_MAINTSCRIPT_ARCH="?"
export DPKG_MAINTSCRIPT_NAME="prerm"
## Example:
## /var/lib/dpkg/info/fontconfig.prerm remove
"$script" remove
else
true "WARNING: Skipping running $script remove, because $package could not be downloaded. This will likely break the verifiable builds feature."
fi
fi
done

Expand All @@ -177,13 +191,17 @@ fi
true "INFO: $script not executable."
else
download_package "$package"
export DPKG_MAINTSCRIPT_PACKAGE="$package"
## TODO: export DPKG_MAINTSCRIPT_ARCH="?"
export DPKG_MAINTSCRIPT_NAME="postrm"
true "INFO: Running... $script purge"
## Example:
## /var/lib/dpkg/info/fontconfig.postrm purge
"$script" purge
if [ "${downloaded[$package]}" = "1" ]; then
export DPKG_MAINTSCRIPT_PACKAGE="$package"
## TODO: export DPKG_MAINTSCRIPT_ARCH="?"
export DPKG_MAINTSCRIPT_NAME="postrm"
true "INFO: Running... $script purge"
## Example:
## /var/lib/dpkg/info/fontconfig.postrm purge
"$script" purge
else
true "WARNING: Skipping running $script purge, because $package could not be downloaded. This will likely break the verifiable builds feature."
fi
fi
done

Expand Down

0 comments on commit 98ad409

Please sign in to comment.