Files
DDNS-Client/ddns-client/usr/lib/ddns-client/check_conditions
T
Cantibra 603356d07d
DDNS-Client / DDNS-Client (amd64, cicd.any, bookworm trixie noble, main) (push) Successful in 10s
DDNS-Client / DDNS-Client (arm64, cicd.any, bookworm trixie noble, main) (push) Successful in 11s
Initialize Git Repository: 'DDNS-Client'
2026-05-04 21:21:44 +02:00

85 lines
1.5 KiB
Bash

#!/usr/bin/bash
###
#
# Options Section
#
###
set -e
set -u
set -o pipefail
###
#
# Variable Section
#
###
source '/etc/ddns-client.conf'
###
#
# Runtime Environment
#
###
if [[ "${TIMER}" != 'true' ]]; then
exit 1
fi
if [[ -z "${HOSTNAME}" ]]; then
/usr/bin/echo "ERROR: The configuration option 'HOSTNAME' has not been set."
exit 1
fi
if ! /usr/bin/ping -c '1' 'ident.me' &> '/dev/null'; then
/usr/bin/echo "ERROR: The Identity Provider 'ident.me' is not reachable."
exit 1
fi
case "${PROVIDER}" in
webstuebchen)
if ! /usr/bin/ping -c '1' 'dns.webstuebchen.com' &> '/dev/null'; then
/usr/bin/echo "ERROR: The DNS Provider 'webstuenchen' is not reachable."
exit 1
fi
if [[ -z "${USERNAME}" ]]; then
/usr/bin/echo "ERROR: The configuration option 'USERNAME' has not been set."
exit 1
fi
if [[ -z "${PASSWORD}" ]]; then
/usr/bin/echo "ERROR: The configuration option 'PASSWORD' has not been set."
exit 1
fi
;;
*)
/usr/bin/echo "Error: The configuration option 'PROVIDER' has a wrong value."
exit 1
;;
esac
case "${IP}" in
IP4|IP6|IP64)
true
;;
*)
/usr/bin/echo "ERROR: The configuration option 'IP' has a wrong value."
exit 1
;;
esac
case "${NETWORK}" in
private)
if [[ -z "${INTERFACE}" ]]; then
/usr/bin/echo 'ERROR: The configuration option 'INTERFACE' has not been set.'
exit 1
fi
;;
public)
true
;;
*)
/usr/bin/echo "ERROR: The configuration option 'NETWORK' has a wrong value."
exit 1
;;
esac