+# update the current archive signing keyring from a network URI
+# the archive-keyring keys needs to be signed with the master key
+# (otherwise it does not make sense from a security POV)
+net_update() {
+ if [ -z "$ARCHIVE_KEYRING_URI" ]; then
+ echo >&2 "ERROR: Your distribution is not supported in net-update as no uri for the archive-keyring is set"
+ exit 1
+ fi
+ requires_root
+ # in theory we would need to depend on wget for this, but this feature
+ # isn't useable in debian anyway as we have no keyring uri nor a master key
+ if ! which wget >/dev/null 2>&1; then
+ echo >&2 "ERROR: an installed wget is required for a network-based update"
+ exit 1
+ fi
+ if [ ! -d /var/lib/apt/keyrings ]; then
+ mkdir -p /var/lib/apt/keyrings
+ fi
+ keyring=/var/lib/apt/keyrings/$(basename $ARCHIVE_KEYRING)
+ old_mtime=0
+ if [ -e $keyring ]; then
+ old_mtime=$(stat -c %Y $keyring)
+ fi
+ (cd /var/lib/apt/keyrings; wget -q -N $ARCHIVE_KEYRING_URI)
+ if [ ! -e $keyring ]; then
+ return
+ fi
+ new_mtime=$(stat -c %Y $keyring)
+ if [ $new_mtime -ne $old_mtime ]; then
+ echo "Checking for new archive signing keys now"
+ add_keys_with_verify_against_master_keyring $keyring $MASTER_KEYRING
+ fi
+}