Update tails-bugs.key with new ID
[tails-test.git] / auto / scripts / tails-custom-apt-sources
blobce939d1689b13194ee7d25bea84a75cf31ad8377
1 #!/bin/sh
3 set -e
5 APT_MIRROR_URL="http://deb.tails.boum.org/"
6 DEFAULT_COMPONENTS="main"
8 git_tag_exists() {
9 local tag="$1"
11 test -n "$(git tag -l "$tag")"
14 version_was_released() {
15 local version="$1"
17 version="$(echo "$version" | tr '~' '-')"
18 git_tag_exists "$version"
21 version_in_changelog() {
22 dpkg-parsechangelog | awk '/^Version: / { print $2 }'
25 output_apt_binary_source() {
26 local suite="$1"
27 local components="${2:-$DEFAULT_COMPONENTS}"
29 echo "deb $APT_MIRROR_URL $suite $components"
32 current_branch() {
33 git branch | awk '/^\* / { print $2 }'
36 on_topic_branch() {
37 current_branch | grep -qE '^(feature|bug|bugfix)/'
40 branch_name_to_suite() {
41 local branch="$1"
43 echo "$branch" | sed -e 's,[^.a-z0-9-],-,ig' | tr '[A-Z]' '[a-z]'
47 if version_was_released "$(version_in_changelog)"; then
48 output_apt_binary_source "$(branch_name_to_suite "$(version_in_changelog)")"
49 elif [ "$(current_branch)" = "stable" ]; then
50 output_apt_binary_source stable
51 elif [ "$(current_branch)" = "testing" ]; then
52 output_apt_binary_source testing
53 elif [ "$(current_branch)" = "experimental" ]; then
54 output_apt_binary_source experimental
55 else
56 output_apt_binary_source devel
59 if on_topic_branch; then
60 output_apt_binary_source "$(branch_name_to_suite $(current_branch))"