From 27266d6001f56ab7e64ea06813bb523d8fbcc151 Mon Sep 17 00:00:00 2001 From: jung geun Date: Thu, 12 Sep 2024 22:14:06 +0900 Subject: [PATCH] Refactor file paths in Makefile, run_script.sh, and start.sh --- Makefile | 1 + run_script.sh | 5 ++++- start.sh | 8 +++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 81050b1..5cca1bc 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ IMAGE_NAME = "cloudflare-ddns" +DIR = $(shell pwd) default: build diff --git a/run_script.sh b/run_script.sh index 4cd77a4..9df7461 100644 --- a/run_script.sh +++ b/run_script.sh @@ -1,7 +1,10 @@ #!/bin/bash + export CLOUDFLARE_API_KEY=$API_KEY export CLOUDFLARE_DOMAIN=$DOMAIN_NAME export CLOUDFLARE_ZONE_ID=$ZONE_ID +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + # Run the script -python3 /app/cloudflare-ddns/src/update_dns.py $@ \ No newline at end of file +python3 $DIR/src/update_dns.py $@ \ No newline at end of file diff --git a/start.sh b/start.sh index 275be7c..6e51e4b 100644 --- a/start.sh +++ b/start.sh @@ -1,8 +1,10 @@ #!/bin/bash -if [ ! -f /app/cloudflare-ddns/config/env.json ]; then - cp /app/cloudflare-ddns/init/default_env.json /app/cloudflare-ddns/config/env.json +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +if [ ! -f $DIR/config/env.json ]; then + cp $DIR/init/default_env.json $DIR/config/env.json fi -sh /app/cloudflare-ddns/run_script.sh +sh $DIR/run_script.sh # tail -f /var/log/cloudflare_ddns.log \ No newline at end of file