adguardhome: Update init files
authorRyan Keane <the.ra2.ifv@gmail.com>
Sun, 22 Dec 2024 14:12:04 +0000 (06:12 -0800)
committerTianling Shen <cnsztl@gmail.com>
Sun, 16 Feb 2025 13:48:19 +0000 (21:48 +0800)
Move working directory from `/var/adguardhome` to
`/var/lib/adguardhome`, according to Linux FHS.
Add option to store PID file, defaulting to `/run/adguardhome.pid`.

Signed-off-by: Ryan Keane <the.ra2.ifv@gmail.com>
net/adguardhome/files/adguardhome.config
net/adguardhome/files/adguardhome.init

index 0c2aeac0ab207bbdea2c83c38ab4157f2ac9b866..7a8a417d04afb8da0cec5c5402f6114bd7a79fe4 100644 (file)
@@ -1,4 +1,5 @@
 config adguardhome config
-       # Where to store persistent data by AdGuard Home
-       option workdir /var/adguardhome
        option config /etc/adguardhome.yaml
+       # Where to store persistent data by AdGuard Home
+       option workdir /var/lib/adguardhome
+       option pidfile /run/adguardhome.pid
index ffdae9c43d87d868031a74bfcc56dcc57a4f899a..328ce693d085be187ce82a8640982e0f1e64252d 100644 (file)
@@ -21,13 +21,14 @@ start_service() {
   fi
 
   config_load adguardhome
-  config_get WORK_DIR config workdir
   config_get CONFIG_FILE config config "/etc/adguardhome.yaml"
+  config_get PID_FILE config pidfile "/run/adguardhome.pid"
+  config_get WORK_DIR config workdir "/var/lib/adguardhome"
 
   [ -d "$WORK_DIR" ] || mkdir -m 0755 -p "$WORK_DIR"
 
   procd_open_instance
-  procd_set_param command "$PROG" -c "$CONFIG_FILE" -w "$WORK_DIR" --no-check-update
+  procd_set_param command "$PROG" -c "$CONFIG_FILE" -w "$WORK_DIR" --pidfile "$PID_FILE" --no-check-update
   procd_set_param stdout 1
   procd_set_param stderr 1
   procd_close_instance