refactor(wireguard): inline the host-conflict guard, drop central allowed_install

dockerCheckAllowedInstall was a one-app `case` whose only active caller was the
wireguard app itself — so inline its check (abort if a host WireGuard exists at
/etc/wireguard/params, which would collide on the wg kernel module + UDP 51820)
directly into containers/wireguard/wireguard.sh and delete
scripts/docker/app/checks/allowed_install.sh.

The protection is unchanged; wireguard is now fully self-contained and the last
app name leaves central install code. Regenerated arrays. (The only remaining
dockerCheckAllowedInstall references are in scripts/unused/ — retired apps,
never sourced.)

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 01:21:08 +01:00
parent 3f0f22cedb
commit 7f797273dd
3 changed files with 9 additions and 41 deletions

View File

@ -37,7 +37,15 @@ installWireguard()
echo "---- $menu_number. Checking if $app_name can be installed."
echo ""
dockerCheckAllowedInstall "$app_name" || return 1
# Host-conflict guard: a host-level WireGuard (e.g. the angristan
# wireguard-install script — marker /etc/wireguard/params) collides with
# this container on the wg kernel module + UDP 51820. Abort if present.
if [[ -e /etc/wireguard/params ]]; then
isError "WireGuard is already installed on the host — this conflicts with the $app_name app."
isError "Installation is now aborting..."
dockerUninstallApp "$app_name"
return 1
fi
((menu_number++))
echo ""

View File

@ -1,39 +0,0 @@
#!/bin/bash
dockerCheckAllowedInstall()
{
local app_name="$1"
#if [ "$status" == "installed" ]; then
#elif [ "$status" == "running" ]; then
#elif [ "$status" == "not_installed" ]; then
#elif [ "$status" == "invalid_flag" ]; then
case "$app_name" in
"wireguard")
# Check if WireGuard is already installed and load params
if [[ -e /etc/wireguard/params ]]; then
isError "WireGuard is installed, this will conflict with $app_name."
isError "Installation is now aborting..."
dockerUninstallApp "$app_name"
return 1
fi
;;
#"mailcow")
#local status=$(dockerCheckAppInstalled "webmin" "linux" "check_active")
#if [ "$status" == "installed" ]; then
#isError "Virtualmin is installed, this will conflict with $app_name."
#isError "Installation is now aborting..."
#dockerUninstallApp "$app_name"
#elif [ "$status" == "running" ]; then
#isError "Virtualmin is installed, this will conflict with $app_name."
#isError "Installation is now aborting..."
#dockerUninstallApp "$app_name"
#fi
#;;
esac
isSuccessful "Application is allowed to be installed."
}

View File

@ -4,7 +4,6 @@
# Do not edit manually - run './scripts/source/files/generate_arrays.sh run' to regenerate
docker_scripts=(
"docker/app/checks/allowed_install.sh"
"docker/app/checks/app_installed.sh"
"docker/app/checks/container_health_loop.sh"
"docker/app/checks/container_health.sh"