# Maintainer: Menci # Contributor: Clansty _pkgname=ddns-go _repo=jeessy2/ddns-go pkgname=${_pkgname}-bin pkgver=4.0.0 pkgrel=1 pkgdesc='简单好用的DDNS。自动更新域名解析到公网IP(支持阿里云、腾讯云dnspod、Cloudflare、华为云)' license=('MIT') arch=('any') url="https://github.com/${_repo}" provides=(${_pkgname}) conflicts=(${_pkgname}) source=(${_pkgname}.service) md5sums=(SKIP) pkgver() { curl https://api.github.com/repos/jeessy2/ddns-go/releases/latest | sed -nE 's/^ "tag_name": "v(.+)",$/\1/p' } _goarch() { DPKG_ARCH="$(dpkg --print-architecture)" if [[ "$DPKG_ARCH" == "amd64" ]]; then echo "x86_64" else echo "$DPKG_ARCH" fi } build() { cd "${srcdir}" RELEASE_FILENAME="ddns-go_${pkgver}_Linux_$(_goarch).tar.gz" wget "https://github.com/${_repo}/releases/download/v${pkgver}/${RELEASE_FILENAME}" -O "${RELEASE_FILENAME}" tar xzvf "${RELEASE_FILENAME}" } package() { install -Dm755 "${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}" install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE" install -Dm644 "${_pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${_pkgname}.service" # Add install scripts prerm="src/prerm" echo '[ "$1" = "upgrade" ] && exit 0' > "${srcdir}/prerm" echo "systemctl disable --now ddns-go" >> "${srcdir}/prerm" }