The main sweep — ~260 call sites across ~100 files move from string
concatenation on a single root to appDir/storageAppDirs/storageAppConfigs.
On a single-root install the resolved paths are identical, so this is a
no-op until a location is registered.
Enumerators were the interesting half. `for d in "$containers_dir"/*/`
appears in the menus, the registry/artifact scanners and the DNS setup —
and a shell glob cannot list a rootless 751 tree at all, which is the
same bug config_find_file.sh already documents in a comment. Routing them
through storageAppDirs (which enumerates as the owning user) fixes that
alongside the multi-root work.
Three places needed judgement rather than substitution:
db_app_scan.sh deletes database rows and port allocations for apps whose
folder is missing, and reaps "empty" app dirs. With a storage location
unmounted, every app on it looks exactly like that. Each of those
branches now gates on appStorageAvailable first — an app on an unplugged
drive is skipped with a notice, never deleted.
instance_create.sh rewrites cloned hooks so an instance touches its own
directory instead of the base app's. Its sed matched ${containers_dir}<type>,
which this sweep just replaced with $(appDir <type>) — so it would have
silently stopped redirecting, and an instance would have written to the
original's files (the adguard auth adapter case its own comment warns
about). Now matches both appDir forms, verified against bare, quoted,
unrelated-app, legacy and prose cases.
peer_shell/peer_pull streamed and extracted relative to the primary root.
Both now use the app's own root, and peer_shell keeps a single-root
fallback since it runs as a restricted SSH shell with no LibrePortal env.
Also fixes a pre-existing bug found on the way: webui_app_config.sh
tested "$containers_dir/frontend/data/last_update", one level short of the
real tree under the libreportal app dir, so the WebUI refresh trigger
after a config update has never once fired.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
63 lines
2.1 KiB
Bash
Executable File
63 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
editAppConfig()
|
|
{
|
|
local app_name="$1"
|
|
local config_file
|
|
local app_dir
|
|
|
|
if [[ "$app_name" == "" ]]; then
|
|
isError " app_name is required"
|
|
exit 1
|
|
fi
|
|
|
|
# Use find to search for the app_name folder within $containers_dir
|
|
local app_dir=$(appDir "$app_name")
|
|
|
|
if [ -n "$app_dir" ]; then
|
|
local config_file="$app_dir/$app_name.config"
|
|
|
|
if [ -f "$config_file" ]; then
|
|
# Calculate the checksum of the original file
|
|
local original_checksum=$(md5sum "$config_file")
|
|
|
|
# Open the file with $CFG_TEXT_EDITOR for editing
|
|
$CFG_TEXT_EDITOR "$config_file"
|
|
|
|
# Calculate the checksum of the edited file
|
|
local edited_checksum=$(md5sum "$config_file")
|
|
|
|
# Compare the checksums to check if changes were made
|
|
if [[ "$original_checksum" != "$edited_checksum" ]]; then
|
|
source $config_file
|
|
#cat $config_file
|
|
# Ask the user if they want to reinstall the application
|
|
isHeader "App Config Changes Found"
|
|
while true; do
|
|
echo ""
|
|
isNotice "Changes have been made to the $app_name configuration."
|
|
echo ""
|
|
isQuestion "Would you like to reinstall $app_name? (y/n): "
|
|
read -p "" reinstall_choice
|
|
if [[ -n "$reinstall_choice" ]]; then
|
|
break
|
|
fi
|
|
isNotice "Please provide a valid input."
|
|
done
|
|
if [[ "$reinstall_choice" =~ [yY] ]]; then
|
|
# Run to see if edits have removed any variables
|
|
checkConfigFilesMissingVariables;
|
|
# Convert the first letter of app_name to uppercase
|
|
dockerInstallApp $app_name;
|
|
fi
|
|
else
|
|
isNotice "No changes were made to the $app_name configuration."
|
|
fi
|
|
else
|
|
echo "Config file not found for $app_name."
|
|
fi
|
|
else
|
|
echo "App folder not found for $app_name."
|
|
fi
|
|
}
|