From d7ecb520429f5fba95ed4bdd424613601447c79e Mon Sep 17 00:00:00 2001 From: ksurl Date: Wed, 19 Jul 2023 03:09:44 +0000 Subject: [PATCH 1/4] add env for logfile and config file --- root/etc/s6-overlay/s6-rc.d/svc-flexget/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/s6-overlay/s6-rc.d/svc-flexget/run b/root/etc/s6-overlay/s6-rc.d/svc-flexget/run index 88b4beb..a867f08 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-flexget/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-flexget/run @@ -4,4 +4,4 @@ exec \ s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 5050" \ s6-setuidgid abc python3 /lsiopy/bin/flexget \ - --loglevel "${FG_LOG_LEVEL:-info}" --logfile "/config/flexget.log" -c /config/.flexget/config.yml daemon start --autoreload-config + --loglevel "${FG_LOG_LEVEL:-info}" --logfile "${FG_LOG_FILE:-/config/flexget.log}" -c "${FG_CONFIG_FILE:-/config/.flexget/config.yml}" daemon start --autoreload-config From 4add7ed23a9c3bd2296eb2143c95147b60330f3a Mon Sep 17 00:00:00 2001 From: ksurl Date: Wed, 19 Jul 2023 03:13:35 +0000 Subject: [PATCH 2/4] add fg env to readme vars --- readme-vars.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme-vars.yml b/readme-vars.yml index 6284e73..1a3ba03 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -22,6 +22,8 @@ param_container_name: "{{ project_name }}" param_usage_include_env: true param_env_vars: - { env_var: "FG_LOG_LEVEL", env_value: "info", desc: "Set the FlexGet logging level." } + - { env_var: "FG_LOG_FILE", env_value: "/config/flexget.log", desc: "Set the FlexGet log file location." } + - { env_var: "FG_CONFIG_FILE", env_value: "/config/.flexget/config.yml", desc: "Set the FlexGet config file location." } param_usage_include_vols: true param_volumes: - { vol_path: "/config", vol_host_path: "/path/to/data", desc: "Local path for sabnzbd config files." } From 4ca267e9ecf9d3ef9388f126fc962c0077a79c3a Mon Sep 17 00:00:00 2001 From: ksurl Date: Sun, 23 Jul 2023 15:44:20 +0000 Subject: [PATCH 3/4] update init for fg env --- root/etc/s6-overlay/s6-rc.d/init-flexget-config/run | 12 +++++++----- root/etc/s6-overlay/s6-rc.d/svc-flexget/run | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-flexget-config/run b/root/etc/s6-overlay/s6-rc.d/init-flexget-config/run index 5d94495..e6ad064 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-flexget-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-flexget-config/run @@ -5,17 +5,19 @@ mkdir -p \ /config/.flexget \ /data +FG_CONFIG_FILE="${FG_CONFIG_FILE:-/config/.flexget/config.yml}" +FG_LOCK_FILE="${FG_CONFIG_FILE/config.yml/.config-lock}" # clean up config-lock from unclean shutdown -if [[ -f "/config/.flexget/.config-lock" ]]; then - rm -rf "/config/.flexget/.config-lock" +if [[ -f "${FG_LOCK_FILE}" ]]; then + rm -rf "${FG_LOCK_FILE}" fi -if [[ ! -f "/config/.flexget/config.yml" ]]; then - cp /default/config.yml /config/.flexget/config.yml +if [[ ! -f "{$FG_CONFIG_FILE}" ]]; then + cp /default/config.yml "${FG_CONFIG_FILE}" fi if [[ -n "${FG_WEBUI_PASSWORD}" ]]; then - if ! flexget --loglevel error web passwd "${FG_WEBUI_PASSWORD}" | tee /dev/stderr | grep -q 'Updated password'; then + if ! flexget -c "${FG_CONFIG_FILE}" --loglevel error web passwd "${FG_WEBUI_PASSWORD}" | tee /dev/stderr | grep -q 'Updated password'; then echo "Halting init, please address the above issues and recreate the container" sleep infinity fi diff --git a/root/etc/s6-overlay/s6-rc.d/svc-flexget/run b/root/etc/s6-overlay/s6-rc.d/svc-flexget/run index a867f08..d4a8959 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-flexget/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-flexget/run @@ -4,4 +4,4 @@ exec \ s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 5050" \ s6-setuidgid abc python3 /lsiopy/bin/flexget \ - --loglevel "${FG_LOG_LEVEL:-info}" --logfile "${FG_LOG_FILE:-/config/flexget.log}" -c "${FG_CONFIG_FILE:-/config/.flexget/config.yml}" daemon start --autoreload-config + --loglevel "${FG_LOG_LEVEL:-info}" --logfile "${FG_LOG_FILE:-/config/.flexget/flexget.log}" -c "${FG_CONFIG_FILE:-/config/.flexget/config.yml}" daemon start --autoreload-config From ead86e6242be129163feb2723e0aa5cea9545397 Mon Sep 17 00:00:00 2001 From: ksurl Date: Tue, 25 Jul 2023 16:18:45 +0000 Subject: [PATCH 4/4] validate config file extension for lock file env --- root/etc/s6-overlay/s6-rc.d/init-flexget-config/run | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-flexget-config/run b/root/etc/s6-overlay/s6-rc.d/init-flexget-config/run index e6ad064..687fd35 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-flexget-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-flexget-config/run @@ -6,7 +6,18 @@ mkdir -p \ /data FG_CONFIG_FILE="${FG_CONFIG_FILE:-/config/.flexget/config.yml}" -FG_LOCK_FILE="${FG_CONFIG_FILE/config.yml/.config-lock}" +case "${FG_CONFIG_FILE}" in + *yml) + FG_LOCK_FILE="${FG_CONFIG_FILE/config.yml/.config-lock}" + ;; + *yaml) + FG_LOCK_FILE="${FG_CONFIG_FILE/config.yaml/.config-lock}" + ;; + default) + echo "invalid config file extension" + exit 1 + ;; +esac # clean up config-lock from unclean shutdown if [[ -f "${FG_LOCK_FILE}" ]]; then rm -rf "${FG_LOCK_FILE}"