parent
0555dbd93c
commit
ebb5d8f2c4
@ -27,30 +27,37 @@ function update_script() {
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
msg_info "Stopping ${APP}"
|
||||
systemctl stop rdtc
|
||||
msg_ok "Stopped ${APP}"
|
||||
|
||||
msg_info "Updating ${APP}"
|
||||
if dpkg-query -W dotnet-sdk-8.0 >/dev/null 2>&1; then
|
||||
$STD apt-get remove --purge -y dotnet-sdk-8.0
|
||||
$STD apt-get install -y dotnet-sdk-9.0
|
||||
RELEASE=$(curl -s https://api.github.com/repos/rogerfar/rdt-client/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
if [[ ! -f ~/.rdt-client ]] || [[ "${RELEASE}" != "$(cat ~/.rdt-client 2>/dev/null)" ]]; then
|
||||
msg_info "Stopping ${APP}"
|
||||
systemctl stop rdtc
|
||||
msg_ok "Stopped ${APP}"
|
||||
|
||||
msg_info "Creating backup"
|
||||
mkdir -p /opt/rdtc-backup
|
||||
cp -R /opt/rdtc/appsettings.json /opt/rdtc-backup/
|
||||
msg_ok "Backup created"
|
||||
|
||||
fetch_and_deploy_gh_release "rdt-client" "rogerfar/rdt-client" "prebuild" "latest" "/opt/rdtc" "RealDebridClient.zip"
|
||||
cp -R /opt/rdtc-backup/appsettings.json /opt/rdtc/
|
||||
if dpkg-query -W dotnet-sdk-8.0 >/dev/null 2>&1; then
|
||||
$STD apt-get remove --purge -y dotnet-sdk-8.0
|
||||
$STD apt-get install -y dotnet-sdk-9.0
|
||||
fi
|
||||
|
||||
msg_info "Starting ${APP}"
|
||||
systemctl start rdtc
|
||||
msg_ok "Started ${APP}"
|
||||
|
||||
msg_info "Cleaning Up"
|
||||
rm -rf /opt/rdtc-backup
|
||||
msg_ok "Cleaned"
|
||||
|
||||
msg_ok "Updated Successfully"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||
fi
|
||||
mkdir -p rdtc-backup
|
||||
cp -R /opt/rdtc/appsettings.json rdtc-backup/
|
||||
curl -fsSL "https://github.com/rogerfar/rdt-client/releases/latest/download/RealDebridClient.zip" -o $(basename "https://github.com/rogerfar/rdt-client/releases/latest/download/RealDebridClient.zip")
|
||||
$STD unzip -o RealDebridClient.zip -d /opt/rdtc
|
||||
cp -R rdtc-backup/appsettings.json /opt/rdtc/
|
||||
msg_ok "Updated ${APP}"
|
||||
|
||||
msg_info "Starting ${APP}"
|
||||
systemctl start rdtc
|
||||
msg_ok "Started ${APP}"
|
||||
|
||||
msg_info "Cleaning Up"
|
||||
rm -rf rdtc-backup RealDebridClient.zip
|
||||
msg_ok "Cleaned"
|
||||
msg_ok "Updated Successfully"
|
||||
exit
|
||||
}
|
||||
|
||||
|
@ -16,19 +16,17 @@ update_os
|
||||
msg_info "Installing ASP.NET Core Runtime"
|
||||
curl -fsSL "https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb" -o packages-microsoft-prod.deb
|
||||
$STD dpkg -i packages-microsoft-prod.deb
|
||||
rm packages-microsoft-prod.deb
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y dotnet-sdk-9.0
|
||||
msg_ok "Installed ASP.NET Core Runtime"
|
||||
|
||||
msg_info "Installing rdtclient"
|
||||
curl -fsSL "https://github.com/rogerfar/rdt-client/releases/latest/download/RealDebridClient.zip" -o RealDebridClient.zip
|
||||
$STD unzip RealDebridClient.zip -d /opt/rdtc
|
||||
rm RealDebridClient.zip
|
||||
fetch_and_deploy_gh_release "rdt-client" "rogerfar/rdt-client" "prebuild" "latest" "/opt/rdtc" "RealDebridClient.zip"
|
||||
|
||||
msg_info "Configuring rdtclient"
|
||||
cd /opt/rdtc
|
||||
mkdir -p data/{db,downloads}
|
||||
sed -i 's#/data/db/#/opt/rdtc&#g' /opt/rdtc/appsettings.json
|
||||
msg_ok "Installed rdtclient"
|
||||
msg_ok "Configured rdtclient"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/rdtc.service
|
||||
@ -51,6 +49,7 @@ motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -f ~/packages-microsoft-prod.deb
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
|
Loading…
x
Reference in New Issue
Block a user