scripts: Initialize setup-apt-repo-debathena.

This commit is contained in:
rht 2018-12-06 01:54:56 +00:00 committed by Tim Abbott
parent 97766102df
commit 711b0fda8b
2 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,57 @@
#!/bin/bash
set -x
set -e
# Ensure the directory for LAST_DEPENDENCIES_HASH exists
mkdir -p /var/lib/zulip
SOURCES_FILE=/etc/apt/sources.list.d/zulip_debathena.list
STAMP_FILE=/etc/apt/sources.list.d/zulip_debathena.list.apt-update-in-progress
ZULIP_SCRIPTS="$(dirname "$(dirname "$0")")"
DEPENDENCIES_HASH=$(sha1sum "$ZULIP_SCRIPTS/setup/"*.asc "$0")
DEPENDENCIES_HASH_FILE="/var/lib/zulip/setup-repositories-state-debathena"
# Ensure that DEPENDENCIES_HASH_FILE exists before hashing it.
touch "$DEPENDENCIES_HASH_FILE"
LAST_DEPENDENCIES_HASH="$(cat "$DEPENDENCIES_HASH_FILE")"
# First, we only do anything in setup-apt-repo if any of its inputs
# (apt keys, code, etc.) changed.
if [ "$DEPENDENCIES_HASH" = "$LAST_DEPENDENCIES_HASH" ]; then
exit 0
fi
# Ensure that the sources file exists
touch "$SOURCES_FILE"
# Hash it to check if the sources file is changed by the script later.
zulip_source_hash=$(sha1sum "$SOURCES_FILE")
apt-get install -y lsb-release apt-transport-https gnupg
SCRIPTS_PATH="$(dirname "$(dirname "$0")")"
release=$(lsb_release -sc)
if [ "$release" = "xenial" ]; then
apt-key add "$SCRIPTS_PATH"/setup/debathena-archive.asc
cat >$SOURCES_FILE <<EOF
deb http://debathena.mit.edu/apt $release debathena debathena-config
deb-src http://debathena.mit.edu/apt $release debathena debathena-config
EOF
else
echo "Unsupported release $release."
exit 1
fi
# Copied blindly from scripts/lib/setup-apt-repo
if [ "$zulip_source_hash" = "$(sha1sum "$SOURCES_FILE")" ] && ! [ -e "$STAMP_FILE" ]; then
echo "zulip.list file did not change; skipping apt-get update"
else
# We create this stamp file to ensure `apt-get update` will be run
# the next time this script is invoked, and each time after, until
# `apt-get update` finishes successfully.
touch "$STAMP_FILE"
apt-get update && rm -f "$STAMP_FILE"
fi
echo "$DEPENDENCIES_HASH" > "$DEPENDENCIES_HASH_FILE"

View File

@ -0,0 +1,30 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.10 (GNU/Linux)
mQINBEoRh7YBEAC7s6oh9+2UZ6LGMRdwvSZdGsX1iHKvY23yq9swagL0LF1z5AVE
mlaRtdi3VhJr1zRBARvJqvu2GyAFIxgihyA0Mhcwp5XDZflwZoLYYrBKoxEeq0pI
oxBPQCoOdJRpRY6IPGKZuEW3oDn248/E7+ezKJhLHU6eGftTQ0wBEJ956IWWaW3E
nuRC5U2USd9jCKvzb3kDcfhryzgtpAxk75MODwAttUYxYTjJ1NoKwh3QeDTsByzu
MU8hvgaEyl+Ot1+7tjB/XVlvFCfkYphayVUIXivv7juB+KFjt+RU+V2YALRj6hPV
Go3MGFkob2dP5UJWAyukumEBhu7ptRpfsWKihpU7FRR8khYYkWe5C1Ch8jEtLyCF
1Jp6nEB0upO8vDeE+RsTXJKA4S9p1FnTmFVl0XjCK5VYV5R1PKiesk0EiityNeYl
WwKFiN/AGBjbhee1hm/NH603bcIb3K/5zwugb4JutbdW4DZrB34MMV5/CM1RQM5K
s63hOp8YEnLiTCI6aMfwN6AvlCYYOeUOoGpzbjJkXo3s8uydUpaZRZyPLWJJ/Zhv
dEmCMIbRS6SrqVoFTuxNQLh3CeO05ofAtErmbwCIhGftwlQlFMZ+/dCxjbECOjv0
zTdgeWyB+8PkqWgkechowrRzMCXTpHPGpoyniBSc6HW7Pnsi8e2R1eaKzwARAQAB
tDtEZWJhdGhlbmEgUHJvamVjdCAoQXJjaGl2ZSBTaWduaW5nIEtleSkgPGRlYmF0
aGVuYUBtaXQuZWR1PokCNwQTAQgAIQUCShGHtgIbAwULCQgHAwUVCgkICwUWAgMB
AAIeAQIXgAAKCRDk7mJwDYqej44nD/kB6O4F06aVoIzcJCmnrm1c0GIfX8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