Skip to content

Commit

Permalink
Update pkg script and rpm spec
Browse files Browse the repository at this point in the history
  • Loading branch information
phnzb committed Apr 10, 2024
1 parent 374b354 commit f3b56ac
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
40 changes: 32 additions & 8 deletions linux/pkg/build-pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions linux/pkg/rpm/nzbget.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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/

0 comments on commit f3b56ac

Please sign in to comment.