From f3b56ac01c0e39ebf6357bde47c19eff43b9b2da Mon Sep 17 00:00:00 2001 From: phnzb Date: Wed, 10 Apr 2024 15:49:01 +0300 Subject: [PATCH] Update pkg script and rpm spec --- linux/pkg/build-pkg.sh | 40 +++++++++++++++++++++++++++++++-------- linux/pkg/rpm/nzbget.spec | 6 +++--- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/linux/pkg/build-pkg.sh b/linux/pkg/build-pkg.sh index 0c2f5def6..ba989b904 100755 --- a/linux/pkg/build-pkg.sh +++ b/linux/pkg/build-pkg.sh @@ -5,7 +5,7 @@ set -e NZBGET_ROOT=$PWD -# installer - first param +# $1 - installer # if empty - find installer file in artifacts dir INSTALLER="$1" if [ -z $INSTALLER ]; then @@ -16,23 +16,47 @@ if [ -z $INSTALLER ]; then exit 1 fi -# config variables -DEB=yes -RPM=no -ARCHS="i686 x86_64 armel armhf aarch64" +# $2 - type of package(s) deb/rpm +# if empty - build deb and rpm +PKG_TYPE="$2" +if [ -z $PKG_TYPE ]; then + DEB=yes + RPM=yes +fi +if [ "$PKG_TYPE" == "deb" ]; then + DEB=yes + RPM=no +fi +if [ "$PKG_TYPE" == "rpm" ]; then + DEB=no + RPM=yes +fi + +# $3 - architectures +# if empty - use all available architectures +ARCHS="$3" +if [ -z $ARCHS ]; then + ARCHS="i686 x86_64 armel armhf aarch64" +fi # prepare directories mkdir -p build -rm -rf build/* cd build -mkdir -p deb -mkdir -p rpm +if [ "$DEB" == "yes" ]; then + rm -rf deb + mkdir -p deb +fi +if [ "$RPM" == "yes" ]; then + rm -rf rpm + mkdir -p rpm +fi # extract version VERSION=$(bash "$INSTALLER" --help | grep 'Installer for' | cut -d ' ' -f 3 | sed -r 's/nzbget-//') RPM_VERSION=${VERSION//-/} for ARCH in $ARCHS; do + rm -rf $PWD/$ARCH bash "$INSTALLER" --arch "$ARCH" --destdir "$PWD/$ARCH" --silent case $ARCH in i686) diff --git a/linux/pkg/rpm/nzbget.spec b/linux/pkg/rpm/nzbget.spec index be79ca39d..aad7e59bf 100644 --- a/linux/pkg/rpm/nzbget.spec +++ b/linux/pkg/rpm/nzbget.spec @@ -17,6 +17,6 @@ NZBGet is a command-line based binary newsgrabber for nzb files, written in C++. %install %files -/usr/local/bin/nzbget -/usr/local/share/doc/nzbget/ -/usr/local/share/nzbget/ +/usr/bin/nzbget +/usr/share/doc/nzbget/ +/usr/share/nzbget/