refactor(headscale): flatten + move headscale into its app folder

Move the whole central scripts/headscale/ tree into containers/headscale/, the
last app-specific dir living centrally:

- 11 sourced function files (incl. the former local/ remote/ subdirs) flattened
  into containers/headscale/scripts/ — flat because the container scan is
  maxdepth 3, so one subfolder level is the limit; basenames already encode the
  local/remote distinction.
- tailscale.sh is a CONTAINER PAYLOAD (ends in a bare `install_tailscale` call,
  runs apt/curl) — it must never be sourced into the manager, so it goes to
  containers/headscale/resources/ (pruned by the scan), NOT scripts/. Verified
  install_tailscale does not leak into the runtime after sourcing.
- Fix tailscaleInstallToContainer to copy the payload from its new resources/
  path (it previously referenced ${install_scripts_dir}tailscale.sh, which never
  matched the file's actual location) and drop the dead commented docker-cp line.
- Remove the now-moot headscale special-case from generate_arrays.sh; regenerate
  (files_headscale.sh drops — headscale is fully container-scanned now).

All 11 functions source + define cleanly; callers resolve by name regardless of
location.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
librelad 2026-05-26 00:00:55 +01:00
parent 727734dbfa
commit 3e10dc99b4
15 changed files with 1 additions and 32 deletions

View File

@ -8,13 +8,11 @@ tailscaleInstallToContainer()
local result=$(createFolders "loud" $docker_install_user $containers_dir$app_name/tailscale) local result=$(createFolders "loud" $docker_install_user $containers_dir$app_name/tailscale)
checkSuccess "Creating Tailscale folder" checkSuccess "Creating Tailscale folder"
copyFile "loud" "${install_scripts_dir}tailscale.sh" "$containers_dir$app_name/tailscale/tailscale.sh" $docker_install_user | runInstallWrite -a "$logs_dir/$docker_log_file" 2>&1 copyFile "loud" "${install_containers_dir}headscale/resources/tailscale.sh" "$containers_dir$app_name/tailscale/tailscale.sh" $docker_install_user | runInstallWrite -a "$logs_dir/$docker_log_file" 2>&1
if [[ "$type" != "install" ]]; then if [[ "$type" != "install" ]]; then
dockerComposeRestart $app_name; dockerComposeRestart $app_name;
fi fi
#dockerCommandRun "docker cp ${install_scripts_dir}tailscale.sh $app_name:/usr/local/bin/tailscale.sh"
#checkSuccess "Installing Tailscale installer script into the $app_name container"
dockerCommandRun "docker exec -it $app_name /usr/local/bin/tailscale.sh" dockerCommandRun "docker exec -it $app_name /usr/local/bin/tailscale.sh"
checkSuccess "Executing Tailscale installer script in the $app_name container" checkSuccess "Executing Tailscale installer script in the $app_name container"

View File

@ -1,19 +0,0 @@
#!/bin/bash
# This file is auto-generated by generate_arrays.sh
# Do not edit manually - run './scripts/source/files/generate_arrays.sh run' to regenerate
headscale_scripts=(
"headscale/headscale_commands.sh"
"headscale/headscale_edit_config.sh"
"headscale/headscale_setup.sh"
"headscale/headscale_user.sh"
"headscale/local/headscale_generate_auth.sh"
"headscale/local/headscale_get_hostname.sh"
"headscale/local/headscale_setup_localhost.sh"
"headscale/local/headscale_setup_local.sh"
"headscale/remote/headscale_check_remote.sh"
"headscale/remote/headscale_setup_remote.sh"
"headscale/tailscale/tailscale_install.sh"
)

View File

@ -14,7 +14,6 @@ source_scripts=(
"source/files/arrays/files_database.sh" "source/files/arrays/files_database.sh"
"source/files/arrays/files_docker.sh" "source/files/arrays/files_docker.sh"
"source/files/arrays/files_function.sh" "source/files/arrays/files_function.sh"
"source/files/arrays/files_headscale.sh"
"source/files/arrays/files_install.sh" "source/files/arrays/files_install.sh"
"source/files/arrays/files_logs.sh" "source/files/arrays/files_logs.sh"
"source/files/arrays/files_menu.sh" "source/files/arrays/files_menu.sh"

View File

@ -111,15 +111,6 @@ EOF
esac esac
fi fi
# Skip specific files for headscale folder
if [ "$folder_name" = "headscale" ]; then
case "$rel_path" in
"headscale/tailscale/tailscale.sh")
continue
;;
esac
fi
# Escape quotes and add to array # Escape quotes and add to array
echo " \"$rel_path\"" >> "$array_file" echo " \"$rel_path\"" >> "$array_file"
done done