Skip to content

Commit

Permalink
stubby: ensure appdata directory is present on service start
Browse files Browse the repository at this point in the history
Signed-off-by: Norman Dankert <[email protected]>
  • Loading branch information
totkeks authored and hnyman committed Nov 30, 2024
1 parent 9f50762 commit 55a6cd4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion net/stubby/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=stubby
PKG_VERSION:=0.4.3
PKG_RELEASE:=1
PKG_RELEASE:=2

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/getdnsapi/$(PKG_NAME)
Expand Down
12 changes: 11 additions & 1 deletion net/stubby/files/stubby.init
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ stubby_config_dir="/var/etc/stubby"
stubby_config="$stubby_config_dir/stubby.yml"
stubby_pid_file="/var/run/stubby.pid"
stubby_manual_config="/etc/stubby/stubby.yml"
stubby_default_appdata_dir="/var/lib/stubby"

boot()
{
Expand Down Expand Up @@ -49,7 +50,7 @@ generate_config()
config_get round_robin "global" round_robin_upstreams "1"
echo "round_robin_upstreams: $round_robin"

config_get appdata_dir "global" appdata_dir "/var/lib/stubby"
config_get appdata_dir "global" appdata_dir "$stubby_default_appdata_dir"
echo "appdata_dir: \"$appdata_dir\""

config_get trust_anchors_backoff_time "global" trust_anchors_backoff_time "2500"
Expand Down Expand Up @@ -211,6 +212,7 @@ start_service() {
local manual
local log_level
local command_line_arguments
local appdata_dir

mkdir -p "$stubby_config_dir"

Expand All @@ -228,6 +230,14 @@ start_service() {
chown stubby:stubby "$stubby_config"
chmod 0400 "$stubby_config"

config_get appdata_dir "global" appdata_dir "$stubby_default_appdata_dir"
if [ -n "$appdata_dir" ]; then
if mkdir -p "$appdata_dir"; then
chown stubby:stubby "$appdata_dir"
chmod 0700 "$appdata_dir"
fi
fi

config_get command_line_arguments "global" command_line_arguments ""

config_get log_level "global" log_level ""
Expand Down

0 comments on commit 55a6cd4

Please sign in to comment.