mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-27 03:55:36 +00:00
0cce456ee5
This change allows for the release/dist/qnap package to be used outside of the tailscale repo (notably, will be used from corp), by using an embedded file system for build files which gets temporarily written to a new folder during qnap build runs. Without this change, when used from corp, the release/dist/qnap folder will fail to be found within the corp repo, causing various steps of the build to fail. The file renames in this change are to combine the build files into a /files folder, separated into /scripts and /Tailscale. Updates tailscale/tailscale-qpkg#135 Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
51 lines
1.3 KiB
Bash
Executable File
51 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
CONF=/etc/config/qpkg.conf
|
|
QPKG_NAME="Tailscale"
|
|
QPKG_ROOT=`/sbin/getcfg ${QPKG_NAME} Install_Path -f ${CONF}`
|
|
QPKG_PORT=`/sbin/getcfg ${QPKG_NAME} Service_Port -f ${CONF}`
|
|
export QNAP_QPKG=${QPKG_NAME}
|
|
set -e
|
|
|
|
case "$1" in
|
|
start)
|
|
ENABLED=$(/sbin/getcfg ${QPKG_NAME} Enable -u -d FALSE -f ${CONF})
|
|
if [ "${ENABLED}" != "TRUE" ]; then
|
|
echo "${QPKG_NAME} is disabled."
|
|
exit 1
|
|
fi
|
|
mkdir -p /home/httpd/cgi-bin/qpkg
|
|
ln -sf ${QPKG_ROOT}/ui /home/httpd/cgi-bin/qpkg/${QPKG_NAME}
|
|
mkdir -p -m 0755 /tmp/tailscale
|
|
if [ -e /tmp/tailscale/tailscaled.pid ]; then
|
|
PID=$(cat /tmp/tailscale/tailscaled.pid)
|
|
if [ -d /proc/${PID}/ ]; then
|
|
echo "${QPKG_NAME} is already running."
|
|
exit 0
|
|
fi
|
|
fi
|
|
${QPKG_ROOT}/tailscaled --port ${QPKG_PORT} --statedir=${QPKG_ROOT}/state --socket=/tmp/tailscale/tailscaled.sock 2> /dev/null &
|
|
echo $! > /tmp/tailscale/tailscaled.pid
|
|
;;
|
|
|
|
stop)
|
|
if [ -e /tmp/tailscale/tailscaled.pid ]; then
|
|
PID=$(cat /tmp/tailscale/tailscaled.pid)
|
|
kill -9 ${PID} || true
|
|
rm -f /tmp/tailscale/tailscaled.pid
|
|
fi
|
|
;;
|
|
|
|
restart)
|
|
$0 stop
|
|
$0 start
|
|
;;
|
|
remove)
|
|
;;
|
|
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|remove}"
|
|
exit 1
|
|
esac
|
|
|
|
exit 0
|