For running our tests, FUSE must be configured with the
[arvados-dev.git] / scripts / create-release-repositories.sh
1 #!/bin/bash
2
3 # Copyright (C) The Arvados Authors. All rights reserved.
4 #
5 # SPDX-License-Identifier: AGPL-3.0
6
7 set -eo pipefail
8
9 DISTRO=$1
10
11 set -u
12
13 if [[ `id -u -n` != "jenkinsapt" ]]; then
14   echo "This script must be run as the `jenkinsapt` user"
15   exit 1
16 fi
17
18 if [[ -z "$DISTRO" ]]; then
19   echo "Syntax: $0 <distro>"
20   exit 1
21 fi
22
23 # Check that a FileSystemPublishEndpoint has been added in ~jenkinsapt/.aptly.conf
24 set +e
25 TMP=`cat ~jenkinsapt/.aptly.conf | jq .FileSystemPublishEndpoints.$DISTRO |grep rootDir`
26 set -e
27 if [[ "$TMP" == "" ]]; then
28   echo "Please edit ~jenkinsapt/.aptly.conf and add a FileSystemPublishEndpoint for $DISTRO first"
29   echo
30   echo "Aborting..."
31   exit 2
32 fi
33
34 # Double check if this repository is already defined
35 set +e
36 EXISTING=`aptly repo list 2>&1 |grep $DISTRO`
37 set -e
38
39 if [[ "$EXISTING" != "" ]]; then
40         echo "This release exists already, judging by the output of 'aptly repo list'"
41         echo
42         echo "Aborting..."
43         exit 2
44 fi
45
46
47 echo "WARNING! Please use the human name for the distribution release, e.g. bullseye for Debian 11, or focal for Ubuntu 20.04"
48
49 echo
50 read -r -p "Create the repositories for $DISTRO with aptly, are you sure? (y/n) " response
51 echo
52
53 case "$response" in
54         [yY])
55             ;;
56         *)
57             echo "Aborting."
58             exit 0
59             ;;
60 esac
61
62 # Development builds
63 aptly repo create --comment "Development builds" --distribution "$DISTRO-dev" $DISTRO-dev
64 aptly repo edit -architectures="amd64" $DISTRO-dev
65 aptly repo show $DISTRO-dev
66
67 # Testing builds
68 aptly repo create --comment "Testing builds" --distribution "$DISTRO-testing" $DISTRO-testing
69 aptly repo edit -architectures="amd64" $DISTRO-testing
70 aptly repo show $DISTRO-testing
71
72 # Release builds
73 aptly repo create --comment "Release builds" --distribution "$DISTRO" $DISTRO
74 aptly repo edit -architectures="amd64" $DISTRO
75 aptly repo show $DISTRO
76
77 # Attic
78 aptly repo create --comment "Attic" --distribution "$DISTRO-attic" $DISTRO-attic
79 aptly repo edit -architectures="amd64" $DISTRO-attic
80 aptly repo show $DISTRO-attic
81
82
83 # Publish dev
84 aptly publish repo -architectures "amd64,arm64" $DISTRO-dev filesystem:$DISTRO:.
85 aptly publish show $DISTRO-dev filesystem:$DISTRO:.
86
87 # Publish testing
88 aptly publish repo -architectures "amd64,arm64" $DISTRO-testing filesystem:$DISTRO:.
89 aptly publish show $DISTRO-testing filesystem:$DISTRO:.
90
91 # Publish release
92 aptly publish repo -architectures "amd64,arm64" $DISTRO filesystem:$DISTRO:.
93 aptly publish show $DISTRO filesystem:$DISTRO:.
94
95 # Publish attic
96 aptly publish repo -architectures "amd64,arm64" $DISTRO-attic filesystem:$DISTRO:.
97 aptly publish show $DISTRO-attic filesystem:$DISTRO:.
98
99 # Show all the published repos
100 aptly publish list |grep $DISTRO