Refactor (#6202)
This commit is contained in:
parent
af4aedf15a
commit
d956763642
@ -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}"
|
||||||
|
@ -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
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user