blob: bc9df5e0ed04d70283d11a8da643178df276e6fe (
plain)
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
38
39
40
|
#!/usr/bin/env bash
#
# Helper script for building a variant instead of the consumer version.
set -euo pipefail
print_usage() {
echo "Usage: $0 (blue|work)"
}
capitalize() {
printf '%s' "$1" | head -c 1 | tr "[:lower:]" "[:upper:]"
printf '%s' "$1" | tail -c '+2'
}
# Parse args
if [[ $# -ne 1 ]]; then
print_usage
exit 1
fi
target=$1
if [[ $target != "blue" && $target != "work" ]]; then
print_usage
exit 1
fi
target_cap=$(capitalize "$target")
# Ensure clean state
pkgbuild_modified=$(git status --porcelain=v1 PKGBUILD | wc -l)
if [[ $pkgbuild_modified -ne 0 ]]; then
echo "Error: PKGBUILD contains uncommitted modifications. Aborting."
exit 1
fi
echo "Patching for variant $target"
sed -i "s/^pkgname=.*/pkgname=threema-$target-desktop/" PKGBUILD
sed -i "s/^_binname=.*/_binname=threema-$target/" PKGBUILD
sed -i "s/^_variant=.*/_variant=$target/" PKGBUILD
sed -i "s/^_appname=.*/_appname=\"Threema $target_cap\"/" PKGBUILD
sed -i "s/^pkgdesc=.*/pkgdesc=\"Threema $target_cap Desktop (Threema Web in Electron)\"/" PKGBUILD
|