-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·39 lines (32 loc) · 1.01 KB
/
build.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
38
39
#!/bin/sh
PACKAGE="nexttrace"
REPO="nxtrace/NTrace-core"
VERSION="$(cat tag)"
ARCH="amd64 arm64"
AMD64_FILENAME="nexttrace_linux_amd64"
ARM64_FILENAME="nexttrace_linux_arm64"
get_url_by_arch() {
case $1 in
"amd64") echo "https://github.com/$REPO/releases/latest/download/$AMD64_FILENAME" ;;
"arm64") echo "https://github.com/$REPO/releases/latest/download/$ARM64_FILENAME" ;;
esac
}
build() {
# Prepare
BASE_DIR="$PACKAGE"_"$VERSION"-1_"$1"
cp -r templates "$BASE_DIR"
sed -i "s/Architecture: arch/Architecture: $1/" "$BASE_DIR/DEBIAN/control"
sed -i "s/Version: version/Version: $VERSION-1/" "$BASE_DIR/DEBIAN/control"
# Download and move file
curl -sLo "$BASE_DIR/usr/bin/$PACKAGE" "$(get_url_by_arch $1)"
chmod 755 "$BASE_DIR/usr/bin/$PACKAGE"
# Build
dpkg-deb --build --root-owner-group "$BASE_DIR"
}
for i in $ARCH; do
echo "Building $i package..."
build "$i"
done
# Create repo files
apt-ftparchive packages . > Packages
apt-ftparchive release . > Release