Using variable for all install targets

This commit is contained in:
2021-04-19 22:35:58 +02:00
parent 4f2d80bbc9
commit 5db0165c49

View File

@@ -60,7 +60,7 @@ step_2() {
step_3_info() { echo "Add system user"; }
step_3() {
exe adduser --system $DLDUSER --group --home /opt/downloaders
exe adduser --system $DLDUSER --group --home "${DL_DIR}"
}
step_4_info() { echo "Install sonarr"
@@ -86,9 +86,9 @@ step_5() {
exe curl -sL "https://radarr.servarr.com/v1/update/master/updatefile?os=linux&runtime=netcore&arch=arm64" \
-o /tmp/Radarr.tgz
exe tar xvzf /tmp/Radarr.tgz -C /opt/downloaders/
exe mv /opt/downloaders/Radarr /opt/downloaders/radarr
exe chown -R ${DLDUSER}:${DLDUSER} /opt/downloaders/radarr
exe tar xvzf /tmp/Radarr.tgz -C "${DL_DIR}/"
exe mv ${DL_DIR}/Radarr "${DL_DIR}/radarr"
exe chown -R ${DLDUSER}:${DLDUSER} "${DL_DIR}/radarr"
}
step_6_info() { echo "Create radarr service"; }
@@ -99,7 +99,7 @@ step_6() {
addConf -s "$radarrService" "$radarrServiceLoc"
exe systemctl daemon-reload
}
radarrConf="/opt/downloaders.conf/radarr"
radarrConf="${DL_CONF_DIR}/radarr"
radarrServiceLoc="/etc/systemd/system/radarr.service"
radarrService="[Unit]
Description=Radarr Daemon
@@ -113,7 +113,7 @@ Group=$DLDUSER
Type=simple
ExecStart=/opt/downloaders/radarr/Radarr -nobrowser -data=$radarrConf
ExecStart=${DL_DIR}/radarr/Radarr -nobrowser -data=$radarrConf
TimeoutStopSec=20
KillMode=process
Restart=on-failure
@@ -133,9 +133,9 @@ step_7() {
[ ! -e "$jTar" ] && exe curl -sL "$jUrl" -o "$jTar"
exe tar xvzf "$jTar" -C /opt/downloaders
exe mv /opt/downloaders/Jackett /opt/downloaders/jackett
exe chown -R ${DLDUSER}:${DLDUSER} /opt/downloaders/jackett
exe tar xvzf "$jTar" -C "${DL_DIR}"
exe mv "${DL_DIR}/Jackett" "${DL_DIR}/jackett"
exe chown -R ${DLDUSER}:${DLDUSER} "${DL_DIR}/jackett"
}
step_8_info() { echo "Create jackett service"; }
@@ -157,8 +157,8 @@ Type=simple
SyslogIdentifier=jackett
Restart=on-failure
RestartSec=5
WorkingDirectory=/opt/downloaders/jackett
ExecStart=/bin/sh /opt/downloaders/jackett/jackett_launcher.sh
WorkingDirectory=${DL_DIR}/jackett
ExecStart=/bin/sh ${DL_DIR}/jackett/jackett_launcher.sh
TimeoutStopSec=30
[Install]
@@ -173,15 +173,15 @@ step_9() {
exe wget -q https://nzbget.net/download/nzbget-latest-bin-linux.run -O /tmp/nzbget-latest-bin-linux.run
# you can skip --arch aarch64 to auto-detect the architecture
exe sh /tmp/nzbget-latest-bin-linux.run --destdir /opt/downloaders/nzbget --arch aarch64
exe sh /tmp/nzbget-latest-bin-linux.run --destdir "${DL_DIR}/nzbget" --arch aarch64
exe chown -R ${DLDUSER}:${DLDUSER} /opt/downloaders/nzbget
exe chown -R ${DLDUSER}:${DLDUSER} "${DL_DIR}/nzbget"
}
step_10_info() { echo "Create NZBGet service"; }
step_10() {
local nzbConfOri="/opt/downloaders/nzbget/nzbget.conf"
local nzbConf="/opt/downloaders.conf/nzbget/nzbget.conf"
local nzbConfOri="${DL_DIR}/nzbget/nzbget.conf"
local nzbConf="${DL_CONF_DIR}/nzbget/nzbget.conf"
exe mkdir -p "$(dirname "$nzbConf")"
exe chown -R $DLDUSER: "$(dirname "$nzbConf")"/..
@@ -204,16 +204,16 @@ Group=$DLDUSER
Type=forking
# Pass any command line arguments etc.
ExecStart=/opt/downloaders/nzbget/nzbget -D -c /opt/downloaders.conf/nzbget/nzbget.conf
ExecStop=/opt/downloaders/nzbget/nzbget -Q -c /opt/downloaders.conf/nzbget/nzbget.conf
ExecReload=/opt/downloaders/nzbget/nzbget -O -c /opt/downloaders.conf/nzbget/nzbget.conf
ExecStart=${DL_DIR}/nzbget/nzbget -D -c ${DL_CONF_DIR}/nzbget/nzbget.conf
ExecStop=${DL_DIR}/nzbget/nzbget -Q -c ${DL_CONF_DIR}/nzbget/nzbget.conf
ExecReload=${DL_DIR}/nzbget/nzbget -O -c ${DL_CONF_DIR}/nzbget/nzbget.conf
TimeoutStopSec=20
KillMode=process
Restart=on-failure
RestartSec=5
# Sandboxing ... (see https://www.freedesktop.org/software/systemd/man/systemd.exec.html for more info)
ReadWritePaths=/opt/downloaders/nzbget /opt/downloaders.conf/nzbget /mnt
ReadWritePaths=${DL_DIR}/nzbget ${DL_CONF_DIR}/nzbget /mnt
ProtectSystem=strict
PrivateDevices=true
ProtectHome=true
@@ -235,9 +235,9 @@ step_11() {
exe apt install $lidarrDeps $APTOPT
exe tar xvzf /tmp/Lidarr.tgz -C /opt/downloaders/
exe mv /opt/downloaders/Lidarr /opt/downloaders/lidarr
exe chown -R ${DLDUSER}:${DLDUSER} /opt/downloaders/lidarr
exe tar xvzf /tmp/Lidarr.tgz -C "${DL_DIR}/"
exe mv "${DL_DIR}/Lidarr" "${DL_DIR}/lidarr"
exe chown -R ${DLDUSER}:${DLDUSER} "${DL_DIR}/lidarr"
}
step_12_info() { echo "Create lidarr service"; }
@@ -248,7 +248,7 @@ step_12() {
addConf -s "$lidarrService" "$lidarrServiceLoc"
exe systemctl daemon-reload
}
lidarrConf="/opt/downloaders.conf/lidarr"
lidarrConf="${DL_CONF_DIR}/lidarr"
lidarrServiceLoc="/etc/systemd/system/lidarr.service"
lidarrService="[Unit]
Description=Lidarr Daemon
@@ -262,7 +262,7 @@ Group=$DLDUSER
Type=simple
ExecStart=/opt/downloaders/lidarr/Lidarr -nobrowser -data=$lidarrConf
ExecStart=${DL_DIR}/lidarr/Lidarr -nobrowser -data=$lidarrConf
TimeoutStopSec=20
KillMode=process
Restart=on-failure
@@ -312,7 +312,7 @@ Group=$DLDUSER
Type=simple
ExecStart=/opt/downloaders/bazarr/bin/python3 /opt/downloaders/bazarr/bazarr/bazarr.py
ExecStart=${DL_DIR}/bazarr/bin/python3 ${DL_DIR}/bazarr/bazarr/bazarr.py
TimeoutStopSec=20
#KillMode=process
Restart=always