Refactor (#7091)
This commit is contained in:
parent
88579d4be3
commit
1fce2de5c1
@ -23,25 +23,21 @@ function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -d /var/lib/prowlarr/ ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
msg_info "Updating $APP LXC"
|
||||
temp_file="$(mktemp)"
|
||||
rm -rf /opt/Prowlarr
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
curl -fsSL "https://github.com/Prowlarr/Prowlarr/releases/download/v${RELEASE}/Prowlarr.master.${RELEASE}.linux-core-x64.tar.gz" -o "$temp_file"
|
||||
$STD tar -xvzf "$temp_file"
|
||||
mv Prowlarr /opt
|
||||
chmod 775 /opt/Prowlarr
|
||||
msg_ok "Updated $APP LXC"
|
||||
if [[ "${RELEASE}" != "$(cat ~/.prowlarr 2>/dev/null)" ]] || [[ ! -f ~/.prowlarr ]]; then
|
||||
rm -rf /opt/Prowlarr
|
||||
fetch_and_deploy_gh_release "prowlarr" "Prowlarr/Prowlarr" "prebuild" "latest" "/opt/Prowlarr" "Prowlarr.master*linux-core-x64.tar.gz"
|
||||
chmod 775 /opt/Prowlarr
|
||||
msg_ok "Successfully updated"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||
fi
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -f "$temp_file"
|
||||
msg_ok "Cleaned up"
|
||||
exit
|
||||
}
|
||||
|
||||
|
@ -17,23 +17,19 @@ msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y sqlite3
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing Prowlarr"
|
||||
temp_file="$(mktemp)"
|
||||
fetch_and_deploy_gh_release "prowlarr" "Prowlarr/Prowlarr" "prebuild" "latest" "/opt/Prowlarr" "Prowlarr.master*linux-core-x64.tar.gz"
|
||||
|
||||
msg_info "Configuring Prowlarr"
|
||||
mkdir -p /var/lib/prowlarr/
|
||||
chmod 775 /var/lib/prowlarr/
|
||||
cd /var/lib/prowlarr/
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
curl -fsSL "https://github.com/Prowlarr/Prowlarr/releases/download/v${RELEASE}/Prowlarr.master.${RELEASE}.linux-core-x64.tar.gz" -o "$temp_file"
|
||||
$STD tar -xvzf "$temp_file"
|
||||
mv Prowlarr /opt
|
||||
chmod 775 /opt/Prowlarr
|
||||
msg_ok "Installed Prowlarr"
|
||||
chmod 775 /var/lib/prowlarr/ /opt/Prowlarr
|
||||
msg_ok "Configured Prowlarr"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/prowlarr.service
|
||||
[Unit]
|
||||
Description=Prowlarr Daemon
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
UMask=0002
|
||||
Type=simple
|
||||
@ -41,6 +37,7 @@ ExecStart=/opt/Prowlarr/Prowlarr -nobrowser -data=/var/lib/prowlarr/
|
||||
TimeoutStopSec=20
|
||||
KillMode=process
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
@ -51,7 +48,6 @@ motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -f "$temp_file"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
|
Loading…
x
Reference in New Issue
Block a user