Skip to content

Commit

Permalink
converted chroot-script 40_add_torprojects_key to postinst script
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Schleizer committed Jan 5, 2016
1 parent 5f49829 commit 495fc4c
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 70 deletions.
77 changes: 77 additions & 0 deletions debian/anon-shared-build-apt-sources-tpo.postinst
@@ -0,0 +1,77 @@
#!/bin/bash

## This file is part of Whonix.
## Copyright (C) 2012 - 2014 Patrick Schleizer <adrelanos@riseup.net>
## See the file COPYING for copying conditions.

if [ -f /usr/lib/pre.bsh ]; then
source /usr/lib/pre.bsh
fi

set -e

tpo_keys_Add() {
## The torproject archive key has been manually downloaded using the key fingerprint from
## https://www.torproject.org/docs/debian.html.en and https://www.torproject.org/docs/signing-keys.html.en
## using gpg:
## gpg --keyserver keys.gnupg.net --recv <long-key-id>
## Verified using:
## gpg --list-sigs <long-key-id>
## gpg --check-sigs <long-key-id>
## And added to Whonix source code using:
## gpg --armor --export <long-key-id> > /home/user/anon-shared-build-apt-sources-tpo/usr/share/anon-shared-build-apt-sources-tpo/tpoarchive-keys.d/torprojectarchive.asc

for key in "/usr/share/anon-shared-build-apt-sources-tpo/tpoarchive-keys.d/"*; do
filename="$(basename "$key")"
if [ "$filename" = "placeholder" ]; then
continue
fi
if [ "$filename" = "*" ]; then
## Folder is empty.
continue
fi
apt-key add "$key"
done
}

true "
#####################################################################
## INFO: BEGIN: $DPKG_MAINTSCRIPT_PACKAGE $DPKG_MAINTSCRIPT_NAME ${1+"$@"}
#####################################################################
"

case "$1" in
configure)
true "INFO: Configuring $DPKG_MAINTSCRIPT_PACKAGE..."

## Doing this only once,
## because when the user updates, the deb.torproject.org-keyring deb package is already
## installed, which does a better job updating Tor Project's signing key.
if [ ! -f "/var/lib/anon-dist/do_once/tpo_keys_add" ]; then
tpo_keys_Add
mkdir --parents "/var/lib/anon-dist/do_once"
touch "/var/lib/anon-dist/do_once/tpo_keys_add"
fi

true "INFO: End configuring $DPKG_MAINTSCRIPT_PACKAGE."

;;

*)
;;
esac

true "INFO: debhelper beginning here."

#DEBHELPER#

true "INFO: Done with debhelper."

true "
#####################################################################
## INFO: END : $DPKG_MAINTSCRIPT_PACKAGE $DPKG_MAINTSCRIPT_NAME ${1+"$@"}
#####################################################################
"

## Explicitly "exit 0", so eventually trapped errors can be ignored.
exit 0
70 changes: 0 additions & 70 deletions usr/lib/anon-dist/chroot-scripts-post.d/40_add_torprojects_key

This file was deleted.

0 comments on commit 495fc4c

Please sign in to comment.