-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·37 lines (29 loc) · 1.24 KB
/
update.sh
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
33
34
35
36
37
#!/bin/bash
: '
1. setup your EMAIL env var to match the one of your targeted gpg key
2. place the new deb files in the package directory
3. run this script and provide your credentials once asked for it
'
set -euo pipefail
BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PACKAGE_DIR="${BASE_PATH}/ubuntu/"
if [[ -z "${EMAIL:-}" ]]; then
echo "Error: The EMAIL environment variable is not set." >&2
exit 1
fi
if git status --porcelain "$PACKAGE_DIR" | grep -q -v '\.deb'; then
echo "Error: The package directory is not clean (excluding .deb files)."
echo "Please commit or stash your changes in $PACKAGE_DIR before proceeding."
exit 1
fi
for cmd in dpkg-scanpackages apt-ftparchive gpg gzip sed; do
if ! command -v "$cmd" &>/dev/null; then
echo "Error: Required command '$cmd' is not installed." >&2
exit 1
fi
done
dpkg-scanpackages --multiversion "$PACKAGE_DIR" | sed "s|$PACKAGE_DIR|./|" > "${PACKAGE_DIR}Packages"
gzip -k -f "${PACKAGE_DIR}Packages" --no-name
apt-ftparchive release "$PACKAGE_DIR" > "${PACKAGE_DIR}Release"
gpg --default-key "${EMAIL}" -abs -o "${PACKAGE_DIR}Release.gpg" "${PACKAGE_DIR}Release"
gpg --default-key "${EMAIL}" --clearsign -o "${PACKAGE_DIR}InRelease" "${PACKAGE_DIR}Release"