makedeb
A reverse proxy for NAT traversal
Viewing /PKGBUILD
.
Click here to go back to the Git tree for rathole.
# Maintainer: Menci <huanghaorui301@gmail.com>
_repo=rapiz1/rathole
pkgname=rathole
pkgver=0.4.2
pkgrel=1
pkgdesc="A reverse proxy for NAT traversal"
arch=('any')
url="https://github.com/${_repo}"
license=('Apache')
makedepends=('unzip')
source=(
"PKGBUILD.arch::https://raw.githubusercontent.com/archlinux/svntogit-community/packages/${pkgname}/trunk/PKGBUILD"
)
sha512sums=(
'SKIP'
)
pkgver() {
(source PKGBUILD.arch >/dev/null && echo "${pkgver}")
}
_rustarch() {
DPKG_ARCH="$(dpkg --print-architecture)"
if [[ "$DPKG_ARCH" == "amd64" ]]; then
echo "x86_64"
elif [[ "$DPKG_ARCH" == "arm64" ]]; then
echo "aarch64"
else
echo "$DPKG_ARCH"
fi
}
build() {
cd "${srcdir}"
RELEASE_FILENAME="rathole-$(_rustarch)-unknown-linux-musl.zip"
wget "https://github.com/${_repo}/releases/download/v${pkgver}/${RELEASE_FILENAME}" -O "${RELEASE_FILENAME}"
unzip "${RELEASE_FILENAME}"
git clone "https://github.com/${_repo}" --branch "v${pkgver}" --depth 1 git
}
package() {
cd "${srcdir}"
mkdir -p "$pkgdir/etc/$pkgname"
install -Dm 755 "$pkgname" -t "$pkgdir/usr/bin"
install -Dm 644 git/README.md -t "$pkgdir/usr/share/doc/$pkgname"
for svc in "${pkgname}@.service"; do
install -Dm 644 "git/examples/systemd/$svc" -t "$pkgdir/usr/lib/systemd/system/"
done
# Add install scripts
prerm="src/prerm"
echo '[ "$1" = "upgrade" ] && exit 0' > "${srcdir}/prerm"
echo "systemctl stop 'rathole@*'" >> "${srcdir}/prerm"
echo "systemctl disable rathole@" >> "${srcdir}/prerm"
}