freeze-watcher/packaging/build-package.sh

26 lines
855 B
Bash
Executable file

#!/bin/bash
# Build a local Arch package from the current source tree.
# Usage: ./packaging/build-package.sh
set -e
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
PKGNAME=freeze-watcher
PKGVER=$(awk -F= '/^pkgver=/{print $2}' "$REPO_ROOT/packaging/PKGBUILD")
cd "$REPO_ROOT"
tmp=$(mktemp -d)
trap "rm -rf $tmp" EXIT
# Stage source as a tarball (PKGBUILD expects it as $pkgname-$pkgver.tar.gz)
mkdir "$tmp/$PKGNAME-$PKGVER"
cp -r src systemd desktop config Makefile README.md LICENSE "$tmp/$PKGNAME-$PKGVER/" 2>/dev/null || true
tar czf "$tmp/$PKGNAME-$PKGVER.tar.gz" -C "$tmp" "$PKGNAME-$PKGVER"
cp packaging/PKGBUILD "$tmp/PKGBUILD"
cd "$tmp"
makepkg -f --noconfirm
mv "$PKGNAME-$PKGVER-"*.pkg.tar.* "$REPO_ROOT/"
echo
echo "Built: $REPO_ROOT/$(ls "$REPO_ROOT" | grep "^$PKGNAME-$PKGVER" | head -1)"
echo "Install with: sudo pacman -U <path-to-pkg>"