diff --git a/README.md b/README.md index 50a52fc..24c3a5f 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Script to persist ssh keys after reboot or firmware update. | WireGuard kernel module | | Uses a prebuilt linux kernel module, without the need to move to a custom kernel. | | OpenConnect VPN | | OpenConnect VPN Client for the UniFi Dream Machine Pro (Unofficial).| | split-vpn | |A split tunnel VPN script for the UDM with policy based routing. This helper script can be used on your UDM to route select VLANs, clients, or even domains through a VPN connection. It supports OpenVPN, WireGuard, and OpenConnect (Cisco AnyConnect) clients running directly on your UDM, and external VPN clients running on other servers on your network. | -| Zerotier | |ZeroTier provides network control and P2P functionality · Use ZeroTier to create products which run on their own decentralized networks | +| Zerotier | |ZeroTier provides network control and P2P functionality · Use ZeroTier to create products which run on their own decentralized networks | ## DNS Providers diff --git a/cloudflare-ddns/README.md b/cloudflare-ddns/README.md index a9e3f02..611cf18 100644 --- a/cloudflare-ddns/README.md +++ b/cloudflare-ddns/README.md @@ -26,16 +26,16 @@ Update [config.json](configs/config.json) with the following options: ## Steps -2. Make a directory for your configuration +1. Make a directory for your configuration, check if you have `/mnt/data/` or `/data/` and adjust accordingly. ```sh mkdir -p /data/cloudflare-ddns ``` -3. Create a [cloudflare-ddns configuration](configs/config.json) in `/data/cloudflare-ddns` and update the configuration to meet your needs. -4. Copy [30-cloudflare-ddns.sh](on_boot.d/30-cloudflare-ddns.sh) to `/data/on_boot.d`. -5. Execute /data/on_boot.d/[30-cloudflare-ddns.sh](on_boot.d/30-cloudflare-ddns.sh) -6. Execute `podman logs cloudflare-ddns` to verify the continer is running without error (ipv6 warnings are normal). +2. Create a [cloudflare-ddns configuration](configs/config.json) in `/data/cloudflare-ddns` and update the configuration to meet your needs. +3. Copy [30-cloudflare-ddns.sh](on_boot.d/30-cloudflare-ddns.sh) to `/data/on_boot.d`. +. Execute /data/on_boot.d/[30-cloudflare-ddns.sh](on_boot.d/30-cloudflare-ddns.sh) +5. Execute `podman logs cloudflare-ddns` to verify the continer is running without error (ipv6 warnings are normal). ### Useful commands diff --git a/cloudflare-ddns/on_boot.d/30-cloudflare-ddns.sh b/cloudflare-ddns/on_boot.d/30-cloudflare-ddns.sh index 04f2073..a59adc5 100644 --- a/cloudflare-ddns/on_boot.d/30-cloudflare-ddns.sh +++ b/cloudflare-ddns/on_boot.d/30-cloudflare-ddns.sh @@ -1,5 +1,31 @@ #!/bin/sh CONTAINER=cloudflare-ddns +# Get DataDir location +DATA_DIR="/data" +case "$(ubnt-device-info firmware || true)" in +1*) + DATA_DIR="/mnt/data" + ;; +2*) + DATA_DIR="/data" + ;; +3*) + DATA_DIR="/data" + ;; +*) + echo "ERROR: No persistent storage found." 1>&2 + exit 1 + ;; +esac +# Check if the directory exists +if [ ! -d "$DATA_DIR/cloudflare-ddns" ]; then + # If it does not exist, create the directory + mkdir -p "$DATA_DIR/cloudflare-ddns" + echo "Directory '$DATA_DIR/cloudflare-ddns' created." +else + # If it already exists, print a message + echo "Directory '$DATA_DIR/cloudflare-ddns' already exists. Moving on." +fi # Starts a cloudflare ddns container that is deleted after it is stopped. # All configs stored in /data/cloudflare-ddns @@ -10,6 +36,6 @@ else --net=host \ --name "$CONTAINER" \ --security-opt=no-new-privileges \ - -v /data/cloudflare-ddns/config.json:/config.json \ + -v $DATA_DIR/cloudflare-ddns/config.json:/config.json \ timothyjmiller/cloudflare-ddns:latest fi