File tree 6 files changed +24
-7
lines changed
6 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ RUN cd /build/smartdns && \
32
32
\
33
33
( cd package && tar -xvf *.tar.gz && chmod a+x smartdns/etc/init.d/smartdns ) && \
34
34
\
35
- mkdir -p /release/var/log /release/var/ run && \
35
+ mkdir -p /release/var/log /release/run && \
36
36
cp package/smartdns/etc /release/ -a && \
37
37
cp package/smartdns/usr /release/ -a && \
38
38
cd / && rm -rf /build
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ DESTDIR :=
18
18
PREFIX := /usr
19
19
SBINDIR := $(PREFIX ) /sbin
20
20
SYSCONFDIR := /etc
21
- RUNSTATEDIR := /var/ run
21
+ RUNSTATEDIR := /run
22
22
SYSTEMDSYSTEMUNITDIR := $(shell ${PKG_CONFIG} --variable=systemdsystemunitdir systemd)
23
23
SMARTDNS_SYSTEMD = systemd/smartdns.service
24
24
Original file line number Diff line number Diff line change @@ -28,7 +28,10 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
28
28
29
29
. /etc/default/smartdns
30
30
SMARTDNS=/usr/sbin/smartdns
31
- PIDFILE=/var/run/smartdns.pid
31
+ PIDFILE=/run/smartdns.pid
32
+ if [ ! -d " /run" ]; then
33
+ PIDFILE=/var/run/smartdns.pid
34
+ fi
32
35
33
36
test -x $SMARTDNS || exit 5
34
37
Original file line number Diff line number Diff line change @@ -22,7 +22,11 @@ USE_PROCD=1
22
22
SERVICE_USE_PID=1
23
23
SERVICE_WRITE_PID=1
24
24
SERVICE_DAEMONIZE=1
25
- SERVICE_PID_FILE=" /var/run/smartdns.pid"
25
+ SERVICE_PID_FILE=" /run/smartdns.pid"
26
+ if [ ! -d " /run" ]; then
27
+ SERVICE_PID_FILE=" /var/run/smartdns.pid"
28
+ fi
29
+
26
30
SMARTDNS_CONF_DIR=" /etc/smartdns"
27
31
SMARTDNS_CONF_DOWNLOAD_DIR=" $SMARTDNS_CONF_DIR /conf.d"
28
32
SMARTDNS_DOMAIN_LIST_DOWNLOAD_DIR=" $SMARTDNS_CONF_DIR /domain-set"
Original file line number Diff line number Diff line change 18
18
SMARTDNS_BIN=/opt/usr/sbin/smartdns
19
19
SMARTDNS_CONF=/opt/etc/smartdns/smartdns.conf
20
20
DNSMASQ_CONF=" /etc/dnsmasq.conf /var/etc/dnsmasq.conf /etc/storage/dnsmasq/dnsmasq.conf"
21
- SMARTDNS_PID=/var/run/smartdns.pid
21
+ SMARTDNS_PID=/run/smartdns.pid
22
+ if [ ! -d " /run" ]; then
23
+ SMARTDNS_PID=/var/run/smartdns.pid
24
+ fi
22
25
SMARTDNS_PORT=535
23
26
SMARTDNS_OPT=/opt/etc/smartdns/smartdns-opt.conf
24
27
# workmode
Original file line number Diff line number Diff line change 47
47
#include <ucontext.h>
48
48
49
49
#define MAX_KEY_LEN 64
50
- #define SMARTDNS_PID_FILE "/var/run/smartdns.pid"
50
+ #define SMARTDNS_PID_FILE "/run/smartdns.pid"
51
+ #define SMARTDNS_LEGACY_PID_FILE "/var/run/smartdns.pid"
51
52
#define TMP_BUFF_LEN_32 32
52
53
53
54
static int verbose_screen ;
@@ -696,9 +697,15 @@ int main(int argc, char *argv[])
696
697
char pid_file [MAX_LINE_LEN ];
697
698
int signal_ignore = 0 ;
698
699
sigset_t empty_sigblock ;
700
+ struct stat sb ;
699
701
700
702
safe_strncpy (config_file , SMARTDNS_CONF_FILE , MAX_LINE_LEN );
701
- safe_strncpy (pid_file , SMARTDNS_PID_FILE , MAX_LINE_LEN );
703
+
704
+ if (stat ("/run" , & sb ) == 0 && S_ISDIR (sb .st_mode )) {
705
+ safe_strncpy (pid_file , SMARTDNS_PID_FILE , MAX_LINE_LEN );
706
+ } else {
707
+ safe_strncpy (pid_file , SMARTDNS_LEGACY_PID_FILE , MAX_LINE_LEN );
708
+ }
702
709
703
710
/* patch for Asus router: unblock all signal*/
704
711
sigemptyset (& empty_sigblock );
You can’t perform that action at this time.
0 commit comments