From 056fab55310ccd1fc3e6f0192a08b372e30ad086 Mon Sep 17 00:00:00 2001 From: Tal Date: Mon, 10 Mar 2014 21:04:31 -0600 Subject: [PATCH] Added Alpine Linux init script --- README.md | 8 ++++++ README.ssl | 2 ++ ddclient | 1 + sample-etc_rc.d_init.d_ddclient.alpine | 38 ++++++++++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100755 sample-etc_rc.d_init.d_ddclient.alpine diff --git a/README.md b/README.md index 983a76b..6f079d6 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,14 @@ INSTALLATION: ## start the first time by hand /etc/rc.d/init.d/ddclient start + ## For those using Alpine style rc files and using daemon-mode: + cp sample-etc_rc.d_init.d_ddclient.alpine /etc/init.d/ddclient + chmod 755 /etc/init.d/ddclient + ## enable automatic startup when booting + rc-update add ddclient + ## start the first time by hand + rc-service ddclient start + ## If you are not using daemon-mode, configure cron and dhcp or ppp ## as described below. diff --git a/README.ssl b/README.ssl index be94a29..c4064b2 100644 --- a/README.ssl +++ b/README.ssl @@ -6,5 +6,7 @@ you have IO::Socket::SSL. On debian, you need libio-socket-ssl-perl to have IO::Socket::SSL +On alpine, you need perl-io-socket-ssl to have IO::Socket::SSL + ssl support is tested on folowing dynamic dns providers: - dyndns.com diff --git a/ddclient b/ddclient index 0c86b85..0acc8eb 100755 --- a/ddclient +++ b/ddclient @@ -1784,6 +1784,7 @@ sub load_ssl_support { Error loading the Perl module IO::Socket::SSL needed for SSL connect. On Debian, the package libio-socket-ssl-perl must be installed. On Red Hat, the package perl-IO-Socket-SSL must be installed. +On Alpine, the package perl-io-socket-ssl must be installed. EOM } import IO::Socket::SSL; diff --git a/sample-etc_rc.d_init.d_ddclient.alpine b/sample-etc_rc.d_init.d_ddclient.alpine new file mode 100755 index 0000000..9160823 --- /dev/null +++ b/sample-etc_rc.d_init.d_ddclient.alpine @@ -0,0 +1,38 @@ +#!/sbin/runscript +description="ddclient Daemon for Alpine" +command="/usr/sbin/ddclient" +config_file="/etc/ddclient/ddclient.conf" +command_args="" +pidfile=$(grep -v '^\s*#' "${config_file}" | grep -i -m 1 pid= | awk -F '=' '{print $2}') +delay=$(grep -v '^\s*#' "${config_file}" | grep -i -m 1 "daemon" | awk -F '=' '{print $2}') + +if [ -z "${delay}" ] +then + command_args="-daemon 300" +else + command_args="" +fi + + +depend() { + use logger + need net + after firewall +} + +start() { + ebegin "Starting ddclient" + start-stop-daemon --start \ + --exec "${command}" \ + --pidfile "${pidfile}" \ + -- \ + ${command_args} + eend $? +} + +stop() { + ebegin "Stopping ddclient" + start-stop-daemon --stop --exec "${command}" \ + --pidfile "${pidfile}" + eend $? +}