mirror of
https://abf.rosa.ru/djam/dnscrypt-proxy.git
synced 2025-02-24 00:52:55 +00:00
Fixed start service dnscrypt-proxy.service
This commit is contained in:
parent
ec87fa1a12
commit
588c6e1b78
2 changed files with 4 additions and 103 deletions
|
@ -1,93 +0,0 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: dnscrypt-proxy
|
||||
# Required-Start: $remote_fs
|
||||
# Required-Stop: $remote_fs
|
||||
# Should-Start: $network $syslog
|
||||
# Should-Stop: $network $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start and stop dnscrypt-proxy
|
||||
# Description: dnscrypt-proxy is Domain Name resolver with extra security
|
||||
# features and enhanced privacy.
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
DNSCRYPT_PROXY_BIN=/usr/sbin/dnscrypt-proxy
|
||||
DNSCRYPT_PROXY_USER=_dnscrypt-proxy
|
||||
DNSCRYPT_PROXY_PIDFILE=/run/dnscrypt-proxy.pid
|
||||
DNSCRYPT_PROXY_CONF=/etc/default/dnscrypt-proxy
|
||||
DNSCRYPT_PROXY_HOME=/run/dnscrypt-proxy
|
||||
DNSCRYPT_PROXY_OPTIONS=""
|
||||
DNSCRYPT_PROXY_LOCAL_ADDRESS="127.0.2.1:53"
|
||||
DNSCRYPT_PROXY_RESOLVER_NAME=cisco
|
||||
|
||||
# Exit if the package is not installed
|
||||
[ -x "${DNSCRYPT_PROXY_BIN}" ] || exit 0
|
||||
|
||||
[ -r "${DNSCRYPT_PROXY_CONF}" ] && . "${DNSCRYPT_PROXY_CONF}"
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_daemon_msg "Starting dnscrypt proxy service..." "dnscrypt-proxy"
|
||||
|
||||
[ -d "${DNSCRYPT_PROXY_HOME}" ] || \
|
||||
mkdir -m 0555 "${DNSCRYPT_PROXY_HOME}"
|
||||
|
||||
if start_daemon -p "${DNSCRYPT_PROXY_PIDFILE}" ${DNSCRYPT_PROXY_BIN} \
|
||||
--pidfile "${DNSCRYPT_PROXY_PIDFILE}" \
|
||||
--daemonize \
|
||||
--user="${DNSCRYPT_PROXY_USER}" \
|
||||
--local-address="${DNSCRYPT_PROXY_LOCAL_ADDRESS}" \
|
||||
--resolver-name="${DNSCRYPT_PROXY_RESOLVER_NAME}" \
|
||||
$DNSCRYPT_PROXY_OPTIONS; then
|
||||
if [ -x /sbin/resolvconf ]; then
|
||||
echo "nameserver ${DNSCRYPT_PROXY_LOCAL_ADDRESS}" \
|
||||
| cut -d ':' -f 1 \
|
||||
| /sbin/resolvconf -a lo.dnscrypt-proxy
|
||||
fi
|
||||
log_success_msg
|
||||
else
|
||||
log_failure_msg
|
||||
fi
|
||||
;;
|
||||
|
||||
stop)
|
||||
log_daemon_msg "Stopping dnscrypt proxy service..." "dnscrypt-proxy"
|
||||
|
||||
if [ -x /sbin/resolvconf ]; then
|
||||
/sbin/resolvconf -d lo.dnscrypt-proxy
|
||||
fi
|
||||
|
||||
if killproc -p "${DNSCRYPT_PROXY_PID}" ${DNSCRYPT_PROXY_BIN}
|
||||
then
|
||||
log_success_msg
|
||||
else
|
||||
log_failure_msg
|
||||
fi
|
||||
;;
|
||||
|
||||
restart|force-reload)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
|
||||
status)
|
||||
ret=0
|
||||
status_of_proc -p "${DNSCRYPT_PROXY_PIDFILE}" ${DNSCRYPT_PROXY_BIN} \
|
||||
dnscrypt-proxy 2>/dev/null || ret=$?
|
||||
exit $ret
|
||||
;;
|
||||
|
||||
*)
|
||||
log_action_msg "Usage: /etc/init.d/dnscrypt-proxy {start|stop|restart|force-reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
|
@ -1,7 +1,7 @@
|
|||
Summary: Tool for securing communications between a client and a DNS resolver
|
||||
Name: dnscrypt-proxy
|
||||
Version: 1.9.4
|
||||
Release: 1
|
||||
Release: 2
|
||||
License: BSD
|
||||
Group: Networking/Other
|
||||
Url: http://dnscrypt.org
|
||||
|
@ -10,7 +10,6 @@ Source1: %{name}-resolvconf.service
|
|||
Source2: %{name}.service
|
||||
Source3: %{name}.socket
|
||||
Source4: %{name}-default
|
||||
Source5: %{name}
|
||||
BuildRequires: pkgconfig(libsodium)
|
||||
BuildRequires: pkgconfig(systemd)
|
||||
BuildRequires: gawk
|
||||
|
@ -37,14 +36,12 @@ install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_systemunitdir}/%{name}-resolvcon
|
|||
install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_systemunitdir}/%{name}.service
|
||||
install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_systemunitdir}/%{name}.socket
|
||||
install -D -p -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/default/%{name}
|
||||
install -D -p -m 0755 %{SOURCE5} %{buildroot}%{_sysconfdir}/init.d/%{name}
|
||||
|
||||
%files
|
||||
%{_systemunitdir}/%{name}-resolvconf.service
|
||||
%{_systemunitdir}/%{name}.service
|
||||
%{_systemunitdir}/%{name}.socket
|
||||
%{_sysconfdir}/default/%{name}
|
||||
%{_sysconfdir}/init.d/%{name}
|
||||
%{_sbindir}/%{name}
|
||||
%{_bindir}/hostip
|
||||
%{_mandir}/man8/%{name}.8*
|
||||
|
@ -62,12 +59,9 @@ install -D -p -m 0755 %{SOURCE5} %{buildroot}%{_sysconfdir}/init.d/%{name}
|
|||
# Simple: still needs this since in release 3 services were not set
|
||||
# enabled and seams that still isnt properly handeled in %%_post_service
|
||||
if [ "$1" -ge "1" ]; then
|
||||
echo '#!/bin/sh
|
||||
systemctl start dnscrypt-proxy.service' > /etc/rc.d/rc.local
|
||||
chmod +x /etc/rc.d/rc.local
|
||||
|
||||
ln -s /etc/rc.d/rc.local /etc/rc.local
|
||||
# Start dnscrypt-proxy service
|
||||
# Enable (but don't start) the unit by default
|
||||
/bin/systemctl enable dnscrypt-proxy.service
|
||||
# Start bluetooth service
|
||||
/bin/systemctl start dnscrypt-proxy.service
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue