add readarr
This commit is contained in:
parent
0ff6c9beae
commit
04f8e78a02
1
all.sh
1
all.sh
|
@ -3,3 +3,4 @@
|
||||||
./prowlarr.sh $1
|
./prowlarr.sh $1
|
||||||
./sonarr.sh $1
|
./sonarr.sh $1
|
||||||
./radarr.sh $1
|
./radarr.sh $1
|
||||||
|
./readarr.sh $1
|
||||||
|
|
101
readarr.sh
Executable file
101
readarr.sh
Executable file
|
@ -0,0 +1,101 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
json=$(curl -Ls https://api.github.com/repos/Readarr/Readarr/releases --header "Authorization: Bearer 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" --header "X-GitHub-Api-Version: 2022-11-28" | jq 'map(select(.prerelease)) | first')
|
||||||
|
|
||||||
|
name=$(jq '.name' <<<$json | tr -d '"')
|
||||||
|
echo "Building Readarr v$name"
|
||||||
|
|
||||||
|
control_file="Section: misc
|
||||||
|
Priority: optional
|
||||||
|
Standards-Version: 3.9.2
|
||||||
|
Maintainer: alex
|
||||||
|
Package: readarr
|
||||||
|
Version: $name
|
||||||
|
Architecture: REPLACE_ARCHITECTURE
|
||||||
|
Description: readarr"
|
||||||
|
|
||||||
|
package_info="PackageAuthor=alex
|
||||||
|
UpdateMethod=External
|
||||||
|
UpdateMethodMessage=rebuild apt packages
|
||||||
|
Branch=develop"
|
||||||
|
|
||||||
|
service_file="# Be sure to use \$(systemctl edit readarr) to modify this service with an override.conf because
|
||||||
|
# direct changes will be overwritten by package updates.
|
||||||
|
#
|
||||||
|
# A user per service w/ shared group setup would have an override like:
|
||||||
|
# [Service]
|
||||||
|
# Group=sharedgroupname
|
||||||
|
# UMask=002
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Readarr Service
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=readarr
|
||||||
|
Group=readarr
|
||||||
|
SyslogIdentifier=readarr
|
||||||
|
ExecStart=/usr/lib/readarr/bin/Readarr -nobrowser -data=/var/lib/readarr
|
||||||
|
Type=simple
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target"
|
||||||
|
|
||||||
|
sysusers_file="u readarr - "Readarr daemon" /var/lib/readarr"
|
||||||
|
|
||||||
|
tmpfiles_file="# Override this file with a modified version in /etc/tmpfiles.d/
|
||||||
|
d /var/lib/readarr 0755 readarr readarr
|
||||||
|
Z /var/lib/readarr - readarr readarr
|
||||||
|
L /var/log/readarr - - - - /var/lib/readarr/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]#/}"
|
||||||
|
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
|
||||||
|
if [ -z "$1" ] || [[ "$arch" == "$1" ]]; then
|
||||||
|
echo "Building for $arch..."
|
||||||
|
dir=$(mktemp -d)
|
||||||
|
current_dir=$PWD
|
||||||
|
mkdir -p $dir/readarr
|
||||||
|
cd $dir/readarr
|
||||||
|
mkdir -p usr/lib/sysusers.d
|
||||||
|
echo $sysusers_file >usr/lib/sysusers.d/readarr.conf
|
||||||
|
mkdir -p usr/lib/systemd/system
|
||||||
|
echo $service_file >usr/lib/systemd/system/readarr.service
|
||||||
|
mkdir -p usr/lib/tmpfiles.d
|
||||||
|
echo $tmpfiles_file >usr/lib/tmpfiles.d/readarr.conf
|
||||||
|
mkdir -p usr/lib/readarr
|
||||||
|
echo "$package_info\nPackageVersion=$name" >usr/lib/readarr/package_info
|
||||||
|
curl -Ls $url | tar xz
|
||||||
|
rm -rf Readarr/Readarr.Update
|
||||||
|
mv Readarr usr/lib/readarr/bin
|
||||||
|
chmod -R a=,a+rX,u+w usr/lib/readarr/bin
|
||||||
|
chmod +x usr/lib/readarr/bin/Readarr
|
||||||
|
mkdir -p DEBIAN
|
||||||
|
echo $control_file | sed -E "s/REPLACE_ARCHITECTURE/$arch/g" >DEBIAN/control
|
||||||
|
cd $dir
|
||||||
|
dpkg-deb --build readarr
|
||||||
|
mkdir -p $current_dir/build/readarr
|
||||||
|
cp readarr.deb $current_dir/build/readarr/readarr-$name-$arch.deb
|
||||||
|
cd $current_dir
|
||||||
|
rm -rf $dir
|
||||||
|
else
|
||||||
|
echo "Skipping arch $arch"
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Reference in a new issue