lidarr
This commit is contained in:
parent
91d2086ed6
commit
95279053a0
2 changed files with 105 additions and 0 deletions
1
all.sh
1
all.sh
|
@ -4,3 +4,4 @@
|
|||
./sonarr.sh $1
|
||||
./radarr.sh $1
|
||||
./readarr.sh $1
|
||||
./lidarr.sh $1
|
||||
|
|
104
lidarr.sh
Executable file
104
lidarr.sh
Executable file
|
@ -0,0 +1,104 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
json=$(curl -Ls https://api.github.com/repos/Lidarr/Lidarr/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 Lidarr v$name"
|
||||
|
||||
control_file="Section: sound
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.2
|
||||
Maintainer: alex
|
||||
Depends: chromaprint
|
||||
Package: lidarr
|
||||
Version: $name
|
||||
Architecture: REPLACE_ARCHITECTURE
|
||||
Description: lidarr"
|
||||
|
||||
package_info="PackageAuthor=alex
|
||||
UpdateMethod=External
|
||||
UpdateMethodMessage=rebuild apt packages
|
||||
Branch=master"
|
||||
|
||||
service_file="# Be sure to use \`systemctl edit lidarr\` 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=Lidarr Service
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
User=lidarr
|
||||
Group=lidarr
|
||||
SyslogIdentifier=lidarr
|
||||
ExecStart=/usr/lib/lidarr/bin/Lidarr -nobrowser -data=/var/lib/lidarr
|
||||
Type=simple
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target"
|
||||
|
||||
sysusers_file="u lidarr - \"Lidarr daemon\" /var/lib/lidarr"
|
||||
|
||||
tmpfiles_file="# Override this file with a modified version in /etc/tmpfiles.d/
|
||||
d /var/lib/lidarr 0755 lidarr lidarr
|
||||
Z /var/lib/lidarr - lidarr lidarr
|
||||
Z /usr/lib/lidarr - lidarr lidarr
|
||||
L /var/log/lidarr - - - - /var/lib/lidarr/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/lidarr
|
||||
cd $dir/lidarr
|
||||
mkdir -p usr/lib/sysusers.d
|
||||
echo $sysusers_file >usr/lib/sysusers.d/lidarr.conf
|
||||
mkdir -p usr/lib/systemd/system
|
||||
echo $service_file >usr/lib/systemd/system/lidarr.service
|
||||
mkdir -p usr/lib/tmpfiles.d
|
||||
echo $tmpfiles_file >usr/lib/tmpfiles.d/lidarr.conf
|
||||
mkdir -p usr/lib/lidarr
|
||||
echo "$package_info\nPackageVersion=$name" >usr/lib/lidarr/package_info
|
||||
curl -Ls $url | tar xz
|
||||
rm -rf Lidarr/Lidarr.Update
|
||||
rm -rf Lidarr/fpcalc
|
||||
mv Lidarr usr/lib/lidarr/bin
|
||||
chmod -R a=,a+rX,u+w usr/lib/lidarr/bin
|
||||
chmod +x usr/lib/lidarr/bin/Lidarr
|
||||
mkdir -p DEBIAN
|
||||
echo $control_file | sed -E "s/REPLACE_ARCHITECTURE/$arch/g" >DEBIAN/control
|
||||
cd $dir
|
||||
dpkg-deb --build lidarr
|
||||
mkdir -p $current_dir/build/lidarr
|
||||
cp lidarr.deb $current_dir/build/lidarr/lidarr-$name-$arch.deb
|
||||
cd $current_dir
|
||||
rm -rf $dir
|
||||
else
|
||||
echo "Skipping arch $arch"
|
||||
fi
|
||||
done
|
Loading…
Add table
Reference in a new issue