From cbc7d5b08b3facfec50aec9053321721d906bf6b Mon Sep 17 00:00:00 2001 From: Ondrej Kubik Date: Sat, 21 Sep 2024 16:46:08 +0000 Subject: [PATCH] Add support for snap packaging Signed-off-by: Ondrej Kubik --- build-aux/snap/snapcraft.yaml | 2 +- ddclient-snap-wrapper | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 ddclient-snap-wrapper diff --git a/build-aux/snap/snapcraft.yaml b/build-aux/snap/snapcraft.yaml index 458ee62..f2c7547 100644 --- a/build-aux/snap/snapcraft.yaml +++ b/build-aux/snap/snapcraft.yaml @@ -42,7 +42,7 @@ apps: parts: ddclient: plugin: autotools - source: https://github.com/ddclient/ddclient.git + source: . autotools-configure-parameters: - --prefix=/usr - --sysconfdir=/etc/ddclient diff --git a/ddclient-snap-wrapper b/ddclient-snap-wrapper new file mode 100755 index 0000000..4f520b3 --- /dev/null +++ b/ddclient-snap-wrapper @@ -0,0 +1,24 @@ +#!/bin/bash + +# handle --help as special case + +config_file="${SNAP_COMMON}/etc/ddclient/ddclient.conf" + +print_help() { + echo -e "${SNAP_NAME} uses config file as way to configuration." + echo -e "Edit ${config_file} with desired configuration." + echo -e "Once config is ready, enable service with:" + echo -e "\t$ snap start --enable ${SNAP_NAME}.daemon" +} + +if [ "${1}" = "--help" ]; then + print_help +else + mkdir -p -m 700 /tmp/cache + "${SNAP}"/usr/bin/ddclient \ + -file "${config_file}" \ + -cache /tmp/cache/ddclient.cache \ + -pid /tmp/ddclient.pid \ + --foreground + ${@} +fi