Skip to content

Commit

Permalink
QNAP support (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
phnzb authored Feb 9, 2024
1 parent 6501870 commit 9676c77
Show file tree
Hide file tree
Showing 30 changed files with 842 additions and 18 deletions.
29 changes: 23 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,28 @@ jobs:
build-synology:
uses: ./.github/workflows/synology.yml

build-qnap:
uses: ./.github/workflows/qnap.yml

repack-qnap:
uses: ./.github/workflows/qnap-repack.yml
with:
external_call: true
needs: [build-linux]
permissions:
actions: write

generate-signatures:
env:
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
runs-on: ubuntu-latest
needs: [build-windows, build-linux, build-osx, build-synology]
needs: [build-windows, build-linux, build-osx, build-synology, build-qnap, repack-qnap]
permissions:
actions: write
steps:

- name: Download build artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4

- name: Generate signatures
run: |
Expand All @@ -37,6 +50,8 @@ jobs:
mv nzbget-linux-installers/* builds || true
mv nzbget-osx-installers/* builds || true
mv nzbget-synology-packages/* builds || true
mv nzbget-qnap-packages/* builds || true
mv nzbget-qnap-native-packages/* builds || true
cd builds
VERSION=$(ls | grep bin-windows-setup | cut -d - -f 2)
if [ "$GITHUB_REF_NAME" != "main" ]; then VERSION="$VERSION-testing"; fi
Expand All @@ -48,7 +63,7 @@ jobs:
echo "nzbget_signatures({" | tee $SIGS_FILE
echo | tee -a $SIGS_FILE
for FILE in *.exe *.run *.zip *.spk; do
for FILE in *.exe *.run *.zip *.spk *.qpkg; do
[ -f $FILE ] || continue
MD5=$(openssl dgst -md5 $FILE | cut -d ' ' -f 2)
Expand All @@ -71,20 +86,22 @@ jobs:
echo "Done."
- name: Upload build artifacts with signatures
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: nzbget-installers
path: builds/*
retention-days: 5

- name: Delete unneded platform-specific artifacts
uses: geekyeggo/delete-artifact@v2
uses: geekyeggo/delete-artifact@v4
with:
name: |
nzbget-windows-installers
nzbget-linux-installers
nzbget-osx-installers
nzbget-synology-packages
nzbget-qnap-packages
nzbget-qnap-native-packages
make-testing-release:
runs-on: [self-hosted, linux]
Expand All @@ -103,7 +120,7 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}

- name: Download build artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4

- name: Create latest artifacts
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
done
- name: Upload build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: nzbget-linux-installers
path: /build/output/*.run
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
done
- name: Upload build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: nzbget-osx-installers
path: osx/build/Release/*.zip
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/qnap-repack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: qnap repack

on:
workflow_call:
inputs:
external_call:
description: 'To distinguish workflow_call from regular push / workflow_dispatch'
type: boolean
required: false
default: false
workflow_dispatch:

jobs:
build-linux:
uses: ./.github/workflows/linux.yml
if: ${{ inputs.external_call == false }}

repack:
runs-on: [self-hosted, linux]
needs: [build-linux]
if: always()
permissions:
actions: write

steps:

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download build artifacts
uses: actions/download-artifact@v4

- name: Repack linux installer for QNAP
run: |
export PATH="$PATH:/usr/share/QDK/bin"
bash qnap/repack-nzbget.sh
- name: Rename build artifacts
if: github.ref_name != 'main'
run: |
VERSION=$(cat configure.ac | grep AC_INIT | cut -d , -f 2 | xargs)
NEW_VERSION="$VERSION-testing-$(date '+%Y%m%d')"
cd /qnap/nzbget/build/
for FILE in *.qpkg; do
[ -f $FILE ] || continue
NEW_FILE=${FILE/$VERSION/$NEW_VERSION}
sudo mv $FILE $NEW_FILE
done
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: nzbget-qnap-packages
path: /qnap/nzbget/build/*.qpkg
retention-days: 5

- name: Delete unneded linux artifacts
if: ${{ inputs.external_call == false }}
uses: geekyeggo/delete-artifact@v4
with:
name: |
nzbget-linux-installers
49 changes: 49 additions & 0 deletions .github/workflows/qnap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: qnap build

on:
workflow_call:
workflow_dispatch:

jobs:
build:
runs-on: [self-hosted, linux]

steps:

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Save version for non-release to env
if: github.ref_name != 'main'
run: |
VERSION=$(cat configure.ac | grep AC_INIT | cut -d , -f 2 | xargs)
echo VERSION=$VERSION >> $GITHUB_ENV
- name: Build
run: |
export PATH="$PATH:/usr/share/QDK/bin"
bash qnap/build-nzbget.sh
- name: Rename build artifacts
if: github.ref_name != 'main'
run: |
cd /qnap/nzbget/build/
NEW_VERSION="$VERSION-testing-$(date '+%Y%m%d')"
for FILE in *.qpkg; do
[ -f $FILE ] || continue
NEW_FILE=${FILE/$VERSION/$NEW_VERSION}
sudo mv $FILE $NEW_FILE
done
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: nzbget-qnap-native-packages
path: /qnap/nzbget/build/*.qpkg
retention-days: 5

- name: Cleanup
run: |
rm -rf /qnap/nzbget/
4 changes: 2 additions & 2 deletions .github/workflows/synology.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -32,7 +32,7 @@ jobs:
done
- name: Upload build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: nzbget-synology-packages
path: /toolkit/result_spk/nzbget/*.spk
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
"C:\Program Files\CMake\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build
run: |
Expand All @@ -40,7 +40,7 @@ jobs:
ctest -C Release
- name: Upload test artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: nzbget-windows-test-log
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Change version for non-release
if: github.ref_name != 'main'
Expand All @@ -38,7 +38,7 @@ jobs:
}
- name: Upload build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: nzbget-windows-installers
path: C:\nzbget\build\output\*.exe
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
[![osx build](https://github.com/nzbgetcom/nzbget/actions/workflows/osx.yml/badge.svg)](https://github.com/nzbgetcom/nzbget/actions/workflows/osx.yml)
[![docker build](https://github.com/nzbgetcom/nzbget/actions/workflows/docker.yml/badge.svg)](https://github.com/nzbgetcom/nzbget/actions/workflows/docker.yml)
[![synology build](https://github.com/nzbgetcom/nzbget/actions/workflows/synology.yml/badge.svg)](https://github.com/nzbgetcom/nzbget/actions/workflows/synology.yml)
[![qnap build](https://github.com/nzbgetcom/nzbget/actions/workflows/qnap.yml/badge.svg)](https://github.com/nzbgetcom/nzbget/actions/workflows/qnap.yml)


![Contributions welcome](https://img.shields.io/badge/contributions-welcome-blue.svg)
Expand Down Expand Up @@ -38,6 +39,8 @@ We also provide a docker image for popular architectures. [Docker readme](docker

Synology packages are available as SynoCommunity packages and SPK packages. [Synology readme](synology/README.md)

QNAP packages are available as native packages and buildroot packages. [QNAP readme](qnap/README.md)

## Migration from older NZBGet versions

[Migrating from NZBGet v21 or older](https://github.com/nzbgetcom/nzbget/discussions/100#discussioncomment-8080102)
Expand Down
4 changes: 2 additions & 2 deletions daemon/extension/ExtensionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ namespace ExtensionManager
const char* location = ext.GetLocation();

ptrdiff_t count = std::count_if(
std::cbegin(m_extensions),
std::cend(m_extensions),
std::begin(m_extensions),
std::end(m_extensions),
[&location](const auto& ext) { return strcmp(location, ext->GetLocation()) == 0; }
);

Expand Down
30 changes: 30 additions & 0 deletions qnap/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# QNAP nzbget packages

We support QNAP via native qpkg packages, built with QNAP toolchains (only x86/x86_64/arm_64 QNAP architectures) and buildroot qpkg, repacked from linux installer (all QNAP architectures)

## Installing

Prerequsites: Enable installation of applications without digital signature (`AppCenter` - `Settings` - `Allow installation of applications without a valid digital signature`)

To install nzbget for QNAP download qpkg for your architecture, then from QNAP AppCenter select `Install Manually` - browse for downloaded qpkg and press `Install`
For digital signature warning select `I understand the risks and want to install this application` and press `Install`.
After installation - Press `Open` in AppCenter or click NZBGet icon on desktop. Default login/password for WebUI
```
Login: nzbget
Password: tegbzn6789
```

## Configuring

Change `PATHS` - `MainDir` to point to shared folder location, for example
```
/share/CACHEDEV1_DATA/Public/nzbget
```
By default, nzbget will download all files to package directory, inaccessible from shares.

## Extensions

QNAP packaged with python2. To support python3 extensions, need to install Python3 package from QNAP Store, and add to `EXTENSION SCRIPTS` - `ShellOverride` path to python3 executable like this:
```
.py=/share/CACHEDEV1_DATA/.qpkg/Python3/python3/bin/python3;
```
43 changes: 43 additions & 0 deletions qnap/build-info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# About

"build-nzbget.sh" is a bash script which is used to build nzbget QNAP packages.


# Prerequisites

- linux x86_64 host (Ubuntu 22.04 LTS for example)

We support building nzbget for QNAP for x86 / x86_64 / arm_64 architectures only, because other platforms toolchains is too old (nzbget need gcc 4.9+ for building).

- download x86/x86_64 toolchains from http://download.qnap.com/dev/Toolchain/QNAP_cross_toolchains_64.20160606.tar
- download arm_64 toolchain from http://download.qnap.com/dev/Toolchain/aarch64-QNAP-linux-gnu.tgz
- extract toolchains to $QNAP_ROOT/toolchain (default - /qnap/toolchain), needed directory structure for script:
```
/qnap/toolchain
├── aarch64
│   └── cross-tools
├── i686
│   ├── cross-tools
│   └── fs
└── x86_64
├── cross-tools
└── fs
```
- install QDK from `https://github.com/qnap-dev/QDK`
```
git clone https://github.com/qnap-dev/QDK
cd QDK
sed 's|python|python3|' -i InstallToUbuntu.sh
sudo ./InstallToUbuntu.sh install
```

# Building NZBGet

From cloned repository run
```
bash qnap/build-nzbget.sh
```

# Output files

- /qnap/nzbget/build/*.qpkg - one file per platform
Loading

0 comments on commit 9676c77

Please sign in to comment.