mirror of
https://github.com/unraid/webgui.git
synced 2026-05-01 23:39:21 -05:00
Merge pull request #1936 from ich777/patch-1
Change state directory logic & add `root` check
This commit is contained in:
@@ -2448,7 +2448,7 @@ For more details see the <a href="https://tailscale.com/kb/1080/cli#up" target="
|
||||
:end
|
||||
|
||||
:docker_tailscale_statedir_help:
|
||||
If state directory detection fails on startup, you can specify a persistent directory in the container to override automatic detection.
|
||||
If state directory detection fails on startup, you can specify a persistent directory in the container to override automatic detection, i.e. `/container-path/.tailscale_state`
|
||||
:end
|
||||
|
||||
:docker_tailscale_troubleshooting_packages_help:
|
||||
|
||||
@@ -29,6 +29,11 @@ echo
|
||||
echo "Executing Unraid Docker Hook for Tailscale"
|
||||
echo
|
||||
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo "ERROR: No root privileges!"
|
||||
error_handler
|
||||
fi
|
||||
|
||||
if [ ! -f /usr/bin/tailscale ] || [ ! -f /usr/bin/tailscaled ]; then
|
||||
if [ ! -z "${TAILSCALE_EXIT_NODE_IP}" ]; then
|
||||
if [ ! -c /dev/net/tun ]; then
|
||||
@@ -131,20 +136,21 @@ unset TS_PARAMS
|
||||
|
||||
if [ ! -z "${SERVER_DIR}" ]; then
|
||||
TSD_STATE_DIR="${SERVER_DIR}/.tailscale_state"
|
||||
echo "Settings Tailscale state dir to: ${TSD_STATE_DIR}"
|
||||
elif [ ! -z "${DATA_DIR}" ]; then
|
||||
TSD_STATE_DIR="${DATA_DIR}/.tailscale_state"
|
||||
echo "Settings Tailscale state dir to: ${TSD_STATE_DIR}"
|
||||
elif [ ! -z "${USER_HOME}" ]; then
|
||||
TSD_STATE_DIR="${USER_HOME}/.tailscale_state"
|
||||
echo "Settings Tailscale state dir to: ${TSD_STATE_DIR}"
|
||||
elif [ -d "/config" ]; then
|
||||
TSD_STATE_DIR="/config/.tailscale_state"
|
||||
else
|
||||
if [ -z "${TAILSCALE_STATE_DIR}" ]; then
|
||||
TAILSCALE_STATE_DIR="/config/.tailscale_state"
|
||||
echo "ERROR: Couldn't detect persistent Docker directory for .tailscale_state! Enable Tailscale Advanced Settings in the Docker template and set the Tailscale State Directory!"
|
||||
sleep infinity
|
||||
fi
|
||||
TSD_STATE_DIR="${TAILSCALE_STATE_DIR}"
|
||||
echo "Settings Tailscale state dir to: ${TSD_STATE_DIR}"
|
||||
fi
|
||||
echo "Settings Tailscale state dir to: ${TSD_STATE_DIR}"
|
||||
|
||||
if [ ! -d "${TSD_STATE_DIR}" ]; then
|
||||
mkdir -p ${TSD_STATE_DIR}
|
||||
|
||||
Reference in New Issue
Block a user