mirror of
https://github.com/nextcloud/vm.git
synced 2025-10-26 11:27:32 +00:00
update ddclient-configuration with new function for reinstalling (#1603)
Co-authored-by: Daniel Hansson <github@hanssonit.se>
This commit is contained in:
parent
0cc48f2b11
commit
7e1858d5de
@ -1,10 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2020, https://www.hanssonit.se/
|
||||
# Copyright © 2020 Simon Lindner (https://github.com/szaimen)
|
||||
|
||||
# shellcheck disable=2034,2059
|
||||
true
|
||||
SCRIPT_NAME="Setup DDclient"
|
||||
SCRIPT_NAME="DynDNS with ddclient"
|
||||
SCRIPT_EXPLAINER="This script lets you setup DynDNS by using the Linux ddclient software."
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
|
||||
|
||||
@ -17,11 +19,40 @@ debug_mode
|
||||
# Check if root
|
||||
root_check
|
||||
|
||||
# Check if ddclient is already installed
|
||||
if ! is_this_installed ddclient
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
else
|
||||
# Ask for removal or reinstallation
|
||||
reinstall_remove_menu "$SCRIPT_NAME"
|
||||
# Removal
|
||||
apt purge ddclient -y
|
||||
if is_this_installed libjson-any-perl
|
||||
then
|
||||
apt purge libjson-any-perl -y
|
||||
fi
|
||||
apt autoremove -y
|
||||
rm -f /etc/ddclient.conf
|
||||
# Show successful uninstall if applicable
|
||||
removal_popup "$SCRIPT_NAME"
|
||||
fi
|
||||
|
||||
# install needed tool
|
||||
DEBIAN_FRONTEND=noninteractive apt install ddclient -y
|
||||
|
||||
# Test if file exists
|
||||
if [ ! -f /etc/ddclient.conf ]
|
||||
then
|
||||
msg_box "The default ddclient.conf doesn't seem to exist.\nPlease report this to\n$ISSUES."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
choice=$(whiptail --title "$TITLE" --menu \
|
||||
"This script lets you setup DynDNS by using the ddclient application.
|
||||
You have to setup an account before you can start.\n\nPlease choose your DynDNS-Provider.
|
||||
$MENU_GUIDE\n\n$RUN_LATER_GUIDE
|
||||
If your DDNS provider isn't already supported, please open a new issue here:\n$ISSUES" "$WT_HEIGHT" "$WT_WIDTH" 4 \
|
||||
"Please choose your DynDNS-Provider.\nYou have to setup an account before you can start.\n
|
||||
If your DDNS provider isn't already supported, please open a new issue here:\n$ISSUES
|
||||
$MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \
|
||||
"Cloudflare" "(cloudflare.com)" \
|
||||
"deSEC" "(desec.io)" \
|
||||
"Duck DNS" "(duckdns.org)" \
|
||||
@ -69,7 +100,7 @@ case "$choice" in
|
||||
esac
|
||||
|
||||
# Instructions
|
||||
msg_box "Before you can continue, you have to access $PROVIDER and $INSTRUCTIONS.\nHere is a guide:\n$GUIDE"
|
||||
msg_box "Before you can continue, you have to access $PROVIDER and $INSTRUCTIONS.\n\nHere is a guide:\n$GUIDE"
|
||||
|
||||
# Ask if everything is prepared
|
||||
if ! yesno_box_yes "Are you ready to continue?"
|
||||
@ -108,20 +139,6 @@ then
|
||||
install_if_not libjson-any-perl
|
||||
fi
|
||||
|
||||
# Install ddclient
|
||||
if ! is_this_installed ddclient
|
||||
then
|
||||
print_text_in_color "$ICyan" "Installing ddclient..."
|
||||
# This creates a ddclient service, creates a /etc/default/ddclient file and a /etc/ddclient.conf file
|
||||
DEBIAN_FRONTEND=noninteractive apt install ddclient -y
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/ddclient.conf ]
|
||||
then
|
||||
msg_box "The default ddclient.conf doesn't seem to exist.\nPlease report this to\n$ISSUES."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Write information to ddclient.conf
|
||||
cat << DDCLIENT_CONF > "/etc/ddclient.conf"
|
||||
# Configuration file for ddclient generated by debconf
|
||||
|
||||
Loading…
Reference in New Issue
Block a user