-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaptly-publish-daily
More file actions
executable file
·32 lines (25 loc) · 976 Bytes
/
aptly-publish-daily
File metadata and controls
executable file
·32 lines (25 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# Publish a distribution with all components in a single snapshot (aptly >= 0.6).
set -e
DIST=$1
ARCH=$2
DOTW=$3
if [ -z "$ARCH" ]; then
echo "Usage: $0 <distribution> <architecture,architecture> [<day-of-the-week-name|tag>]"
echo "Example: $0 trusty amd64,source wanderer-test"
exit 1
fi
if [ -z "$DOTW" ]; then
DOTW=$(date +%A | tr '[:upper:]' '[:lower:]')
fi
set -x
aptly mirror list --raw | grep "$DIST#" |\
xargs -n1 -IX aptly snapshot drop $DOTW+X || true
aptly mirror list --raw | grep "$DIST#" |\
xargs -n1 -IX aptly snapshot create $DOTW+X from mirror X
SNAPSHOTS=$(aptly snapshot list --raw | grep "$DOTW+$DIST#" | xargs)
COMPONENTS_=$(aptly mirror list --raw | grep "$DIST#" | cut -d'#' -f2 | xargs)
COMPONENTS="-component=${COMPONENTS_// /,}"
ARCHITECTURE="-architectures=$ARCH"
aptly publish switch "$ARCHITECTURE" "$COMPONENTS" "$DIST" "$DIST" $SNAPSHOTS ||\
aptly publish snapshot "$ARCHITECTURE" "$COMPONENTS" $SNAPSHOTS "$DIST"