mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-20 17:52:46 +00:00
Move Synology home-dir to /var/packages/zerotier/var
This commit is contained in:
parent
26dbebbba7
commit
a360416655
@ -114,7 +114,6 @@ REQUIRED_DSM = 6.2.4
|
|||||||
|
|
||||||
ENV += ZT_SYNOLOGY=1
|
ENV += ZT_SYNOLOGY=1
|
||||||
|
|
||||||
SERVICE_SETUP = ../../ztpkg-dsm6/service-setup.sh
|
|
||||||
SSS_SCRIPT = ../../ztpkg-dsm6/start-stop-status.sh
|
SSS_SCRIPT = ../../ztpkg-dsm6/start-stop-status.sh
|
||||||
|
|
||||||
PRE_STRIP_TARGET = zerotier_install
|
PRE_STRIP_TARGET = zerotier_install
|
||||||
|
@ -6,8 +6,6 @@ service_postinst()
|
|||||||
|
|
||||||
service_postuninst()
|
service_postuninst()
|
||||||
{
|
{
|
||||||
# remove all files except for identity files and network config files (for future convenience)
|
|
||||||
find /var/lib/zerotier-one/* -type f -o -type d ! -name 'identity.*' -delete
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,19 +1,15 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -eq "6" ]; then
|
PKGVAR=/var/packages/zerotier/var
|
||||||
PKGDIR="/var/packages/zerotier/var"
|
|
||||||
else
|
|
||||||
PKGDIR="${SYNOPKG_PKGVAR}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ZTO_PID_FILE="${PKGDIR}/zerotier-one.pid"
|
ZTO_PID_FILE="$PKGVAR/zerotier-one.pid"
|
||||||
WAT_PID_FILE="${PKGDIR}/zerotier-watchdog.pid"
|
WAT_PID_FILE="$PKGVAR/zerotier-watchdog.pid"
|
||||||
ZTO_LOG_FILE="${PKGDIR}/zerotier-one.log"
|
ZTO_LOG_FILE="$PKGVAR/zerotier-one.log"
|
||||||
|
|
||||||
log()
|
log()
|
||||||
{
|
{
|
||||||
local timestamp=$(date --iso-8601=second)
|
local timestamp=$(date --iso-8601=second)
|
||||||
echo "${timestamp} $1" >> ${ZTO_LOG_FILE}
|
echo "$timestamp $1" >> $ZTO_LOG_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_tun()
|
configure_tun()
|
||||||
@ -40,13 +36,13 @@ configure_cli()
|
|||||||
{
|
{
|
||||||
# Create ZT CLI symlinks if needed
|
# Create ZT CLI symlinks if needed
|
||||||
mkdir -p /usr/local/bin/
|
mkdir -p /usr/local/bin/
|
||||||
ln -s ${SYNOPKG_PKGDEST}/bin/zerotier-one /usr/local/bin/zerotier-cli
|
ln -s $SYNOPKG_PKGDEST/bin/zerotier-one /usr/local/bin/zerotier-cli
|
||||||
ln -s ${SYNOPKG_PKGDEST}/bin/zerotier-one /usr/local/bin/zerotier-idtool
|
ln -s $SYNOPKG_PKGDEST/bin/zerotier-one /usr/local/bin/zerotier-idtool
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_routes()
|
apply_routes()
|
||||||
{
|
{
|
||||||
echo $BASHPID >> ${WAT_PID_FILE}
|
echo $BASHPID >> $WAT_PID_FILE
|
||||||
log "Started Watchdog ($(cat $WAT_PID_FILE))"
|
log "Started Watchdog ($(cat $WAT_PID_FILE))"
|
||||||
|
|
||||||
# Wait for ZT service to come online before attempting queries
|
# Wait for ZT service to come online before attempting queries
|
||||||
@ -89,20 +85,20 @@ configure_routes()
|
|||||||
|
|
||||||
start_daemon()
|
start_daemon()
|
||||||
{
|
{
|
||||||
${SYNOPKG_PKGDEST}/bin/zerotier-one -d
|
${SYNOPKG_PKGDEST}/bin/zerotier-one $PKGVAR -d
|
||||||
echo $(pidof zerotier-one) > ${ZTO_PID_FILE}
|
echo $(pidof zerotier-one) > ${ZTO_PID_FILE}
|
||||||
log "Started ZeroTier ($(cat $ZTO_PID_FILE))"
|
log "Started ZeroTier ($(cat $ZTO_PID_FILE))"
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_daemon() {
|
stop_daemon() {
|
||||||
if [ -r "${ZTO_PID_FILE}" ]; then
|
if [ -r "$ZTO_PID_FILE" ]; then
|
||||||
local ZTO_PID=$(cat "${ZTO_PID_FILE}")
|
local ZTO_PID=$(cat "${ZTO_PID_FILE}")
|
||||||
log "Stopped ZeroTier ($(cat $ZTO_PID_FILE))"
|
log "Stopped ZeroTier ($(cat $ZTO_PID_FILE))"
|
||||||
kill -TERM $ZTO_PID
|
kill -TERM $ZTO_PID
|
||||||
wait_for_status 1 || kill -KILL $PID >> ${LOG_FILE} 2>&1
|
wait_for_status 1 || kill -KILL $PID >> $LOG_FILE 2>&1
|
||||||
rm -f $ZTO_PID_FILE > /dev/null
|
rm -f $ZTO_PID_FILE > /dev/null
|
||||||
fi
|
fi
|
||||||
if [ -r "${WAT_PID_FILE}" ]; then
|
if [ -r "$WAT_PID_FILE" ]; then
|
||||||
local WAT_PID=$(cat "${WAT_PID_FILE}")
|
local WAT_PID=$(cat "${WAT_PID_FILE}")
|
||||||
log "Stopped Watchdog ($(cat $WAT_PID_FILE))"
|
log "Stopped Watchdog ($(cat $WAT_PID_FILE))"
|
||||||
kill -TERM $WAT_PID
|
kill -TERM $WAT_PID
|
||||||
@ -112,17 +108,17 @@ stop_daemon() {
|
|||||||
|
|
||||||
daemon_status()
|
daemon_status()
|
||||||
{
|
{
|
||||||
if [ -f ${ZTO_PID_FILE} ] && kill -0 `cat ${ZTO_PID_FILE}` > /dev/null 2>&1; then
|
if [ -f $ZTO_PID_FILE ] && kill -0 `cat $ZTO_PID_FILE` > /dev/null 2>&1; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
rm -f ${ZTO_PID_FILE}
|
rm -f $ZTO_PID_FILE
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_for_status()
|
wait_for_status()
|
||||||
{
|
{
|
||||||
counter=$2
|
counter=$2
|
||||||
while [ ${counter} -gt 0 ]; do
|
while [ $counter -gt 0 ]; do
|
||||||
daemon_status
|
daemon_status
|
||||||
[ $? -eq $1 ] && return
|
[ $? -eq $1 ] && return
|
||||||
let counter=counter-1
|
let counter=counter-1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user