From f344a6d55b6a8ec0841af6dc4d8226868b2e215e Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Fri, 2 Aug 2024 02:19:58 -0700 Subject: [PATCH] Update arch code --- .github/workflows/release.yml | 41 +++++++----- .gitignore | 2 + Makefile | 39 +++++++----- examples/MANUAL.md | 12 ++-- init/archlinux/PKGBUILD.template | 104 +++++++++++++++---------------- init/archlinux/SRCINFO.template | 28 ++++++--- init/archlinux/aur-deploy.sh | 87 ++++++++++++++------------ 7 files changed, 172 insertions(+), 141 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0079309eb..21d6f8c98 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -90,6 +90,11 @@ jobs: with: name: release path: release + - name: upload sha512sums.txt + uses: actions/upload-artifact@v4 + with: + name: sha512sums.txt + path: release/sha512sums.txt print-built-version: needs: @@ -118,7 +123,7 @@ jobs: name: ${{ matrix.files }} - name: Upload files to unstable.golift.io run: >- - for file in *.{zip,dmg,gz,zst}; do + for file in *.{zip,dmg,gz}; do [ -f "$file" ] || continue; echo "Uploading: ${file}"; curl -sSH "X-API-KEY: ${{ secrets.UNSTABLE_UPLOAD_KEY }}" "https://unstable.golift.io/upload.php?folder=notifiarr" -F "file=@${file}"; @@ -196,19 +201,23 @@ jobs: *.gz *.txt *.zst + *.sig - # archlinux-aur: - # # description: creates and uploads a PKGBUILD file to the golift/aur repo for arch linux. - # needs: - # - release - # - deploy-github - # name: Deploy ArchLinux AUR - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v4 - # with: - # fetch-depth: '0' - # - name: Deploy Aurch AUR - # run: bash init/archlinux/aur-deploy.sh - # env: - # DEPLOY_KEY: ${{ secrets.AUR_DEPLOY_KEY }} + archlinux-aur: + # description: creates and uploads a PKGBUILD file to the golift/aur repo for arch linux. + needs: + - release + name: Deploy ArchLinux AUR + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: '0' + - name: Download ${{ matrix.files }} Files + uses: actions/download-artifact@v4 + with: + name: sha512sums.txt + - name: Deploy Aurch AUR + run: bash init/archlinux/aur-deploy.sh + env: + DEPLOY_KEY: ${{ secrets.AUR_DEPLOY_KEY }} diff --git a/.gitignore b/.gitignore index 075978f28..0510455ff 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,8 @@ /*.deb /*.rpm /*.txz +/*.zst +/*.sig /*.*.arm /*.*.exe /*.*.macos diff --git a/Makefile b/Makefile index ffe4b7d0d..7e9870798 100644 --- a/Makefile +++ b/Makefile @@ -79,8 +79,9 @@ release: clean generate linux_packages freebsd_packages windows gzip -9r $@/ for i in notifiarr*.exe ; do zip -9qj $@/$$i.zip $$i examples/*.example *.html; rm -f $$i;done mv *.rpm *.deb *.txz *.zst $@/ + mv *.sig $@/ || echo "...ignoring previous error" # Generating File Hashes - openssl dgst -r -sha256 $@/* | sed 's#release/##' | tee $@/checksums.sha256.txt + openssl dgst -r -sha512 $@/* | sed 's#release/##' | tee $@/sha512sums.txt # requires a mac. signdmg: Notifiarr.app @@ -89,7 +90,7 @@ signdmg: Notifiarr.app # Delete all build assets. clean: rm -f notifiarr notifiarr.*.{macos,freebsd,linux,exe}{,.gz,.zip} notifiarr.1{,.gz} notifiarr.rb - rm -f notifiarr{_,-}*.{deb,rpm,txz} v*.tar.gz.sha256 examples/MANUAL .metadata.make rsrc_*.syso + rm -f notifiarr{_,-}*.{deb,rpm,txz,zst,sig} v*.tar.gz.sha256 examples/MANUAL .metadata.make rsrc_*.syso rm -f cmd/notifiarr/README{,.html} README{,.html} ./notifiarr_manual.html rsrc.syso Notifiarr.*.app.zip rm -f notifiarr.service pack.temp.dmg notifiarr.conf.example rm -rf package_build_* release Notifiarr.*.app Notifiarr.app @@ -248,20 +249,26 @@ notifiarr_$(VERSION)-$(ITERATION)_armhf.deb: package_build_linux_armhf_deb check fpm -s dir -t deb $(PACKAGE_ARGS) -a armhf -v $(VERSION) -C $< $(EXTRA_FPM_FLAGS) [ "$(SIGNING_KEY)" = "" ] || debsigs --default-key="$(SIGNING_KEY)" --sign=origin notifiarr_$(VERSION)-$(ITERATION)_armhf.deb -zst: notifiarr_$(VERSION)-$(ITERATION)-x86_64.pkg.tar.zst -notifiarr_$(VERSION)-$(ITERATION)-x86_64.pkg.tar.zst: package_build_linux_zst check_fpm +zst: notifiarr-$(VERSION)-$(ITERATION)-x86_64.pkg.tar.zst notifiarr-$(VERSION)-$(ITERATION)-x86_64.pkg.tar.zst.sig +notifiarr-$(VERSION)-$(ITERATION)-x86_64.pkg.tar.zst: package_build_linux_zst check_fpm @echo "Building 'pacman' package for notifiarr version '$(VERSION)-$(ITERATION)'." fpm -s dir -t pacman $(PACKAGE_ARGS) -a x86_64 -v $(VERSION) -C $< $(EXTRA_FPM_FLAGS) +notifiarr-$(VERSION)-$(ITERATION)-x86_64.pkg.tar.zst.sig: notifiarr-$(VERSION)-$(ITERATION)-x86_64.pkg.tar.zst + [ "$(SIGNING_KEY)" = "" ] || gpg --local-user "$(SIGNING_KEY)" --output $@ --detach-sig $< -zstarm: notifiarr_$(VERSION)-$(ITERATION)-aarch64.pkg.tar.zst -notifiarr_$(VERSION)-$(ITERATION)-aarch64.pkg.tar.zst: package_build_linux_aarch64_zst check_fpm +zstarm: notifiarr-$(VERSION)-$(ITERATION)-aarch64.pkg.tar.zst notifiarr-$(VERSION)-$(ITERATION)-aarch64.pkg.tar.zst.sig +notifiarr-$(VERSION)-$(ITERATION)-aarch64.pkg.tar.zst: package_build_linux_aarch64_zst check_fpm @echo "Building 64-bit ARM8 'pacman' package for notifiarr version '$(VERSION)-$(ITERATION)'." fpm -s dir -t pacman $(PACKAGE_ARGS) -a aarch64 -v $(VERSION) -C $< $(EXTRA_FPM_FLAGS) +notifiarr-$(VERSION)-$(ITERATION)-aarch64.pkg.tar.zst.sig: notifiarr-$(VERSION)-$(ITERATION)-aarch64.pkg.tar.zst + [ "$(SIGNING_KEY)" = "" ] || gpg --local-user "$(SIGNING_KEY)" --output $@ --detach-sig $< -zstarmhf: notifiarr_$(VERSION)-$(ITERATION)-armhf.pkg.tar.zst -notifiarr_$(VERSION)-$(ITERATION)-armhf.pkg.tar.zst: package_build_linux_armhf_zst check_fpm +zstarmhf: notifiarr-$(VERSION)-$(ITERATION)-armhf.pkg.tar.zst notifiarr-$(VERSION)-$(ITERATION)-armhf.pkg.tar.zst.sig +notifiarr-$(VERSION)-$(ITERATION)-armhf.pkg.tar.zst: package_build_linux_armhf_zst check_fpm @echo "Building 32-bit ARM6/7 HF 'pacman' package for notifiarr version '$(VERSION)-$(ITERATION)'." fpm -s dir -t pacman $(PACKAGE_ARGS) -a armhf -v $(VERSION) -C $< $(EXTRA_FPM_FLAGS) +notifiarr-$(VERSION)-$(ITERATION)-armhf.pkg.tar.zst.sig: notifiarr-$(VERSION)-$(ITERATION)-armhf.pkg.tar.zst + [ "$(SIGNING_KEY)" = "" ] || gpg --local-user "$(SIGNING_KEY)" --output $@ --detach-sig $< freebsd_pkg: notifiarr-$(VERSION)_$(ITERATION).amd64.txz notifiarr-$(VERSION)_$(ITERATION).amd64.txz: package_build_freebsd check_fpm @@ -284,10 +291,10 @@ package_build_linux_rpm: generate readme man linux notifiarr.conf.example mkdir -p $@/usr/bin $@/etc/notifiarr $@/usr/share/man/man1 $@/usr/share/doc/notifiarr $@/var/log/notifiarr # Copying the binary, config file, unit file, and man page into the env. cp notifiarr.amd64.linux $@/usr/bin/notifiarr - cp *.1.gz $@/usr/share/man/man1 + cp ./*.1.gz $@/usr/share/man/man1 cp notifiarr.conf.example $@/etc/notifiarr/ cp notifiarr.conf.example $@/etc/notifiarr/notifiarr.conf - cp LICENSE *.html examples/*?.?* pkg/bindata/files/images/logo/notifiarr.png $@/usr/share/doc/notifiarr/ + cp LICENSE ./*.html examples/*?.?* pkg/bindata/files/images/logo/notifiarr.png $@/usr/share/doc/notifiarr/ mkdir -p $@/lib/systemd/system cp init/systemd/notifiarr.service $@/lib/systemd/system/ [ ! -d "init/linux/rpm" ] || cp -r init/linux/rpm/* $@ @@ -298,10 +305,10 @@ package_build_linux_deb: generate readme man linux notifiarr.conf.example mkdir -p $@/usr/bin $@/etc/notifiarr $@/usr/share/man/man1 $@/usr/share/doc/notifiarr $@/var/log/notifiarr # Copying the binary, config file, unit file, and man page into the env. cp notifiarr.amd64.linux $@/usr/bin/notifiarr - cp *.1.gz $@/usr/share/man/man1 + cp ./*.1.gz $@/usr/share/man/man1 cp notifiarr.conf.example $@/etc/notifiarr/ cp notifiarr.conf.example $@/etc/notifiarr/notifiarr.conf - cp LICENSE *.html examples/*?.?* pkg/bindata/files/images/logo/notifiarr.png $@/usr/share/doc/notifiarr/ + cp LICENSE ./*.html examples/*?.?* pkg/bindata/files/images/logo/notifiarr.png $@/usr/share/doc/notifiarr/ mkdir -p $@/lib/systemd/system cp init/systemd/notifiarr.service $@/lib/systemd/system/ [ ! -d "init/linux/deb" ] || cp -r init/linux/deb/* $@ @@ -312,10 +319,10 @@ package_build_linux_zst: generate readme man linux notifiarr.conf.example mkdir -p $@/usr/bin $@/etc/notifiarr $@/usr/share/man/man1 $@/usr/share/doc/notifiarr $@/var/log/notifiarr # Copying the binary, config file, unit file, and man page into the env. cp notifiarr.amd64.linux $@/usr/bin/notifiarr - cp *.1.gz $@/usr/share/man/man1 + cp ./*.1.gz $@/usr/share/man/man1 cp notifiarr.conf.example $@/etc/notifiarr/ cp notifiarr.conf.example $@/etc/notifiarr/notifiarr.conf - cp LICENSE *.html examples/*?.?* pkg/bindata/files/images/logo/notifiarr.png $@/usr/share/doc/notifiarr/ + cp LICENSE ./*.html examples/*?.?* pkg/bindata/files/images/logo/notifiarr.png $@/usr/share/doc/notifiarr/ mkdir -p $@/usr/lib/systemd/system $@/usr/lib/sysusers.d chmod 775 $@/var/log/notifiarr $@/usr/share/doc/notifiarr $@/etc/notifiarr cp init/systemd/notifiarr.service $@/usr/lib/systemd/system/ @@ -366,10 +373,10 @@ package_build_freebsd: generate readme man freebsd notifiarr.conf.example mkdir -p $@/usr/local/bin $@/usr/local/etc/notifiarr $@/usr/local/share/man/man1 $@/usr/local/share/doc/notifiarr $@/usr/local/var/log/notifiarr date "+%Y/%m/%d %H:%M:%S Built Package Notifiarr $(VERSION)-$(ITERATION) - this file may be safely deleted" >> $@/usr/local/var/log/notifiarr/buildlog.txt cp notifiarr.amd64.freebsd $@/usr/local/bin/notifiarr - cp *.1.gz $@/usr/local/share/man/man1 + cp ./*.1.gz $@/usr/local/share/man/man1 cp notifiarr.conf.example $@/usr/local/etc/notifiarr/ cp notifiarr.conf.example $@/usr/local/etc/notifiarr/notifiarr.conf - cp LICENSE *.html examples/*?.?* pkg/bindata/files/images/logo/notifiarr.png $@/usr/local/share/doc/notifiarr/ + cp LICENSE ./*.html examples/*?.?* pkg/bindata/files/images/logo/notifiarr.png $@/usr/local/share/doc/notifiarr/ mkdir -p $@/usr/local/etc/rc.d cp init/bsd/freebsd.rc.d $@/usr/local/etc/rc.d/notifiarr chmod +x $@/usr/local/etc/rc.d/notifiarr diff --git a/examples/MANUAL.md b/examples/MANUAL.md index c2ca1b68c..d06f68aed 100644 --- a/examples/MANUAL.md +++ b/examples/MANUAL.md @@ -79,17 +79,13 @@ CONFIGURATION The default configuration file location changes depending on operating system. See the provided example configuration file for parameter information. -INPUT ---- - -On Windows and with the App version on macOS you can work with the app using the -system tray menu. On Unix OSes you can send a USR1 signal to re-write the config -file using a built-in template. Backup your existing config file first. - AUTHOR --- * David Newhall II - 12/2020 LOCATION --- -* Notifiarr: [https://github.com/Notifiarr/notifiarr](https://github.com/Notifiarr/notifiarr) +* Code: [https://github.com/Notifiarr/notifiarr](https://github.com/Notifiarr/notifiarr) +* WWW: [https://notifiarr.com](https://notifiarr.com) +* Help: [https://notifiarr.wiki](https://notifiarr.wiki) +* Chat: [https://notifiarr.com/discord](https://notifiarr.com/discord) \ No newline at end of file diff --git a/init/archlinux/PKGBUILD.template b/init/archlinux/PKGBUILD.template index 7950362e9..93674cd53 100644 --- a/init/archlinux/PKGBUILD.template +++ b/init/archlinux/PKGBUILD.template @@ -1,63 +1,63 @@ -pkgname=notifiarr -pkgver={{VERSION}} -pkgrel={{Iter}} +# Maintainer: David Newhall II + +pkgname='notifiarr-bin' +appname='notifiarr' +pkgver='{{VERSION}}' +pkgrel='{{Iter}}' pkgdesc='{{Desc}}' -arch=('x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64' 'i686' 'pentium4') +arch=('x86_64' 'armhf' 'armv7h' 'aarch64' 'i686' 'pentium4') url='https://notifiarr.com' license=('MIT') -makedepends=('go' 'make') -source=("notifiarr-${pkgver}.tar.gz::{{SOURCE_PATH}}") -sha256sums=('{{SHA256}}') -configfile='notifiarr.conf' -backup=("etc/${pkgname}/${configfile}") -install="${pkgname}.aur.install" +backup=("etc/${appname}/${appname}.conf") -build() { - cd "$pkgname-$pkgver" - make clean man generate VERSION="${pkgver}" ITERATION="${pkgrel}" - - if [ "$CARCH" == "x86_64" ]; then - make linux VERSION="${pkgver}" ITERATION="${pkgrel}" - mv "$pkgname.amd64.linux" "$pkgname" - elif [ "$CARCH" == "arm" ] || [ "$CARCH" == "armv6h" ] || [ "$CARCH" == "armv7h" ]; then - make armhf VERSION="${pkgver}" ITERATION="${pkgrel}" - mv "$pkgname.armhf.linux" "$pkgname" - elif [ "$CARCH" == "aarch64" ]; then - make arm64 VERSION="${pkgver}" ITERATION="${pkgrel}" - mv "$pkgname.arm64.linux" "$pkgname" - elif [ "$CARCH" == "i686" ] || [ "$CARCH" == "pentium4" ]; then - make linux386 VERSION="${pkgver}" ITERATION="${pkgrel}" - mv "$pkgname.i386.linux" "$pkgname" - fi -} +source=("${pkgname}-${pkgver}.tar.gz::https://codeload.github.com/Notifiarr/notifiarr/tar.gz/refs/tags/v${pkgver}") +sha512sums=('{{SHA}}') -check() { - cd "$pkgname-$pkgver" - go test ./... +source_x86_64=("${pkgname}-${pkgver}.x86_64.gz::https://github.com/Notifiarr/notifiarr/releases/download/v${pkgver}/notifiarr.amd64.linux.gz") +source_armhf=("${pkgname}-${pkgver}.armhf.gz::https://github.com/Notifiarr/notifiarr/releases/download/v${pkgver}/notifiarr.arm.linux.gz") +source_armv7h=("${pkgname}-${pkgver}.armv7h.gz::https://github.com/Notifiarr/notifiarr/releases/download/v${pkgver}/notifiarr.arm.linux.gz") +source_aarch64=("${pkgname}-${pkgver}.aarch64.gz::https://github.com/Notifiarr/notifiarr/releases/download/v${pkgver}/notifiarr.arm64.linux.gz") +source_i686=("${pkgname}-${pkgver}.i686.gz::https://github.com/Notifiarr/notifiarr/releases/download/v${pkgver}/notifiarr.386.linux.gz") +source_pentium4=("${pkgname}-${pkgver}.pentium4.gz::https://github.com/Notifiarr/notifiarr/releases/download/v${pkgver}/notifiarr.386.linux.gz") +sha512sums_x86_64=('{{SHA_X64}}') +sha512sums_armhf=('{{SHA_ARMHF}}') +sha512sums_armv7h=('{{SHA_ARMHF}}') +sha512sums_aarch64=('{{SHA_ARCH64}}') +sha512sums_i686=('{{SHA_386}}') +sha512sums_pentium4=('{{SHA_386}}') + +build() { + cd "${appname}-${pkgver}" + go run github.com/davidnewhall/md2roff@v0.0.1 --manual "${appname}" --version "${pkgver}" --date "${DATE}" README.md + go run github.com/davidnewhall/md2roff@v0.0.1 --manual "${appname}" --version "${pkgver}" --date "${DATE}" examples/MANUAL.md + gzip -9 examples/MANUAL + mv examples/MANUAL.gz "${appname}.1.gz" } -package() { - cd "$pkgname-$pkgver" +package() { # Binary. - install -Dm755 "${pkgname}" "${pkgdir}/usr/bin/${pkgname}" + install -D -m 755 "${pkgname}-${pkgver}.${CARCH}" "${pkgdir}/usr/bin/${appname}" + + cd "${appname}-${pkgver}" + # Directories. - install -dm0755 "${pkgdir}/usr/share/doc/${pkgname}" "${pkgdir}/usr/share/applications" \ - "${pkgdir}/usr/share/licenses/${pkgname}" "${pkgdir}/etc/${pkgname}" - # Man file. - install -Dm644 "${pkgname}.1.gz" "${pkgdir}/usr/share/man/man1/${pkgname}.1.gz" - # Config file, and example config file. - install -m644 "examples/${configfile}.example" "${pkgdir}/etc/${pkgname}/${configfile}.example" - install -m644 "examples/${configfile}.example" "${pkgdir}/etc/${pkgname}/${configfile}" - # Extra documentation. - install -m644 *.html examples/* pkg/bindata/files/images/logo/${pkgname}.png "${pkgdir}/usr/share/doc/${pkgname}/" + install -d -m 775 "${pkgdir}/usr/share/"{licenses,doc}"/${appname}" "${pkgdir}/usr/share/applications" "${pkgdir}/etc/${appname}" + + # Install configuration file(s). + install -D -m 644 "examples/${appname}.conf.example" "${pkgdir}/etc/${appname}/${appname}.conf" + install -D -m 644 "examples/${appname}.conf.example" "${pkgdir}/etc/${appname}/${appname}.conf.example" + + # License, documentation, logo icon, manual. + install -D -m 644 LICENSE "${pkgdir}/usr/share/licenses/${appname}/LICENSE" + install -D -m 644 ./*.html examples/* pkg/bindata/files/images/logo/${appname}.png "${pkgdir}/usr/share/doc/${appname}/" + install -D -m 644 "${appname}.1.gz" "${pkgdir}/usr/share/man/man1/${appname}.1.gz" + # X11 Desktop File. - install -m755 init/linux/deb/usr/share/applications/${pkgname}.desktop "${pkgdir}/usr/share/applications/" - # License. - install -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" - # User and group. - echo 'u notifiarr - "notifiarr.com client" -' > sysusers.conf - install -Dm0644 "sysusers.conf" "${pkgdir}/usr/lib/sysusers.d/notifiarr.conf" - rm sysusers.conf - # Systemd Service Unit. - install -Dm644 "init/systemd/${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}.service" + install -D -m 755 init/linux/deb/usr/share/applications/${appname}.desktop "${pkgdir}/usr/share/applications/" + + # Install the systemd service unit and system user account. + install -D -m 644 "init/systemd/${appname}.service" "${pkgdir}/usr/lib/systemd/system/${appname}.service" + echo "u ${appname} - \"${appname} daemon\"" > "${appname}.sysusers" + install -D -m 644 "${appname}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${appname}.conf" + rm "${appname}.sysusers" } diff --git a/init/archlinux/SRCINFO.template b/init/archlinux/SRCINFO.template index ded720def..61f174306 100644 --- a/init/archlinux/SRCINFO.template +++ b/init/archlinux/SRCINFO.template @@ -1,21 +1,29 @@ -pkgbase = notifiarr +pkgbase = notifiarr-bin pkgdesc = {{Desc}} pkgver = {{VERSION}} pkgrel = {{Iter}} url = https://notifiarr.com - install = notifiarr.aur.install arch = x86_64 - arch = arm - arch = armv6h + arch = armhf arch = armv7h arch = aarch64 arch = i686 arch = pentium4 license = MIT - makedepends = go - makedepends = make - backup = etc/notifiarr/notifiarr.conf - source = notifiarr-{{VERSION}}.tar.gz::{{SOURCE_PATH}} - sha256sums = {{SHA256}} + backup = etc/notifiarr-bin/notifiarr-bin.conf + source = notifiarr-{{VERSION}}.tar.gz::https://codeload.github.com/Notifiarr/notifiarr/tar.gz/refs/tags/v{{VERSION}} + sha256sums = {{SHA}} + source_x86_64 = notifiarr-bin-{{VERSION}}.x86_64.gz::https://github.com/Notifiarr/notifiarr/releases/download/v{{VERSION}}/notifiarr.amd64.linux.gz + sha512sums_x86_64 = {{SHA_X64}} + source_armhf = notifiarr-bin-{{VERSION}}.armhf.gz::https://github.com/Notifiarr/notifiarr/releases/download/v{{VERSION}}/notifiarr.arm.linux.gz + sha512sums_armhf = {{SHA_ARMHF}} + source_armv7h = notifiarr-bin-{{VERSION}}.armv7h.gz::https://github.com/Notifiarr/notifiarr/releases/download/v{{VERSION}}/notifiarr.arm.linux.gz + sha512sums_armv7h = {{SHA_ARMHF}} + source_aarch64 = notifiarr-bin-{{VERSION}}.aarch64.gz::https://github.com/Notifiarr/notifiarr/releases/download/v{{VERSION}}/notifiarr.arm64.linux.gz + sha512sums_aarch64 = {{SHA_ARCH64}} + source_i686 = notifiarr-bin-{{VERSION}}.i686.gz::https://github.com/Notifiarr/notifiarr/releases/download/v{{VERSION}}/notifiarr.386.linux.gz + sha512sums_i686 = {{SHA_386}} + source_pentium4 = notifiarr-bin-{{VERSION}}.pentium4.gz::https://github.com/Notifiarr/notifiarr/releases/download/v{{VERSION}}/notifiarr.386.linux.gz + sha512sums_pentium4 = {{SHA_386}} -pkgname = notifiarr +pkgname = notifiarr-bin diff --git a/init/archlinux/aur-deploy.sh b/init/archlinux/aur-deploy.sh index a88170d85..17a01abb0 100755 --- a/init/archlinux/aur-deploy.sh +++ b/init/archlinux/aur-deploy.sh @@ -1,15 +1,38 @@ #!/bin/bash -x -# Deploys a new aur PKGBUILD file to am arch linux aur github repo. +# Deploys a new aur PKGBUILD file to the Arch Linux AUR repo. # Run by GitHub Actions when a new release is created on GitHub. source settings.sh -SOURCE_PATH=https://github.com/Notifiarr/notifiarr/archive/v${VERSION}.tar.gz +sha512sum=sha512sum +$sha512sum -v 2>/dev/null || sha512sum="shasum -a 512" # macos + +SOURCE_PATH="https://github.com/Notifiarr/notifiarr/archive/v${VERSION}.tar.gz" echo "==> Using URL: $SOURCE_PATH" -SHA256=$(curl -sL $SOURCE_PATH | openssl dgst -r -sha256 | awk '{print $1}') +SHA=$(curl -sL "$SOURCE_PATH" | $sha512sum | awk '{print $1}') + +if [ -f sha512sums.txt ]; then + echo "==> Using SHA512SUMS file" + SHA_X64=$(grep notifiarr.amd64.linux.gz sha512sums.txt | awk '{print $1}') + SHA_ARMHF=$(grep notifiarr.arm.linux.gz sha512sums.txt | awk '{print $1}') + SHA_ARCH64=$(grep notifiarr.arm64.linux.gz sha512sums.txt | awk '{print $1}') + SHA_386=$(grep notifiarr.386.linux.gz sha512sums.txt | awk '{print $1}') +else + echo "==> Not Using SHA512SUMS file" + source_x64="https://github.com/Notifiarr/notifiarr/releases/download/v${VERSION}/notifiarr.amd64.linux.gz" + source_armhf="https://github.com/Notifiarr/notifiarr/releases/download/v${VERSION}/notifiarr.arm.linux.gz" + source_arm64="https://github.com/Notifiarr/notifiarr/releases/download/v${VERSION}/notifiarr.arm64.linux.gz" + source_386="https://github.com/Notifiarr/notifiarr/releases/download/v${VERSION}/notifiarr.386.linux.gz" + SHA_X64=$(curl -sL "$source_x64" | $sha512sum | awk '{print $1}') + SHA_ARMHF=$(curl -sL "$source_armhf" | $sha512sum | awk '{print $1}') + SHA_ARCH64=$(curl -sL "$source_arm64" | $sha512sum | awk '{print $1}') + SHA_386=$(curl -sL "$source_386" | $sha512sum | awk '{print $1}') +fi push_it() { + git config user.email "code@golift.io" + git config user.name "notifiarr-github-releaser" pushd release_repo git add . git commit -m "Update notifiarr on Release: v${VERSION}-${ITERATION}" @@ -18,51 +41,37 @@ push_it() { rm -rf release_repo } -# Make an id_rsa file with our secret. -mkdir -p $HOME/.ssh -KEY_FILE="$(mktemp -u $HOME/.ssh/XXXXX)" -echo "${DEPLOY_KEY}" > "${KEY_FILE}" -chmod 600 "${KEY_FILE}" -# Configure ssh to use this secret on a custom github hostname. -GITHUB_HOST="github.$(basename $KEY_FILE)" -printf "%s\n" \ - "Host $GITHUB_HOST" \ - " HostName github.com" \ - " IdentityFile ${KEY_FILE}" \ - " StrictHostKeyChecking no" \ - " LogLevel ERROR" | tee -a $HOME/.ssh/config +set -e -git config --global user.email "notifiarr@auto.releaser" -git config --global user.name "notifiarr-auto-releaser" +if [[ -n $DEPLOY_KEY ]]; then + KEY_FILE=$(mktemp -u "$HOME"/.ssh/XXXXX) + echo "${DEPLOY_KEY}" > "${KEY_FILE}" + chmod 600 "${KEY_FILE}" + # Configure ssh to use this secret. + export GIT_SSH_COMMAND="ssh -i ${KEY_FILE} -o 'StrictHostKeyChecking no'" +fi rm -rf release_repo -git clone git@${GITHUB_HOST}:golift/aur.git release_repo -mkdir -p release_repo/notifiarr +git clone aur@aur.archlinux.org:notifiarr-bin.git release_repo sed -e "s/{{VERSION}}/${VERSION}/g" \ -e "s/{{Iter}}/${ITERATION}/g" \ - -e "s/{{SHA256}}/${SHA256}/g" \ + -e "s/{{SHA}}/${SHA}/g" \ -e "s/{{Desc}}/${DESC}/g" \ - -e "s%{{SOURCE_PATH}}%${SOURCE_PATH}%g" \ - init/archlinux/PKGBUILD.template | tee release_repo/notifiarr/PKGBUILD + -e "s%{{SHA_X64}}%${SHA_X64}%g" \ + -e "s%{{SHA_ARMHF}}%${SHA_ARMHF}%g" \ + -e "s%{{SHA_ARCH64}}%${SHA_ARCH64}%g" \ + -e "s%{{SHA_386}}%${SHA_386}%g" \ + init/archlinux/PKGBUILD.template | tee release_repo/PKGBUILD sed -e "s/{{VERSION}}/${VERSION}/g" \ -e "s/{{Iter}}/${ITERATION}/g" \ - -e "s/{{SHA256}}/${SHA256}/g" \ + -e "s/{{SHA}}/${SHA}/g" \ -e "s/{{Desc}}/${DESC}/g" \ - -e "s%{{SOURCE_PATH}}%${SOURCE_PATH}%g" \ - init/archlinux/SRCINFO.template | tee release_repo/notifiarr/.SRCINFO - -tee release_repo/notifiarr/notifiarr.aur.install << EOF -post_upgrade() { - /bin/systemctl restart notifiarr -} - -pre_remove() { - /bin/systemctl stop notifiarr - /bin/systemctl disable notifiarr -} -EOF - + -e "s%{{SHA_X64}}%${SHA_X64}%g" \ + -e "s%{{SHA_ARMHF}}%${SHA_ARMHF}%g" \ + -e "s%{{SHA_ARCH64}}%${SHA_ARCH64}%g" \ + -e "s%{{SHA_386}}%${SHA_386}%g" \ + init/archlinux/SRCINFO.template | tee release_repo/.SRCINFO -[ "$1" == "-nopush" ] || push_it +[ "$1" != "" ] || push_it