single script with configs
This commit is contained in:
parent
5b5bf0d669
commit
c95fa32fe5
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +1,2 @@
|
|||
build/
|
||||
debs/
|
||||
apikeys.sh
|
||||
|
|
16
Makefile
16
Makefile
|
@ -1,16 +1,14 @@
|
|||
ARCHITECTURES=arm64 armhf amd64
|
||||
TARGETS=lidarr prowlarr radarr readarr sonarr
|
||||
|
||||
.PHONY: default
|
||||
default: $(shell dpkg --print-architecture)
|
||||
default: ARCHITECTURES=$(shell dpkg --print-architecture)
|
||||
default: all
|
||||
|
||||
.PHONY: $(ARCHITECTURES)
|
||||
$(ARCHITECTURES):
|
||||
./lidarr.sh $@
|
||||
./prowlarr.sh $@
|
||||
./radarr.sh $@
|
||||
./readarr.sh $@
|
||||
./sonarr.sh $@
|
||||
.PHONY: all
|
||||
all:
|
||||
for target in $(TARGETS); do ./build.sh $$target $(ARCHITECTURES); done
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf build
|
||||
rm -rf debs
|
139
build.sh
Executable file
139
build.sh
Executable file
|
@ -0,0 +1,139 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
SCRIPT_PATH="${0:A:h}"
|
||||
source $SCRIPT_PATH/apikeys.sh
|
||||
|
||||
if (( $+commands[gsed] )); then
|
||||
alias sed=gsed
|
||||
fi
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "please give me target and architecture(s) plss..."
|
||||
exit
|
||||
fi
|
||||
|
||||
target=${1:l}
|
||||
shift
|
||||
NAME_CAPS=${(C)target}
|
||||
config_path=$SCRIPT_PATH/config/$target.config.sh
|
||||
if [ ! -f $config_path ]; then
|
||||
echo "Config for $NAME_CAPS not found:"
|
||||
echo "Expected config at $config_path"
|
||||
exit 1
|
||||
fi
|
||||
source $config_path
|
||||
export VERSION=$(jq -r '.name' <<<$JSON)
|
||||
echo "Building $NAME_CAPS v$VERSION for architectures: $@"
|
||||
|
||||
control_file="Section: $SECTION
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.2
|
||||
Maintainer: alex
|
||||
Depends: $DEPENDS
|
||||
Package: $target
|
||||
Version: $VERSION
|
||||
Architecture: REPLACE_ARCHITECTURE
|
||||
Description: $target"
|
||||
|
||||
package_info="PackageAuthor=alex
|
||||
UpdateMethod=External
|
||||
UpdateMethodMessage=rebuild apt packages
|
||||
Branch=$BRANCH"
|
||||
|
||||
service_file="# Be sure to use \`systemctl edit $target\` to modify this service with an override.conf because
|
||||
# direct changes will be overwritten by package updates.
|
||||
|
||||
[Unit]
|
||||
Description=$NAME_CAPS Service
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
User=$target
|
||||
Group=$target
|
||||
SyslogIdentifier=$target
|
||||
ExecStart=/usr/lib/$target/bin/$NAME_CAPS -nobrowser -data=/var/lib/$target
|
||||
Type=simple
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target"
|
||||
|
||||
sysusers_file="u $target - \"$target daemon\" /var/lib/$target"
|
||||
|
||||
tmpfiles_file="# Override this file with a modified version in /etc/tmpfiles.d/
|
||||
d /var/lib/$target 0755 $target $target
|
||||
Z /var/lib/$target - $target $target
|
||||
Z /usr/lib/$target - $target $target
|
||||
L /var/log/$target - - - - /var/lib/$target/logs/"
|
||||
|
||||
postinst_file="#!/bin/sh
|
||||
|
||||
SERVER_GROUP=$target
|
||||
|
||||
if ! getent group | grep -q \"^$target:\" ; then
|
||||
echo -n \"Adding group $target..\"
|
||||
addgroup --quiet --system $target 2>/dev/null ||true
|
||||
echo \"..done\"
|
||||
fi
|
||||
|
||||
adduser $target \
|
||||
--system \
|
||||
--home /var/lib/$target \
|
||||
--ingroup $target \
|
||||
--disabled-password"
|
||||
|
||||
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 (( $@[(Ie)$arch])); then
|
||||
echo "Building for $arch..."
|
||||
dir=$(mktemp -d)
|
||||
pkgdir=$dir/$target
|
||||
|
||||
mkdir -p $pkgdir/usr/lib/systemd/system
|
||||
echo $service_file > $pkgdir/usr/lib/systemd/system/$target.service
|
||||
|
||||
mkdir -p $pkgdir/usr/lib/tmpfiles.d
|
||||
echo $tmpfiles_file > $pkgdir/usr/lib/tmpfiles.d/$target.conf
|
||||
|
||||
mkdir -p $pkgdir/usr/lib/$target
|
||||
echo "$package_info\nPackageVersion=$VERSION" >$pkgdir/usr/lib/$target/package_info
|
||||
|
||||
curl -Ls $url | tar xz -C $pkgdir/
|
||||
rm -rf $pkgdir/$NAME_CAPS/$NAME_CAPS.Update
|
||||
mv $pkgdir/$NAME_CAPS $pkgdir/usr/lib/$target/bin
|
||||
chmod -R a=,a+rX,u+w $pkgdir/usr/lib/$target/bin
|
||||
chmod +x $pkgdir/usr/lib/$target/bin/$NAME_CAPS
|
||||
|
||||
mkdir -p $pkgdir/DEBIAN
|
||||
echo $control_file | sed -E "s/REPLACE_ARCHITECTURE/$arch/g" > $pkgdir/DEBIAN/control
|
||||
echo $sysusers_file > $pkgdir/DEBIAN/sysusers
|
||||
chmod +x $pkgdir/DEBIAN/postinst
|
||||
|
||||
cd $dir
|
||||
dpkg-deb --build $target
|
||||
mkdir -p $SCRIPT_PATH/debs
|
||||
deb_file=$SCRIPT_PATH/debs/$target-$VERSION-$arch.deb
|
||||
rm -f $deb_file
|
||||
cp $target.deb $deb_file
|
||||
rm -rf $dir
|
||||
else
|
||||
echo "Skipping arch $arch"
|
||||
fi
|
||||
done
|
8
config/lidarr.config.sh
Executable file
8
config/lidarr.config.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
source ./apikeys.sh
|
||||
|
||||
export SECTION=sound
|
||||
export JSON=$(curl -Ls https://api.github.com/repos/Lidarr/Lidarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28")
|
||||
export BRANCH=master
|
||||
export DEPENDS="curl, mediainfo, sqlite3, libchromaprint-tools"
|
8
config/prowlarr.config.sh
Executable file
8
config/prowlarr.config.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
source ./apikeys.sh
|
||||
|
||||
export SECTION=web
|
||||
export JSON=$(curl -Ls https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28")
|
||||
export BRANCH=master
|
||||
export DEPENDS="curl, sqlite3"
|
8
config/radarr.config.sh
Executable file
8
config/radarr.config.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
source ./apikeys.sh
|
||||
|
||||
export SECTION=video
|
||||
export JSON=$(curl -Ls https://api.github.com/repos/Radarr/Radarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28")
|
||||
export BRANCH=master
|
||||
export DEPENDS="curl, sqlite3"
|
8
config/readarr.config.sh
Executable file
8
config/readarr.config.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
source ./apikeys.sh
|
||||
|
||||
export SECTION=misc
|
||||
export JSON=$(curl -Ls https://api.github.com/repos/Readarr/Readarr/releases --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28" | jq 'map(select(.prerelease)) | first')
|
||||
export BRANCH=develop
|
||||
export DEPENDS="curl, sqlite3"
|
8
config/sonarr.config.sh
Executable file
8
config/sonarr.config.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
source ./apikeys.sh
|
||||
|
||||
export SECTION=video
|
||||
export JSON=$(curl -Ls https://api.github.com/repos/Sonarr/Sonarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28")
|
||||
export BRANCH=master
|
||||
export DEPENDS="curl, sqlite3"
|
106
lidarr.sh
106
lidarr.sh
|
@ -1,106 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
source ./apikeys.sh
|
||||
|
||||
json=$(curl -Ls https://api.github.com/repos/Lidarr/Lidarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --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: curl, mediainfo, sqlite3, libchromaprint-tools
|
||||
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 [ $# -eq 0 ] || (( $@[(Ie)$arch])); 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/$arch
|
||||
cp lidarr.deb $current_dir/build/$arch/lidarr-$name-$arch.deb
|
||||
cd $current_dir
|
||||
rm -rf $dir
|
||||
else
|
||||
echo "Skipping arch $arch"
|
||||
fi
|
||||
done
|
99
prowlarr.sh
99
prowlarr.sh
|
@ -1,99 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
source ./apikeys.sh
|
||||
|
||||
json=$(curl -Ls https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --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
|
||||
Depends: curl, sqlite3
|
||||
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]#/}"
|
||||
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 [ $# -eq 0 ] || (( $@[(Ie)$arch])); then
|
||||
echo "Building for $arch..."
|
||||
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 -R a=,a+rX,u+w 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/$arch
|
||||
cp prowlarr.deb $current_dir/build/$arch/prowlarr-$name-$arch.deb
|
||||
cd $current_dir
|
||||
rm -rf $dir
|
||||
else
|
||||
echo "Skipping arch $arch"
|
||||
fi
|
||||
done
|
104
radarr.sh
104
radarr.sh
|
@ -1,104 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
source ./apikeys.sh
|
||||
|
||||
json=$(curl -Ls https://api.github.com/repos/Radarr/Radarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28")
|
||||
|
||||
name=$(jq '.name' <<<$json | tr -d '"')
|
||||
echo "Building Radarr v$name"
|
||||
|
||||
control_file="Section: video
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.2
|
||||
Maintainer: alex
|
||||
Depends: curl, sqlite3
|
||||
Package: radarr
|
||||
Version: $name
|
||||
Architecture: REPLACE_ARCHITECTURE
|
||||
Description: radarr"
|
||||
|
||||
package_info="PackageAuthor=alex
|
||||
UpdateMethod=External
|
||||
UpdateMethodMessage=rebuild apt packages
|
||||
Branch=master"
|
||||
|
||||
service_file="# Be sure to use \`systemctl edit radarr\` 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=Radarr Service
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
User=radarr
|
||||
Group=radarr
|
||||
SyslogIdentifier=radarr
|
||||
ExecStart=/usr/lib/radarr/bin/Radarr -nobrowser -data=/var/lib/radarr
|
||||
Type=simple
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target"
|
||||
|
||||
sysusers_file="u radarr - \"Radarr daemon\" /var/lib/radarr"
|
||||
|
||||
tmpfiles_file="# Override this file with a modified version in /etc/tmpfiles.d/
|
||||
d /var/lib/radarr 0755 radarr radarr
|
||||
Z /var/lib/radarr - radarr radarr
|
||||
L /var/log/radarr - - - - /var/lib/radarr/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 [ $# -eq 0 ] || (( $@[(Ie)$arch])); then
|
||||
echo "Building for $arch..."
|
||||
dir=$(mktemp -d)
|
||||
current_dir=$PWD
|
||||
mkdir -p $dir/radarr
|
||||
cd $dir/radarr
|
||||
mkdir -p usr/lib/sysusers.d
|
||||
echo $sysusers_file >usr/lib/sysusers.d/radarr.conf
|
||||
mkdir -p usr/lib/systemd/system
|
||||
echo $service_file >usr/lib/systemd/system/radarr.service
|
||||
mkdir -p usr/lib/tmpfiles.d
|
||||
echo $tmpfiles_file >usr/lib/tmpfiles.d/radarr.conf
|
||||
mkdir -p usr/lib/radarr
|
||||
echo "$package_info\nPackageVersion=$name" >usr/lib/radarr/package_info
|
||||
curl -Ls $url | tar xz
|
||||
rm -rf Radarr/Radarr.Update
|
||||
mv Radarr usr/lib/radarr/bin
|
||||
chmod -R a=,a+rX,u+w usr/lib/radarr/bin
|
||||
chmod +x usr/lib/radarr/bin/Radarr usr/lib/radarr/bin/ffprobe
|
||||
mkdir -p DEBIAN
|
||||
echo $control_file | sed -E "s/REPLACE_ARCHITECTURE/$arch/g" >DEBIAN/control
|
||||
cd $dir
|
||||
dpkg-deb --build radarr
|
||||
mkdir -p $current_dir/build/$arch
|
||||
cp radarr.deb $current_dir/build/$arch/radarr-$name-$arch.deb
|
||||
cd $current_dir
|
||||
rm -rf $dir
|
||||
else
|
||||
echo "Skipping arch $arch"
|
||||
fi
|
||||
done
|
104
readarr.sh
104
readarr.sh
|
@ -1,104 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
source ./apikeys.sh
|
||||
|
||||
json=$(curl -Ls https://api.github.com/repos/Readarr/Readarr/releases --header "Authorization: Bearer $GITHUB_API_KEY" --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
|
||||
Depends: curl, sqlite3
|
||||
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 [ $# -eq 0 ] || (( $@[(Ie)$arch])); 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/$arch
|
||||
cp readarr.deb $current_dir/build/$arch/readarr-$name-$arch.deb
|
||||
cd $current_dir
|
||||
rm -rf $dir
|
||||
else
|
||||
echo "Skipping arch $arch"
|
||||
fi
|
||||
done
|
100
sonarr.sh
100
sonarr.sh
|
@ -1,100 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
source ./apikeys.sh
|
||||
|
||||
json=$(curl -Ls https://api.github.com/repos/Sonarr/Sonarr/releases/latest --header "Authorization: Bearer $GITHUB_API_KEY" --header "X-GitHub-Api-Version: 2022-11-28")
|
||||
|
||||
name=$(jq '.name' <<<$json | tr -d '"')
|
||||
echo "Building Sonarr v$name"
|
||||
|
||||
control_file="Section: video
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.2
|
||||
Maintainer: alex
|
||||
Depends: curl, sqlite3
|
||||
Package: sonarr
|
||||
Version: $name
|
||||
Architecture: REPLACE_ARCHITECTURE
|
||||
Description: sonarr"
|
||||
|
||||
package_info="PackageAuthor=alex
|
||||
UpdateMethod=External
|
||||
UpdateMethodMessage=rebuild apt packages
|
||||
Branch=main"
|
||||
|
||||
service_file="# Be sure to use \`systemctl edit sonarr\` 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=Sonarr Service
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=sonarr
|
||||
Group=sonarr
|
||||
SyslogIdentifier=sonarr
|
||||
ExecStart=/usr/lib/sonarr/bin/Sonarr -nobrowser -data=/var/lib/sonarr
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target"
|
||||
|
||||
sysusers_file="u sonarr - - /var/lib/sonarr
|
||||
g sonarr -"
|
||||
|
||||
tmpfiles_file="# Override this file with a modified version in /etc/tmpfiles.d/
|
||||
d /var/lib/sonarr 0755 sonarr sonarr
|
||||
Z /var/lib/sonarr - sonarr sonarr
|
||||
L /var/log/sonarr - - - - /var/lib/sonarr/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" ]]; then
|
||||
arch="amd64"
|
||||
fi
|
||||
if [[ "$arch" == "arm" ]]; then
|
||||
arch="armhf"
|
||||
fi
|
||||
if [ $# -eq 0 ] || (( $@[(Ie)$arch])); then
|
||||
echo "Building for $arch..."
|
||||
dir=$(mktemp -d)
|
||||
current_dir=$PWD
|
||||
mkdir -p $dir/sonarr
|
||||
cd $dir/sonarr
|
||||
mkdir -p usr/lib/sysusers.d
|
||||
echo $sysusers_file >usr/lib/sysusers.d/sonarr.conf
|
||||
mkdir -p usr/lib/systemd/system
|
||||
echo $service_file >usr/lib/systemd/system/sonarr.service
|
||||
mkdir -p usr/lib/tmpfiles.d
|
||||
echo $tmpfiles_file >usr/lib/tmpfiles.d/sonarr.conf
|
||||
mkdir -p usr/lib/sonarr
|
||||
echo "$package_info\nPackageVersion=$name" >usr/lib/sonarr/package_info
|
||||
curl -Ls $url | tar xz
|
||||
rm -rf Sonarr/Sonarr.Update
|
||||
mv Sonarr usr/lib/sonarr/bin
|
||||
chmod -R a=,a+rX,u+w usr/lib/sonarr/bin
|
||||
chmod +x usr/lib/sonarr/bin/Sonarr
|
||||
mkdir -p DEBIAN
|
||||
echo $control_file | sed -E "s/REPLACE_ARCHITECTURE/$arch/g" >DEBIAN/control
|
||||
cd $dir
|
||||
dpkg-deb --build sonarr
|
||||
mkdir -p $current_dir/build/$arch
|
||||
cp sonarr.deb $current_dir/build/$arch/sonarr-$name-$arch.deb
|
||||
cd $current_dir
|
||||
rm -rf $dir
|
||||
else
|
||||
echo "Skipping arch $arch"
|
||||
fi
|
||||
done
|
Loading…
Reference in a new issue