This commit is contained in:
Slaviša Arežina 2025-07-24 21:00:41 +02:00 committed by GitHub
parent af4aedf15a
commit d956763642
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 20 deletions

View File

@ -27,25 +27,19 @@ function update_script() {
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
RELEASE=$(curl -fsSL https://api.github.com/repos/duplicati/duplicati/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}') RELEASE=$(curl -fsSL https://api.github.com/repos/duplicati/duplicati/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}')
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then if [[ "${RELEASE}" != "$(cat ~/.duplicati)" ]] || [[ ! -f ~/.duplicati ]]; then
msg_info "Stopping $APP" msg_info "Stopping $APP"
systemctl stop duplicati systemctl stop duplicati
msg_ok "Stopped $APP" msg_ok "Stopped $APP"
msg_info "Updating $APP to v${RELEASE}"
curl -fsSL "https://github.com/duplicati/duplicati/releases/download/v${RELEASE}/duplicati-${RELEASE}-linux-x64-gui.deb" -o $(basename "https://github.com/duplicati/duplicati/releases/download/v${RELEASE}/duplicati-${RELEASE}-linux-x64-gui.deb") fetch_and_deploy_gh_release "duplicati" "duplicati/duplicati" "binary" "latest" "/opt/duplicati" "linux-x64-gui.deb"
$STD dpkg -i duplicati-${RELEASE}-linux-x64-gui.deb
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated $APP to v${RELEASE}"
msg_info "Starting $APP" msg_info "Starting $APP"
systemctl start duplicati systemctl start duplicati
msg_ok "Started $APP" msg_ok "Started $APP"
msg_info "Cleaning Up"
rm -rf ~/duplicati-${RELEASE}-linux-x64-gui.deb
msg_ok "Cleanup Completed"
msg_ok "Update Successful" msg_ok "Update Successful"
else else
msg_ok "No update required. ${APP} is already at v${RELEASE}" msg_ok "No update required. ${APP} is already at v${RELEASE}"

View File

@ -20,19 +20,16 @@ $STD apt-get install -y \
libfontconfig1 libfontconfig1
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Setting up Duplicati" fetch_and_deploy_gh_release "duplicati" "duplicati/duplicati" "binary" "latest" "/opt/duplicati" "linux-x64-gui.deb"
RELEASE=$(curl -fsSL https://api.github.com/repos/duplicati/duplicati/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}')
curl -fsSL "https://github.com/duplicati/duplicati/releases/download/v${RELEASE}/duplicati-${RELEASE}-linux-x64-gui.deb" -o "duplicati-${RELEASE}-linux-x64-gui.deb"
$STD dpkg -i duplicati-${RELEASE}-linux-x64-gui.deb
echo "${RELEASE}" >/opt/Duplicati_version.txt
msg_ok "Finished setting up Duplicati"
msg_info "Configuring duplicati"
DECRYPTKEY=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) DECRYPTKEY=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
ADMINPASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) ADMINPASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
{ {
echo "Admin password = ${ADMINPASS}" echo "Admin password = ${ADMINPASS}"
echo "Database encryption key = ${DECRYPTKEY}" echo "Database encryption key = ${DECRYPTKEY}"
} >>~/duplicati.creds } >>~/duplicati.creds
msg_ok "Configured duplicati"
msg_info "Creating Service" msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/duplicati.service cat <<EOF >/etc/systemd/system/duplicati.service
@ -54,10 +51,6 @@ motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
rm -f duplicati-${RELEASE}-linux-x64-gui.deb
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
msg_ok "Cleaned" msg_ok "Cleaned"
motd_ssh
customize