Make arr scripts idempotent
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -0,0 +1,140 @@
|
|||||||
|
# shellcheck shell=sh
|
||||||
|
|
||||||
|
try_forever() {
|
||||||
|
until "$@" 2>&1; do
|
||||||
|
echo "Try failed: $* - retrying in 1s"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
try() {
|
||||||
|
attempts="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
delay=1
|
||||||
|
count=1
|
||||||
|
|
||||||
|
while [ "$count" -le "$attempts" ]; do
|
||||||
|
if "$@" 2>&1; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$count" -lt "$attempts" ]; then
|
||||||
|
echo "Attempt $count/$attempts failed, retrying in ${delay}s..."
|
||||||
|
sleep "$delay"
|
||||||
|
delay="$(( delay * 2 ))"
|
||||||
|
fi
|
||||||
|
|
||||||
|
count="$(( count + 1 ))"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "All $attempts attempts failed for: $*"
|
||||||
|
}
|
||||||
|
|
||||||
|
wait_for_api() {
|
||||||
|
try_forever curl -sf -H "X-Api-Key: $API_KEY" "$HOST$API_SUBPATH/health"
|
||||||
|
echo "API is up!"
|
||||||
|
}
|
||||||
|
|
||||||
|
call() {
|
||||||
|
method="$1"
|
||||||
|
path="$2"
|
||||||
|
data="${3:-}"
|
||||||
|
|
||||||
|
if [ -n "$data" ]; then
|
||||||
|
curl -sf \
|
||||||
|
-X "$method" \
|
||||||
|
-H "X-Api-Key: $API_KEY" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
--data-raw "$data" \
|
||||||
|
"$HOST$API_SUBPATH/$path"
|
||||||
|
else
|
||||||
|
curl -sf \
|
||||||
|
-X "$method" \
|
||||||
|
-H "X-Api-Key: $API_KEY" \
|
||||||
|
"$HOST$API_SUBPATH/$path"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_resources() {
|
||||||
|
call GET "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_resource_id() {
|
||||||
|
endpoint="$1"
|
||||||
|
ident_field="$2"
|
||||||
|
name="$3"
|
||||||
|
|
||||||
|
get_resources "$endpoint" | jq -r --arg field "$ident_field" --arg name "$name" '.[] | select(.[$field] == $name) | .id // empty'
|
||||||
|
}
|
||||||
|
|
||||||
|
insert_or_skip_resource() {
|
||||||
|
endpoint="$1"
|
||||||
|
ident_field="$2"
|
||||||
|
name="$3"
|
||||||
|
json="$4"
|
||||||
|
|
||||||
|
all="$(get_resources "$endpoint")"
|
||||||
|
id="$(printf '%s' "$all" | jq -r --arg field "$ident_field" --arg name "$name" '.[] | select(.[$field]==$name) | .id')"
|
||||||
|
|
||||||
|
if [ -n "$id" ] && [ "$id" != "null" ]; then
|
||||||
|
echo "Skipping existing $endpoint '$name' (id=$id)"
|
||||||
|
else
|
||||||
|
echo "Creating $endpoint '$name'"
|
||||||
|
call POST "$endpoint?forceSave=true" "$json"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
upsert_resource() {
|
||||||
|
endpoint="$1"
|
||||||
|
ident_field="$2"
|
||||||
|
name="$3"
|
||||||
|
json="$4"
|
||||||
|
|
||||||
|
all="$(get_resources "$endpoint")"
|
||||||
|
id="$(printf '%s' "$all" | jq -r --arg field "$ident_field" --arg name "$name" '.[] | select(.[$field]==$name) | .id')"
|
||||||
|
|
||||||
|
if [ -n "$id" ] && [ "$id" != "null" ]; then
|
||||||
|
echo "Updating $endpoint '$name' (id=$id)"
|
||||||
|
call PUT "$endpoint/$id?forceSave=true" "$json"
|
||||||
|
else
|
||||||
|
echo "Creating $endpoint '$name'"
|
||||||
|
call POST "$endpoint?forceSave=true" "$json"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
prune_resources() {
|
||||||
|
endpoint="$1"
|
||||||
|
ident_field="$2"
|
||||||
|
|
||||||
|
shift 2
|
||||||
|
|
||||||
|
keep_list="$(printf '%s\n' "$@" | jq -R . | jq -s .)"
|
||||||
|
resources="$(get_resources "$endpoint")"
|
||||||
|
|
||||||
|
printf '%s' "$resources" | jq -c '.[]' | while IFS= read -r client; do
|
||||||
|
name="$(printf '%s' "$client" | jq -r --arg field "$ident_field" '.[$field]')"
|
||||||
|
id="$(printf '%s' "$client" | jq -r '.id')"
|
||||||
|
found="$(printf '%s' "$keep_list" | jq -r --arg name "$name" 'index($name)')"
|
||||||
|
|
||||||
|
if [ "$found" = "null" ]; then
|
||||||
|
echo "Deleting extra $endpoint '$name' (id=$id)"
|
||||||
|
call DELETE "$endpoint/$id" || echo "failed to delete $name, continuing"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
delete_resource() {
|
||||||
|
endpoint="$1"
|
||||||
|
ident_field="$2"
|
||||||
|
name="$3"
|
||||||
|
|
||||||
|
id="$(get_resource_id "$endpoint" "$ident_field" "$name")"
|
||||||
|
|
||||||
|
if [ -n "$id" ]; then
|
||||||
|
echo "Deleting $endpoint '$name' (id=$id)"
|
||||||
|
call DELETE "$endpoint/$id" || echo "Failed to delete $name, continuing"
|
||||||
|
else
|
||||||
|
echo "No $endpoint resource named '$name' found - skipping"
|
||||||
|
fi
|
||||||
|
}
|
@@ -11,61 +11,30 @@ let
|
|||||||
hmConfig = config.home-manager.users.${user};
|
hmConfig = config.home-manager.users.${user};
|
||||||
inherit (hmConfig.virtualisation.quadlet) containers volumes networks;
|
inherit (hmConfig.virtualisation.quadlet) containers volumes networks;
|
||||||
|
|
||||||
mkApp = type: name: shortName: urlBase: mediaFolderBase: {
|
mkApp = type: name: shortName: urlBase: port: mediaFolderBase: {
|
||||||
inherit
|
inherit
|
||||||
type
|
type
|
||||||
name
|
name
|
||||||
shortName
|
shortName
|
||||||
urlBase
|
urlBase
|
||||||
|
port
|
||||||
mediaFolderBase
|
mediaFolderBase
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
arrs = [
|
arrs = [
|
||||||
(mkApp "radarr" "Radarr" "radarr" "/manage/films" "/films")
|
(mkApp "radarr" "Radarr" "radarr" "/manage/films" 7878 "/films")
|
||||||
(mkApp "radarr" "Radarr (UHD)" "radarr-uhd" "/manage/films/uhd" "/films")
|
(mkApp "radarr" "Radarr (UHD)" "radarr-uhd" "/manage/films/uhd" 7878 "/films")
|
||||||
(mkApp "radarr" "Radarr (Anime)" "radarr-anime" "/manage/anime/films" "/anime/films")
|
(mkApp "radarr" "Radarr (Anime)" "radarr-anime" "/manage/anime/films" 7878 "/anime/films")
|
||||||
(mkApp "sonarr" "Sonarr" "sonarr" "/manage/shows" "/shows")
|
(mkApp "sonarr" "Sonarr" "sonarr" "/manage/shows" 8989 "/shows")
|
||||||
(mkApp "sonarr" "Sonarr (UHD)" "sonarr-uhd" "/manage/shows/uhd" "/shows")
|
(mkApp "sonarr" "Sonarr (UHD)" "sonarr-uhd" "/manage/shows/uhd" 8989 "/shows")
|
||||||
(mkApp "sonarr" "Sonarr (Anime)" "sonarr-anime" "/manage/anime/shows" "/anime/shows")
|
(mkApp "sonarr" "Sonarr (Anime)" "sonarr-anime" "/manage/anime/shows" 8989 "/anime/shows")
|
||||||
];
|
];
|
||||||
|
|
||||||
arrMapping = {
|
|
||||||
radarr = {
|
|
||||||
port = 7878;
|
|
||||||
prowlarr = {
|
|
||||||
implementation = "Radarr";
|
|
||||||
configContract = "RadarrSettings";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
sonarr = {
|
|
||||||
port = 8989;
|
|
||||||
prowlarr = {
|
|
||||||
implementation = "Sonarr";
|
|
||||||
configContract = "SonarrSettings";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
(import ./prowlarr {
|
(import ./prowlarr { inherit user home arrs; })
|
||||||
inherit
|
(import ./recyclarr { inherit user home arrs; })
|
||||||
user
|
|
||||||
home
|
|
||||||
arrs
|
|
||||||
arrMapping
|
|
||||||
;
|
|
||||||
})
|
|
||||||
(import ./recyclarr {
|
|
||||||
inherit
|
|
||||||
user
|
|
||||||
home
|
|
||||||
arrs
|
|
||||||
arrMapping
|
|
||||||
;
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
|
|
||||||
home-manager.users.${user} = {
|
home-manager.users.${user} = {
|
||||||
@@ -108,14 +77,17 @@ in
|
|||||||
];
|
];
|
||||||
volumes =
|
volumes =
|
||||||
let
|
let
|
||||||
setup = pkgs.writeTextFile {
|
postStart = pkgs.writeTextFile {
|
||||||
name = "setup.sh";
|
name = "post-start.sh";
|
||||||
executable = true;
|
executable = true;
|
||||||
text = builtins.readFile ./${arr.type}/setup.sh;
|
text = ''
|
||||||
|
${builtins.readFile ./common.sh}
|
||||||
|
${builtins.readFile ./${arr.type}/post-start.sh}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
[
|
[
|
||||||
"${setup}:/etc/${arr.type}/setup.sh:ro"
|
"${postStart}:/etc/${arr.type}/post-start.sh:ro"
|
||||||
"${volumes.${arr.shortName}.ref}:/var/lib/${arr.type}"
|
"${volumes.${arr.shortName}.ref}:/var/lib/${arr.type}"
|
||||||
"/mnt/storage/private/storm/containers/storage/volumes/transmission-data/_data:/var/lib/transmission"
|
"/mnt/storage/private/storm/containers/storage/volumes/transmission-data/_data:/var/lib/transmission"
|
||||||
"/mnt/storage/private/storm/containers/storage/volumes/media/_data:/var/lib/media"
|
"/mnt/storage/private/storm/containers/storage/volumes/media/_data:/var/lib/media"
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
user,
|
user,
|
||||||
home,
|
home,
|
||||||
arrs,
|
arrs,
|
||||||
arrMapping,
|
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
@@ -15,6 +14,18 @@ let
|
|||||||
selfPkgs = inputs.self.packages.${system};
|
selfPkgs = inputs.self.packages.${system};
|
||||||
hmConfig = config.home-manager.users.${user};
|
hmConfig = config.home-manager.users.${user};
|
||||||
inherit (hmConfig.virtualisation.quadlet) containers volumes networks;
|
inherit (hmConfig.virtualisation.quadlet) containers volumes networks;
|
||||||
|
|
||||||
|
arrMapping = {
|
||||||
|
radarr = {
|
||||||
|
implementation = "Radarr";
|
||||||
|
configContract = "RadarrSettings";
|
||||||
|
};
|
||||||
|
|
||||||
|
sonarr = {
|
||||||
|
implementation = "Sonarr";
|
||||||
|
configContract = "SonarrSettings";
|
||||||
|
};
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
home-manager.users.${user} = {
|
home-manager.users.${user} = {
|
||||||
@@ -34,7 +45,7 @@ in
|
|||||||
(pkgs.formats.json { }).generate "${arr.shortName}.json" {
|
(pkgs.formats.json { }).generate "${arr.shortName}.json" {
|
||||||
enable = true;
|
enable = true;
|
||||||
name = arr.name;
|
name = arr.name;
|
||||||
inherit (arrMapping.${arr.type}.prowlarr) implementation configContract;
|
inherit (arrMapping.${arr.type}) implementation configContract;
|
||||||
syncLevel = "fullSync";
|
syncLevel = "fullSync";
|
||||||
fields = [
|
fields = [
|
||||||
{
|
{
|
||||||
@@ -43,7 +54,7 @@ in
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "baseUrl";
|
name = "baseUrl";
|
||||||
value = "http://${arr.shortName}:${builtins.toString arrMapping.${arr.type}.port}";
|
value = "http://${arr.shortName}:${builtins.toString arr.port}";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "apiKey";
|
name = "apiKey";
|
||||||
@@ -82,15 +93,17 @@ in
|
|||||||
];
|
];
|
||||||
volumes =
|
volumes =
|
||||||
let
|
let
|
||||||
setup = pkgs.writeTextFile {
|
postStart = pkgs.writeTextFile {
|
||||||
name = "setup.sh";
|
name = "post-start.sh";
|
||||||
executable = true;
|
executable = true;
|
||||||
text = builtins.readFile ./setup.sh;
|
text = ''
|
||||||
|
${builtins.readFile ../common.sh}
|
||||||
|
${builtins.readFile ./post-start.sh}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
[
|
[
|
||||||
"${setup}:/etc/prowlarr/setup.sh:ro"
|
"${postStart}:/etc/prowlarr/post-start.sh:ro"
|
||||||
"${./indexers}:/etc/prowlarr/indexers:ro"
|
|
||||||
"${volumes.prowlarr.ref}:/var/lib/prowlarr"
|
"${volumes.prowlarr.ref}:/var/lib/prowlarr"
|
||||||
]
|
]
|
||||||
++ builtins.map (
|
++ builtins.map (
|
||||||
|
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"enable": true,
|
|
||||||
"appProfileId": 1,
|
|
||||||
"priority": 25,
|
|
||||||
"name": "1337x",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "definitionFile",
|
|
||||||
"value": "1337x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "baseUrl",
|
|
||||||
"value": "https://1337x.to/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation": "Cardigann",
|
|
||||||
"configContract": "CardigannSettings",
|
|
||||||
"tags": [1]
|
|
||||||
}
|
|
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"enable": true,
|
|
||||||
"appProfileId": 1,
|
|
||||||
"priority": 25,
|
|
||||||
"name": "Internet Archive",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "definitionFile",
|
|
||||||
"value": "internetarchive"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "baseUrl",
|
|
||||||
"value": "https://archive.org/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation": "Cardigann",
|
|
||||||
"configContract": "CardigannSettings"
|
|
||||||
}
|
|
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"enable": true,
|
|
||||||
"appProfileId": 1,
|
|
||||||
"priority": 25,
|
|
||||||
"name": "LimeTorrents",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "definitionFile",
|
|
||||||
"value": "limetorrents"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "baseUrl",
|
|
||||||
"value": "https://www.limetorrents.lol/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation": "Cardigann",
|
|
||||||
"configContract": "CardigannSettings"
|
|
||||||
}
|
|
@@ -1,30 +0,0 @@
|
|||||||
{
|
|
||||||
"enable": true,
|
|
||||||
"appProfileId": 1,
|
|
||||||
"priority": 25,
|
|
||||||
"name": "Nyaa.si",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "definitionFile",
|
|
||||||
"value": "nyaasi"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "baseUrl",
|
|
||||||
"value": "https://nyaa.si/"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sonarr_compatibility",
|
|
||||||
"value": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "strip_s01",
|
|
||||||
"value": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "radarr_compatibility",
|
|
||||||
"value": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation": "Cardigann",
|
|
||||||
"configContract": "CardigannSettings"
|
|
||||||
}
|
|
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"enable": true,
|
|
||||||
"appProfileId": 1,
|
|
||||||
"priority": 25,
|
|
||||||
"name": "The Pirate Bay",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "definitionFile",
|
|
||||||
"value": "thepiratebay"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "baseUrl",
|
|
||||||
"value": "https://thepiratebay.org/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation": "Cardigann",
|
|
||||||
"configContract": "CardigannSettings"
|
|
||||||
}
|
|
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"enable": true,
|
|
||||||
"appProfileId": 1,
|
|
||||||
"priority": 25,
|
|
||||||
"name": "TheRARBG",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "definitionFile",
|
|
||||||
"value": "therarbg"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "baseUrl",
|
|
||||||
"value": "https://therarbg.to/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation": "Cardigann",
|
|
||||||
"configContract": "CardigannSettings"
|
|
||||||
}
|
|
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"enable": true,
|
|
||||||
"appProfileId": 1,
|
|
||||||
"priority": 25,
|
|
||||||
"name": "Torlock",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "definitionFile",
|
|
||||||
"value": "torlock"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "baseUrl",
|
|
||||||
"value": "https://www.torlock.com/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation": "Cardigann",
|
|
||||||
"configContract": "CardigannSettings"
|
|
||||||
}
|
|
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"enable": true,
|
|
||||||
"appProfileId": 1,
|
|
||||||
"priority": 25,
|
|
||||||
"name": "TorrentDownload",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "definitionFile",
|
|
||||||
"value": "torrentdownload"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "baseUrl",
|
|
||||||
"value": "https://www.torrentdownload.info/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation": "Cardigann",
|
|
||||||
"configContract": "CardigannSettings"
|
|
||||||
}
|
|
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"enable": true,
|
|
||||||
"appProfileId": 1,
|
|
||||||
"priority": 25,
|
|
||||||
"name": "Torrent Downloads",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "definitionFile",
|
|
||||||
"value": "torrentdownloads"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "baseUrl",
|
|
||||||
"value": "https://www.torrentdownloads.pro/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation": "Cardigann",
|
|
||||||
"configContract": "CardigannSettings"
|
|
||||||
}
|
|
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"enable": true,
|
|
||||||
"appProfileId": 1,
|
|
||||||
"priority": 25,
|
|
||||||
"name": "YourBittorrent",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "definitionFile",
|
|
||||||
"value": "yourbittorrent"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "baseUrl",
|
|
||||||
"value": "https://yourbittorrent.com/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation": "Cardigann",
|
|
||||||
"configContract": "CardigannSettings"
|
|
||||||
}
|
|
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"enable": true,
|
|
||||||
"appProfileId": 1,
|
|
||||||
"priority": 25,
|
|
||||||
"name": "kickasstorrents.to",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "definitionFile",
|
|
||||||
"value": "kickasstorrents-to"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "baseUrl",
|
|
||||||
"value": "https://kickass.torrentbay.st/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation": "Cardigann",
|
|
||||||
"configContract": "CardigannSettings",
|
|
||||||
"tags": [1]
|
|
||||||
}
|
|
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"enable": true,
|
|
||||||
"appProfileId": 1,
|
|
||||||
"priority": 25,
|
|
||||||
"name": "kickasstorrents.ws",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "definitionFile",
|
|
||||||
"value": "kickasstorrents-ws"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "baseUrl",
|
|
||||||
"value": "https://kickass.ws/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation": "Cardigann",
|
|
||||||
"configContract": "CardigannSettings"
|
|
||||||
}
|
|
@@ -0,0 +1,122 @@
|
|||||||
|
# shellcheck shell=sh
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
HOST="http://localhost:9696$URL_BASE"
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
API_SUBPATH="/api/v1"
|
||||||
|
|
||||||
|
build_transmission_payload() {
|
||||||
|
cat <<-EOF
|
||||||
|
{
|
||||||
|
"enable": true,
|
||||||
|
"protocol": "torrent",
|
||||||
|
"priority": 1,
|
||||||
|
"name": "Transmission",
|
||||||
|
"fields": [
|
||||||
|
{ "name": "host", "value": "transmission" },
|
||||||
|
{ "name": "port", "value": 9091 },
|
||||||
|
{ "name": "urlBase", "value": "" }
|
||||||
|
],
|
||||||
|
"categories": [],
|
||||||
|
"implementation": "Transmission",
|
||||||
|
"configContract": "TransmissionSettings"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
build_tag_payload() {
|
||||||
|
cat <<-EOF
|
||||||
|
{
|
||||||
|
"label": "flaresolverr"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
build_flaresolverr_payload() {
|
||||||
|
tag_id="$1"
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
{
|
||||||
|
"name": "FlareSolverr",
|
||||||
|
"fields": [
|
||||||
|
{ "name": "host", "value": "http://flaresolverr:8191/" },
|
||||||
|
{ "name": "requestTimeout", "value": 60 }
|
||||||
|
],
|
||||||
|
"implementation": "FlareSolverr",
|
||||||
|
"configContract": "FlareSolverrSettings",
|
||||||
|
"tags": [ $tag_id ]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
build_cardigann_indexer_payload() {
|
||||||
|
name="$1"
|
||||||
|
priority="$2"
|
||||||
|
definition_file="$3"
|
||||||
|
base_url="$4"
|
||||||
|
extra_fields_json="$5"
|
||||||
|
tags_json="$6"
|
||||||
|
|
||||||
|
jq -n \
|
||||||
|
--arg name "$name" \
|
||||||
|
--argjson priority "$priority" \
|
||||||
|
--arg definition_file "$definition_file" \
|
||||||
|
--arg base_url "$base_url" \
|
||||||
|
--argjson extra_fields "${extra_fields_json:-[]}" \
|
||||||
|
--argjson tags "${tags_json:-[]}" '
|
||||||
|
{
|
||||||
|
enable: true,
|
||||||
|
appProfileId: 1,
|
||||||
|
priority: $priority,
|
||||||
|
name: $name,
|
||||||
|
fields: (
|
||||||
|
[
|
||||||
|
{ name: "definitionFile", value: $definition_file },
|
||||||
|
{ name: "baseUrl", value: $base_url }
|
||||||
|
] + $extra_fields
|
||||||
|
),
|
||||||
|
implementation: "Cardigann",
|
||||||
|
configContract: "CardigannSettings"
|
||||||
|
} + (if ($tags | length) > 0 then { tags: $tags } else {} end)
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
|
wait_for_api
|
||||||
|
|
||||||
|
try_forever upsert_resource "downloadclient" "name" "Transmission" "$(build_transmission_payload)"
|
||||||
|
prune_resources "downloadclient" "name" "Transmission"
|
||||||
|
|
||||||
|
insert_or_skip_resource "tag" "label" "flaresolverr" "$(build_tag_payload)"
|
||||||
|
flaresolverr_id="$(get_resource_id "tag" "label" "flaresolverr")"
|
||||||
|
|
||||||
|
try_forever upsert_resource "indexerProxy" "name" "FlareSolverr" "$(build_flaresolverr_payload "$flaresolverr_id")"
|
||||||
|
prune_resources "indexerProxy" "name" "FlareSolverr"
|
||||||
|
|
||||||
|
app_names=""
|
||||||
|
|
||||||
|
for filepath in /etc/prowlarr/apps/*.json; do
|
||||||
|
name="$(jq -r '.name' < "$filepath")"
|
||||||
|
json="$(cat "$filepath")"
|
||||||
|
try_forever upsert_resource "applications" "name" "$name" "$json"
|
||||||
|
app_names="$app_names \"$name\""
|
||||||
|
done
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
eval "prune_resources \"applications\" \"name\" $app_names"
|
||||||
|
|
||||||
|
try 5 upsert_resource "indexer" "name" "1337x" "$(build_cardigann_indexer_payload "1337x" 25 "1337x" "https://1337x.to/" "" "[$flaresolverr_id]")"
|
||||||
|
try 5 upsert_resource "indexer" "name" "Internet Archive" "$(build_cardigann_indexer_payload "Internet Archive" 25 "internetarchive" "https://archive.org/")"
|
||||||
|
try 5 upsert_resource "indexer" "name" "kickasstorrents.to" "$(build_cardigann_indexer_payload "kickasstorrents.to" 25 "kickasstorrents-to" "https://kickass.torrentbay.st/" "" "[$flaresolverr_id]")"
|
||||||
|
try 5 upsert_resource "indexer" "name" "kickasstorrents.ws" "$(build_cardigann_indexer_payload "kickasstorrents.ws" 25 "kickasstorrents-ws" "https://kickass.ws/")"
|
||||||
|
try 5 upsert_resource "indexer" "name" "LimeTorrents" "$(build_cardigann_indexer_payload "LimeTorrents" 25 "limetorrents" "https://www.limetorrents.lol/")"
|
||||||
|
try 5 upsert_resource "indexer" "name" "Nyaa.si" "$(build_cardigann_indexer_payload "Nyaa.si" 25 "nyaasi" "https://nyaa.si/" '[{"name":"sonarr_compatibility","value":true},{"name":"strip_s01","value":true},{"name":"radarr_compatibility","value":true}]')"
|
||||||
|
try 5 upsert_resource "indexer" "name" "The Pirate Bay" "$(build_cardigann_indexer_payload "The Pirate Bay" 25 "thepiratebay" "https://thepiratebay.org/")"
|
||||||
|
try 5 upsert_resource "indexer" "name" "TheRARBG" "$(build_cardigann_indexer_payload "TheRARBG" 25 "therarbg" "https://therarbg.to/")"
|
||||||
|
try 5 upsert_resource "indexer" "name" "Torlock" "$(build_cardigann_indexer_payload "Torlock" 25 "torlock" "https://www.torlock.com/")"
|
||||||
|
try 5 upsert_resource "indexer" "name" "TorrentDownload" "$(build_cardigann_indexer_payload "TorrentDownload" 25 "torrentdownload" "https://www.torrentdownload.info/")"
|
||||||
|
try 5 upsert_resource "indexer" "name" "Torrent Downloads" "$(build_cardigann_indexer_payload "Torrent Downloads" 25 "torrentdownloads" "https://www.torrentdownloads.pro/")"
|
||||||
|
try 5 upsert_resource "indexer" "name" "YourBittorrent" "$(build_cardigann_indexer_payload "YourBittorrent" 25 "yourbittorrent" "https://yourbittorrent.com/")"
|
||||||
|
|
||||||
|
prune_resources "indexer" "name" "1337x" "Internet Archive" "kickasstorrents.to" "kickasstorrents.ws" "LimeTorrents" "Nyaa.si" "The Pirate Bay" "TheRARBG" "Torlock" "TorrentDownload" "Torrent Downloads" "YourBittorrent"
|
||||||
|
|
||||||
|
prune_resources "tag" "label" "flaresolverr"
|
@@ -1,81 +0,0 @@
|
|||||||
# shellcheck shell=sh
|
|
||||||
|
|
||||||
# Tag ID: 1
|
|
||||||
curl -sf "$HOST/api/v1/tag" \
|
|
||||||
-X POST \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-H "X-Api-Key: $API_KEY" \
|
|
||||||
--data-raw '{"label": "flaresolverr"}' || true
|
|
||||||
|
|
||||||
{
|
|
||||||
curl -sf --retry 5 "$HOST/api/v1/indexerProxy?forceSave=true" \
|
|
||||||
-X POST \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-H "X-Api-Key: $API_KEY" \
|
|
||||||
--data-binary @- <<EOF
|
|
||||||
{
|
|
||||||
"name": "FlareSolverr",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "host",
|
|
||||||
"value": "http://flaresolverr:8191/"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "requestTimeout",
|
|
||||||
"value": 60
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation": "FlareSolverr",
|
|
||||||
"configContract": "FlareSolverrSettings",
|
|
||||||
"tags": [ 1 ]
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
} || true
|
|
||||||
|
|
||||||
{
|
|
||||||
curl -sf --retry 5 "$HOST/api/v1/downloadclient?forceSave=true" \
|
|
||||||
-X POST \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-H "X-Api-Key: $API_KEY" \
|
|
||||||
--data-binary @- <<EOF
|
|
||||||
{
|
|
||||||
"enable": true,
|
|
||||||
"protocol": "torrent",
|
|
||||||
"priority": 1,
|
|
||||||
"name": "Transmission",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "host",
|
|
||||||
"value": "transmission"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "port",
|
|
||||||
"value": 9091
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "urlBase",
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"categories": [],
|
|
||||||
"implementation": "Transmission",
|
|
||||||
"configContract": "TransmissionSettings"
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
} || true
|
|
||||||
|
|
||||||
for filepath in /etc/prowlarr/apps/*.json; do
|
|
||||||
curl -sf --retry 5 "$HOST/api/v1/applications?forceSave=true" \
|
|
||||||
-X POST \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "X-Api-Key: $API_KEY" \
|
|
||||||
--data-binary @"$filepath" || true
|
|
||||||
done
|
|
||||||
|
|
||||||
for filepath in /etc/prowlarr/indexers/*.json; do
|
|
||||||
curl -sf --retry 10 "$HOST/api/v1/indexer?forceSave=true" \
|
|
||||||
-X POST \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "X-Api-Key: $API_KEY" \
|
|
||||||
--data-binary @"$filepath" || true
|
|
||||||
done
|
|
@@ -0,0 +1,58 @@
|
|||||||
|
# shellcheck shell=sh
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
HOST="http://localhost:7878$URL_BASE"
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
API_SUBPATH="/api/v3"
|
||||||
|
DOWNLOAD_CATEGORY="${DOWNLOAD_CATEGORY:-radarr}"
|
||||||
|
|
||||||
|
build_transmission_payload() {
|
||||||
|
cat <<-EOF
|
||||||
|
{
|
||||||
|
"enable": true,
|
||||||
|
"protocol": "torrent",
|
||||||
|
"priority": 1,
|
||||||
|
"name": "Transmission",
|
||||||
|
"fields": [
|
||||||
|
{ "name": "host", "value": "transmission" },
|
||||||
|
{ "name": "port", "value": 9091 },
|
||||||
|
{ "name": "urlBase", "value": "" },
|
||||||
|
{ "name": "movieCategory", "value": "$DOWNLOAD_CATEGORY" }
|
||||||
|
],
|
||||||
|
"implementation": "Transmission",
|
||||||
|
"configContract": "TransmissionSettings"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
build_rootfolder_payload() {
|
||||||
|
cat <<-EOF
|
||||||
|
{
|
||||||
|
"path": "$ROOT_FOLDER"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
wait_for_api
|
||||||
|
|
||||||
|
if [ -n "$ROOT_FOLDER" ]; then
|
||||||
|
insert_or_skip_resource "rootfolder" "path" "$ROOT_FOLDER" "$(build_rootfolder_payload)"
|
||||||
|
prune_resources "rootfolder" "path" "$ROOT_FOLDER"
|
||||||
|
fi
|
||||||
|
|
||||||
|
try_forever upsert_resource "downloadclient" "name" "Transmission" "$(build_transmission_payload)"
|
||||||
|
prune_resources "downloadclient" "name" "Transmission"
|
||||||
|
|
||||||
|
delete_resource "qualityprofile" "name" "SD"
|
||||||
|
delete_resource "qualityprofile" "name" "HD-720p"
|
||||||
|
delete_resource "qualityprofile" "name" "HD-1080p"
|
||||||
|
delete_resource "qualityprofile" "name" "HD - 720p/1080p"
|
||||||
|
delete_resource "qualityprofile" "name" "Ultra-HD"
|
||||||
|
|
||||||
|
try_forever sh -c "[ $(get_resources qualityprofile | jq length) -eq 2 ]"
|
||||||
|
get_resources qualityprofile | jq -c '.[]' | while IFS= read -r profile; do
|
||||||
|
id="$(printf '%s' "$profile" | jq -r '.id')"
|
||||||
|
patched="$(printf '%s' "$profile" | jq '.language.id = -2 | .language.Name = "Original"')"
|
||||||
|
echo "Patching qualityprofile id=$id with language = Original"
|
||||||
|
call PUT "qualityprofile/$id?forceSave=true" "$patched"
|
||||||
|
done
|
@@ -1,48 +0,0 @@
|
|||||||
# shellcheck shell=sh
|
|
||||||
|
|
||||||
DOWNLOAD_CATEGORY="${DOWNLOAD_CATEGORY:-radarr}"
|
|
||||||
|
|
||||||
mkdir -p "/var/lib/transmission/$DOWNLOAD_CATEGORY"
|
|
||||||
|
|
||||||
{
|
|
||||||
curl -sf --retry 5 "$HOST/api/v3/downloadclient?forceSave=true" \
|
|
||||||
-X POST \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-H "X-Api-Key: $API_KEY" \
|
|
||||||
--data-binary @- <<EOF
|
|
||||||
{
|
|
||||||
"enable": true,
|
|
||||||
"protocol": "torrent",
|
|
||||||
"priority": 1,
|
|
||||||
"name": "Transmission",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "host",
|
|
||||||
"value": "transmission"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "port",
|
|
||||||
"value": 9091
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "urlBase",
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "movieCategory",
|
|
||||||
"value": "$DOWNLOAD_CATEGORY"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation": "Transmission",
|
|
||||||
"configContract": "TransmissionSettings"
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
} || true
|
|
||||||
|
|
||||||
if [ -n "${ROOT_FOLDER:-}" ]; then
|
|
||||||
curl -sf "$HOST/api/v3/rootfolder" \
|
|
||||||
-X POST \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-H "X-Api-Key: $API_KEY" \
|
|
||||||
--data-raw "{\"path\": \"$ROOT_FOLDER\"}" || true
|
|
||||||
fi
|
|
@@ -2,7 +2,6 @@
|
|||||||
user,
|
user,
|
||||||
home,
|
home,
|
||||||
arrs,
|
arrs,
|
||||||
arrMapping,
|
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
@@ -24,9 +23,7 @@ in
|
|||||||
value.content = builtins.readFile (
|
value.content = builtins.readFile (
|
||||||
(pkgs.formats.yaml { }).generate "${arr.shortName}.yaml" (
|
(pkgs.formats.yaml { }).generate "${arr.shortName}.yaml" (
|
||||||
import ./apps/${arr.shortName}.nix {
|
import ./apps/${arr.shortName}.nix {
|
||||||
base_url = "http://${arr.shortName}:${
|
base_url = "http://${arr.shortName}:${builtins.toString arr.port}${arr.urlBase}/";
|
||||||
builtins.toString arrMapping.${arr.type}.port
|
|
||||||
}${arr.urlBase}/";
|
|
||||||
api_key = hmConfig.sops.placeholder."${arr.shortName}/apiKey";
|
api_key = hmConfig.sops.placeholder."${arr.shortName}/apiKey";
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@@ -0,0 +1,50 @@
|
|||||||
|
# shellcheck shell=sh
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
HOST="http://localhost:8989$URL_BASE"
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
API_SUBPATH="/api/v3"
|
||||||
|
DOWNLOAD_CATEGORY="${DOWNLOAD_CATEGORY:-sonarr}"
|
||||||
|
|
||||||
|
build_transmission_payload() {
|
||||||
|
cat <<-EOF
|
||||||
|
{
|
||||||
|
"enable": true,
|
||||||
|
"protocol": "torrent",
|
||||||
|
"priority": 1,
|
||||||
|
"name": "Transmission",
|
||||||
|
"fields": [
|
||||||
|
{ "name": "host", "value": "transmission" },
|
||||||
|
{ "name": "port", "value": 9091 },
|
||||||
|
{ "name": "urlBase", "value": "" },
|
||||||
|
{ "name": "tvCategory", "value": "$DOWNLOAD_CATEGORY" }
|
||||||
|
],
|
||||||
|
"implementation": "Transmission",
|
||||||
|
"configContract": "TransmissionSettings"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
build_rootfolder_payload() {
|
||||||
|
cat <<-EOF
|
||||||
|
{
|
||||||
|
"path": "$ROOT_FOLDER"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
wait_for_api
|
||||||
|
|
||||||
|
if [ -n "$ROOT_FOLDER" ]; then
|
||||||
|
insert_or_skip_resource "rootfolder" "path" "$ROOT_FOLDER" "$(build_rootfolder_payload)"
|
||||||
|
prune_resources "rootfolder" "path" "$ROOT_FOLDER"
|
||||||
|
fi
|
||||||
|
|
||||||
|
try_forever upsert_resource "downloadclient" "name" "Transmission" "$(build_transmission_payload)"
|
||||||
|
prune_resources "downloadclient" "name" "Transmission"
|
||||||
|
|
||||||
|
delete_resource "qualityprofile" "name" "SD"
|
||||||
|
delete_resource "qualityprofile" "name" "HD-720p"
|
||||||
|
delete_resource "qualityprofile" "name" "HD-1080p"
|
||||||
|
delete_resource "qualityprofile" "name" "HD - 720p/1080p"
|
||||||
|
delete_resource "qualityprofile" "name" "Ultra-HD"
|
@@ -1,48 +0,0 @@
|
|||||||
# shellcheck shell=sh
|
|
||||||
|
|
||||||
DOWNLOAD_CATEGORY="${DOWNLOAD_CATEGORY:-sonarr}"
|
|
||||||
|
|
||||||
mkdir -p "/var/lib/transmission/$DOWNLOAD_CATEGORY"
|
|
||||||
|
|
||||||
{
|
|
||||||
curl -sf --retry 5 "$HOST/api/v3/downloadclient?forceSave=true" \
|
|
||||||
-X POST \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-H "X-Api-Key: $API_KEY" \
|
|
||||||
--data-binary @- <<EOF
|
|
||||||
{
|
|
||||||
"enable": true,
|
|
||||||
"protocol": "torrent",
|
|
||||||
"priority": 1,
|
|
||||||
"name": "Transmission",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "host",
|
|
||||||
"value": "transmission"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "port",
|
|
||||||
"value": 9091
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "urlBase",
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "tvCategory",
|
|
||||||
"value": "$DOWNLOAD_CATEGORY"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation": "Transmission",
|
|
||||||
"configContract": "TransmissionSettings"
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
} || true
|
|
||||||
|
|
||||||
if [ -n "${ROOT_FOLDER:-}" ]; then
|
|
||||||
curl -sf "$HOST/api/v3/rootfolder" \
|
|
||||||
-X POST \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-H "X-Api-Key: $API_KEY" \
|
|
||||||
--data-raw "{\"path\": \"$ROOT_FOLDER\"}" || true
|
|
||||||
fi
|
|
@@ -34,15 +34,9 @@ set_config_value "AnalyticsEnabled" "False"
|
|||||||
Prowlarr -data=/var/lib/prowlarr -nobrowser "$@" &
|
Prowlarr -data=/var/lib/prowlarr -nobrowser "$@" &
|
||||||
PID=$!
|
PID=$!
|
||||||
|
|
||||||
HOST="http://localhost:9696$URL_BASE"
|
if [ -f /etc/prowlarr/post-start.sh ]; then
|
||||||
|
|
||||||
curl -sf --retry 10 --retry-connrefused \
|
|
||||||
-H "X-Api-Key: $API_KEY" \
|
|
||||||
"$HOST/api/v1/health"
|
|
||||||
|
|
||||||
if [ -f /etc/prowlarr/setup.sh ]; then
|
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
. /etc/prowlarr/setup.sh
|
. /etc/prowlarr/post-start.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trap 'kill -INT "$PID"' INT TERM
|
trap 'kill -INT "$PID"' INT TERM
|
||||||
|
@@ -34,15 +34,9 @@ set_config_value "AnalyticsEnabled" "False"
|
|||||||
Radarr -data=/var/lib/radarr -nobrowser "$@" &
|
Radarr -data=/var/lib/radarr -nobrowser "$@" &
|
||||||
PID=$!
|
PID=$!
|
||||||
|
|
||||||
HOST="http://localhost:7878$URL_BASE"
|
if [ -f /etc/radarr/post-start.sh ]; then
|
||||||
|
|
||||||
curl -sf --retry 10 --retry-connrefused \
|
|
||||||
-H "X-Api-Key: $API_KEY" \
|
|
||||||
"$HOST/api/v1/health"
|
|
||||||
|
|
||||||
if [ -f /etc/radarr/setup.sh ]; then
|
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
. /etc/radarr/setup.sh
|
. /etc/radarr/post-start.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trap 'kill -INT "$PID"' INT TERM
|
trap 'kill -INT "$PID"' INT TERM
|
||||||
|
@@ -34,15 +34,9 @@ set_config_value "AnalyticsEnabled" "False"
|
|||||||
Sonarr -data=/var/lib/sonarr -nobrowser "$@" &
|
Sonarr -data=/var/lib/sonarr -nobrowser "$@" &
|
||||||
PID=$!
|
PID=$!
|
||||||
|
|
||||||
HOST="http://localhost:8989$URL_BASE"
|
if [ -f /etc/sonarr/post-start.sh ]; then
|
||||||
|
|
||||||
curl -sf --retry 10 --retry-connrefused \
|
|
||||||
-H "X-Api-Key: $API_KEY" \
|
|
||||||
"$HOST/api/v1/health"
|
|
||||||
|
|
||||||
if [ -f /etc/sonarr/setup.sh ]; then
|
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
. /etc/sonarr/setup.sh
|
. /etc/sonarr/post-start.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trap 'kill -INT "$PID"' INT TERM
|
trap 'kill -INT "$PID"' INT TERM
|
||||||
|
Reference in New Issue
Block a user