prowlarr
This commit is contained in:
parent
511353d0d4
commit
94a824a654
95
prowlarr.sh
Executable file
95
prowlarr.sh
Executable file
|
@ -0,0 +1,95 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
json=$(curl -Ls https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest --header "Authorization: Bearer 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" --header "X-GitHub-Api-Version: 2022-11-28")
|
||||
|
||||
name=$(jq '.name' <<<$json | tr -d '"')
|
||||
echo "Building Prowlarr v$name"
|
||||
|
||||
control_file="Section: video
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.2
|
||||
Maintainer: alex
|
||||
Package: prowlarr
|
||||
Version: $name
|
||||
Architecture: REPLACE_ARCHITECTURE
|
||||
Description: prowlarr"
|
||||
|
||||
package_info="PackageAuthor=alex
|
||||
UpdateMethod=External
|
||||
UpdateMethodMessage=rebuild apt packages
|
||||
Branch=master"
|
||||
|
||||
service_file="# Be sure to use \$(systemctl edit prowlarr) to modify this service with an override.conf because
|
||||
# direct changes will be overwritten by package updates.
|
||||
|
||||
[Unit]
|
||||
Description=prowlarr Service
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
User=prowlarr
|
||||
Group=prowlarr
|
||||
SyslogIdentifier=prowlarr
|
||||
ExecStart=/usr/lib/prowlarr/bin/Prowlarr -nobrowser -data=/var/lib/prowlarr
|
||||
Type=simple
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target"
|
||||
|
||||
sysusers_file="u prowlarr - \"prowlarr daemon\" /var/lib/prowlarr"
|
||||
|
||||
tmpfiles_file="# Override this file with a modified version in /etc/tmpfiles.d/
|
||||
d /var/lib/prowlarr 0755 prowlarr prowlarr
|
||||
Z /var/lib/prowlarr - prowlarr prowlarr
|
||||
L /var/log/prowlarr - - - - /var/lib/prowlarr/logs/"
|
||||
|
||||
rel_info=$(jq '.assets[] | select(.name | contains("linux")) | select(.name | contains("musl") | not)' <<<$json)
|
||||
declare -a tarballs=($(jq '"\(.browser_download_url) /\(.name)"' <<<$rel_info | tr -d '"' | tr "\n" " "))
|
||||
|
||||
for ((i = 1; i < ${#tarballs[@]}; i += 2)); do
|
||||
url="${tarballs[i]}"
|
||||
filename="${tarballs[i + 1]#/}"
|
||||
echo $filename
|
||||
arch=$(sed -E "s/^.+?linux-(.+?).tar.gz$/\1/g" <<<"${tarballs[i + 1]}")
|
||||
if [[ "$arch" == "x64" ]] || [[ "$arch" == "core-x64" ]]; then
|
||||
arch="amd64"
|
||||
fi
|
||||
if [[ "$arch" == "core-x86" ]]; then
|
||||
arch="i386"
|
||||
fi
|
||||
if [[ "$arch" == "arm" ]] || [[ "$arch" == "core-arm" ]]; then
|
||||
arch="armhf"
|
||||
fi
|
||||
if [[ "$arch" == "core-arm64" ]]; then
|
||||
arch="arm64"
|
||||
fi
|
||||
echo "url: $url, arch: $arch"
|
||||
if [ -z "$1" ] || [[ "$arch" == "$1" ]]; then
|
||||
dir=$(mktemp -d)
|
||||
current_dir=$PWD
|
||||
mkdir -p $dir/prowlarr
|
||||
cd $dir/prowlarr
|
||||
mkdir -p usr/lib/sysusers.d
|
||||
echo $sysusers_file >usr/lib/sysusers.d/prowlarr.conf
|
||||
mkdir -p usr/lib/systemd/system
|
||||
echo $service_file >usr/lib/systemd/system/prowlarr.service
|
||||
mkdir -p usr/lib/tmpfiles.d
|
||||
echo $tmpfiles_file >usr/lib/tmpfiles.d/prowlarr.conf
|
||||
mkdir -p usr/lib/prowlarr
|
||||
echo "$package_info\nPackageVersion=$name" >usr/lib/prowlarr/package_info
|
||||
curl -Ls $url | tar xz
|
||||
rm -rf Prowlarr/Prowlarr.Update
|
||||
mv Prowlarr usr/lib/prowlarr/bin
|
||||
chmod +x usr/lib/prowlarr/bin/Prowlarr
|
||||
mkdir -p DEBIAN
|
||||
echo $control_file | sed -E "s/REPLACE_ARCHITECTURE/$arch/g" >DEBIAN/control
|
||||
cd $dir
|
||||
dpkg-deb --build prowlarr
|
||||
mkdir -p $current_dir/build/prowlarr
|
||||
cp prowlarr.deb $current_dir/build/prowlarr/prowlarr-$name-$arch.deb
|
||||
cd $current_dir
|
||||
else
|
||||
echo "skipping arch $arch"
|
||||
fi
|
||||
done
|
Loading…
Reference in a new issue