smartdns: change pid file path from /var/run to /run
This commit is contained in:
@@ -32,7 +32,7 @@ RUN cd /build/smartdns && \
|
||||
\
|
||||
( cd package && tar -xvf *.tar.gz && chmod a+x smartdns/etc/init.d/smartdns ) && \
|
||||
\
|
||||
mkdir -p /release/var/log /release/var/run && \
|
||||
mkdir -p /release/var/log /release/run && \
|
||||
cp package/smartdns/etc /release/ -a && \
|
||||
cp package/smartdns/usr /release/ -a && \
|
||||
cd / && rm -rf /build
|
||||
|
||||
2
Makefile
2
Makefile
@@ -18,7 +18,7 @@ DESTDIR :=
|
||||
PREFIX := /usr
|
||||
SBINDIR := $(PREFIX)/sbin
|
||||
SYSCONFDIR := /etc
|
||||
RUNSTATEDIR := /var/run
|
||||
RUNSTATEDIR := /run
|
||||
SYSTEMDSYSTEMUNITDIR := $(shell ${PKG_CONFIG} --variable=systemdsystemunitdir systemd)
|
||||
SMARTDNS_SYSTEMD = systemd/smartdns.service
|
||||
|
||||
|
||||
@@ -28,7 +28,10 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
. /etc/default/smartdns
|
||||
SMARTDNS=/usr/sbin/smartdns
|
||||
PIDFILE=/var/run/smartdns.pid
|
||||
PIDFILE=/run/smartdns.pid
|
||||
if [ ! -d "/run" ]; then
|
||||
PIDFILE=/var/run/smartdns.pid
|
||||
fi
|
||||
|
||||
test -x $SMARTDNS || exit 5
|
||||
|
||||
|
||||
@@ -22,7 +22,11 @@ USE_PROCD=1
|
||||
SERVICE_USE_PID=1
|
||||
SERVICE_WRITE_PID=1
|
||||
SERVICE_DAEMONIZE=1
|
||||
SERVICE_PID_FILE="/var/run/smartdns.pid"
|
||||
SERVICE_PID_FILE="/run/smartdns.pid"
|
||||
if [ ! -d "/run" ]; then
|
||||
SERVICE_PID_FILE="/var/run/smartdns.pid"
|
||||
fi
|
||||
|
||||
SMARTDNS_CONF_DIR="/etc/smartdns"
|
||||
SMARTDNS_CONF_DOWNLOAD_DIR="$SMARTDNS_CONF_DIR/conf.d"
|
||||
SMARTDNS_DOMAIN_LIST_DOWNLOAD_DIR="$SMARTDNS_CONF_DIR/domain-set"
|
||||
|
||||
@@ -18,7 +18,10 @@
|
||||
SMARTDNS_BIN=/opt/usr/sbin/smartdns
|
||||
SMARTDNS_CONF=/opt/etc/smartdns/smartdns.conf
|
||||
DNSMASQ_CONF="/etc/dnsmasq.conf /var/etc/dnsmasq.conf /etc/storage/dnsmasq/dnsmasq.conf"
|
||||
SMARTDNS_PID=/var/run/smartdns.pid
|
||||
SMARTDNS_PID=/run/smartdns.pid
|
||||
if [ ! -d "/run" ]; then
|
||||
SMARTDNS_PID=/var/run/smartdns.pid
|
||||
fi
|
||||
SMARTDNS_PORT=535
|
||||
SMARTDNS_OPT=/opt/etc/smartdns/smartdns-opt.conf
|
||||
# workmode
|
||||
|
||||
@@ -47,7 +47,8 @@
|
||||
#include <ucontext.h>
|
||||
|
||||
#define MAX_KEY_LEN 64
|
||||
#define SMARTDNS_PID_FILE "/var/run/smartdns.pid"
|
||||
#define SMARTDNS_PID_FILE "/run/smartdns.pid"
|
||||
#define SMARTDNS_LEGACY_PID_FILE "/var/run/smartdns.pid"
|
||||
#define TMP_BUFF_LEN_32 32
|
||||
|
||||
static int verbose_screen;
|
||||
@@ -696,9 +697,15 @@ int main(int argc, char *argv[])
|
||||
char pid_file[MAX_LINE_LEN];
|
||||
int signal_ignore = 0;
|
||||
sigset_t empty_sigblock;
|
||||
struct stat sb;
|
||||
|
||||
safe_strncpy(config_file, SMARTDNS_CONF_FILE, MAX_LINE_LEN);
|
||||
|
||||
if (stat("/run", &sb) == 0 && S_ISDIR(sb.st_mode)) {
|
||||
safe_strncpy(pid_file, SMARTDNS_PID_FILE, MAX_LINE_LEN);
|
||||
} else {
|
||||
safe_strncpy(pid_file, SMARTDNS_LEGACY_PID_FILE, MAX_LINE_LEN);
|
||||
}
|
||||
|
||||
/* patch for Asus router: unblock all signal*/
|
||||
sigemptyset(&empty_sigblock);
|
||||
|
||||
Reference in New Issue
Block a user