Merge claude/2
This commit is contained in:
commit
b9d9d88552
@ -40,6 +40,11 @@ dockerConfigSetupToContainer()
|
|||||||
mv "$temp_file" "$target_file"
|
mv "$temp_file" "$target_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# The compose file bind-mounts this config as a FILE. If the container ever
|
||||||
|
# started before it landed, Docker left a directory here — clear it before the
|
||||||
|
# copy, or the config gets written inside it and the app boots on a directory.
|
||||||
|
repairStubDirForFile "$target_path/$config_file" "$silent_flag"
|
||||||
|
|
||||||
if [ ! -f "$target_path/$config_file" ]; then
|
if [ ! -f "$target_path/$config_file" ]; then
|
||||||
if [ "$silent_flag" == "loud" ]; then
|
if [ "$silent_flag" == "loud" ]; then
|
||||||
isNotice "Copying config file to '$target_path/$config_file'..."
|
isNotice "Copying config file to '$target_path/$config_file'..."
|
||||||
@ -68,9 +73,10 @@ dockerConfigSetupToContainer()
|
|||||||
|
|
||||||
fixConfigPermissions $silent_flag $app_name;
|
fixConfigPermissions $silent_flag $app_name;
|
||||||
|
|
||||||
# Check if the file exists
|
# Must be a regular file, not just present: a Docker-created bind-mount
|
||||||
if [ ! -e "$target_path/$config_file" ]; then
|
# directory satisfies -e and -r but makes the container exit on boot.
|
||||||
isError "File $target_path/$config_file does not exist"
|
if [ ! -f "$target_path/$config_file" ]; then
|
||||||
|
isError "File $target_path/$config_file does not exist, or is not a regular file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the user has read permission on target_path/config_file
|
# Check if the user has read permission on target_path/config_file
|
||||||
|
|||||||
@ -26,3 +26,41 @@ copyFile()
|
|||||||
$op cp $flags_full "$file" "$save_dir" >/dev/null 2>&1
|
$op cp $flags_full "$file" "$save_dir" >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Docker materialises a missing bind-mount source as an empty DIRECTORY when the
|
||||||
|
# container starts. Where the mount is a FILE (an app's <app>.config), that
|
||||||
|
# directory is self-perpetuating: tar extraction fails with "Cannot open: File
|
||||||
|
# exists", `cp` drops the real file INSIDE it, `-e`/`-r` checks still pass, and
|
||||||
|
# the container reads a directory (EISDIR) and exits on boot.
|
||||||
|
# Restore the regular file: promote a same-named file from inside the stub if the
|
||||||
|
# copy already landed there, then drop the stub. Returns non-zero if the path is
|
||||||
|
# still a directory afterwards.
|
||||||
|
repairStubDirForFile()
|
||||||
|
{
|
||||||
|
local target="$1"
|
||||||
|
local silent_flag="${2:-silent}"
|
||||||
|
|
||||||
|
[[ -d "$target" ]] || return 0
|
||||||
|
|
||||||
|
local op="runInstallOp"
|
||||||
|
[[ "$target" == "$containers_dir"* || "$target" == "${LP_CONTAINERS_DIR:-/libreportal-containers}"/* ]] && op="runFileOp"
|
||||||
|
|
||||||
|
local name; name=$(basename "$target")
|
||||||
|
local staged="$target.stub-repair.$$"
|
||||||
|
|
||||||
|
if [[ -f "$target/$name" ]]; then
|
||||||
|
$op cp -f "$target/$name" "$staged" >/dev/null 2>&1
|
||||||
|
$op rm -rf "$target" >/dev/null 2>&1
|
||||||
|
$op mv "$staged" "$target" >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
$op rm -rf "$target" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -d "$target" ]]; then
|
||||||
|
isNotice "Could not repair '$target' — it is a directory where a file is required."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ "$silent_flag" == "loud" ]] && isNotice "Repaired '$name' (Docker had created it as a bind-mount directory)."
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|||||||
@ -761,6 +761,7 @@ declare -gA LP_FN_MAP=(
|
|||||||
[repairDirectoryStructure]="task/crontab_check_processor.sh"
|
[repairDirectoryStructure]="task/crontab_check_processor.sh"
|
||||||
[repairFileSystem]="task/crontab_check_processor.sh"
|
[repairFileSystem]="task/crontab_check_processor.sh"
|
||||||
[repairPermissions]="task/crontab_check_processor.sh"
|
[repairPermissions]="task/crontab_check_processor.sh"
|
||||||
|
[repairStubDirForFile]="function/file/copy_file.sh"
|
||||||
[repairSystemIssues]="task/crontab_check_processor.sh"
|
[repairSystemIssues]="task/crontab_check_processor.sh"
|
||||||
[repairSystemService]="task/crontab_check_processor.sh"
|
[repairSystemService]="task/crontab_check_processor.sh"
|
||||||
[repairTaskSystem]="task/crontab_check_processor.sh"
|
[repairTaskSystem]="task/crontab_check_processor.sh"
|
||||||
@ -911,11 +912,23 @@ declare -gA LP_FN_MAP=(
|
|||||||
[updateDockerSudoPassword]="docker/update_docker_sudo_pass.sh"
|
[updateDockerSudoPassword]="docker/update_docker_sudo_pass.sh"
|
||||||
[updateFileOwnership]="function/permission/ownership/file.sh"
|
[updateFileOwnership]="function/permission/ownership/file.sh"
|
||||||
[updateHostIPToWhitelist]="config/utils/update_whitelist.sh"
|
[updateHostIPToWhitelist]="config/utils/update_whitelist.sh"
|
||||||
|
[updaterAllServiceImages]="webui/data/generators/updater/webui_updater_scan.sh"
|
||||||
[updaterApplyAll]="cli/commands/updater/cli_updater_commands.sh"
|
[updaterApplyAll]="cli/commands/updater/cli_updater_commands.sh"
|
||||||
[updaterApplyApp]="cli/commands/updater/cli_updater_commands.sh"
|
[updaterApplyApp]="cli/commands/updater/cli_updater_commands.sh"
|
||||||
|
[updaterClassifyTag]="webui/data/generators/updater/webui_updater_scan.sh"
|
||||||
|
[_updaterCleanImageRef]="webui/data/generators/updater/webui_updater_scan.sh"
|
||||||
[updaterComposePull]="cli/commands/updater/cli_updater_commands.sh"
|
[updaterComposePull]="cli/commands/updater/cli_updater_commands.sh"
|
||||||
|
[updaterDisplayVersion]="webui/data/generators/updater/webui_updater_scan.sh"
|
||||||
|
[updaterInspectLocal]="webui/data/generators/updater/webui_updater_scan.sh"
|
||||||
|
[updaterLastUpdateFrom]="cli/commands/updater/cli_updater_commands.sh"
|
||||||
|
[updaterPrimaryImage]="webui/data/generators/updater/webui_updater_scan.sh"
|
||||||
[updaterRecordHistory]="cli/commands/updater/cli_updater_commands.sh"
|
[updaterRecordHistory]="cli/commands/updater/cli_updater_commands.sh"
|
||||||
|
[updaterRefDigest]="cli/commands/updater/cli_updater_commands.sh"
|
||||||
|
[updaterRegistryDigest]="webui/data/generators/updater/webui_updater_scan.sh"
|
||||||
|
[updaterRepoTag]="webui/data/generators/updater/webui_updater_scan.sh"
|
||||||
[updaterRollbackApp]="cli/commands/updater/cli_updater_commands.sh"
|
[updaterRollbackApp]="cli/commands/updater/cli_updater_commands.sh"
|
||||||
|
[updaterSetAnchorRef]="cli/commands/updater/cli_updater_commands.sh"
|
||||||
|
[updaterTagOf]="webui/data/generators/updater/webui_updater_scan.sh"
|
||||||
[updateTaskFields]="task/crontab_task_processor.sh"
|
[updateTaskFields]="task/crontab_task_processor.sh"
|
||||||
[userExists]="function/checks/user_exists.sh"
|
[userExists]="function/checks/user_exists.sh"
|
||||||
[validateContainerHealth]="task/crontab_check_processor.sh"
|
[validateContainerHealth]="task/crontab_check_processor.sh"
|
||||||
@ -1753,6 +1766,7 @@ declare -gA LP_FN_ROOT=(
|
|||||||
[repairDirectoryStructure]="scripts"
|
[repairDirectoryStructure]="scripts"
|
||||||
[repairFileSystem]="scripts"
|
[repairFileSystem]="scripts"
|
||||||
[repairPermissions]="scripts"
|
[repairPermissions]="scripts"
|
||||||
|
[repairStubDirForFile]="scripts"
|
||||||
[repairSystemIssues]="scripts"
|
[repairSystemIssues]="scripts"
|
||||||
[repairSystemService]="scripts"
|
[repairSystemService]="scripts"
|
||||||
[repairTaskSystem]="scripts"
|
[repairTaskSystem]="scripts"
|
||||||
@ -1903,11 +1917,23 @@ declare -gA LP_FN_ROOT=(
|
|||||||
[updateDockerSudoPassword]="scripts"
|
[updateDockerSudoPassword]="scripts"
|
||||||
[updateFileOwnership]="scripts"
|
[updateFileOwnership]="scripts"
|
||||||
[updateHostIPToWhitelist]="scripts"
|
[updateHostIPToWhitelist]="scripts"
|
||||||
|
[updaterAllServiceImages]="scripts"
|
||||||
[updaterApplyAll]="scripts"
|
[updaterApplyAll]="scripts"
|
||||||
[updaterApplyApp]="scripts"
|
[updaterApplyApp]="scripts"
|
||||||
|
[updaterClassifyTag]="scripts"
|
||||||
|
[_updaterCleanImageRef]="scripts"
|
||||||
[updaterComposePull]="scripts"
|
[updaterComposePull]="scripts"
|
||||||
|
[updaterDisplayVersion]="scripts"
|
||||||
|
[updaterInspectLocal]="scripts"
|
||||||
|
[updaterLastUpdateFrom]="scripts"
|
||||||
|
[updaterPrimaryImage]="scripts"
|
||||||
[updaterRecordHistory]="scripts"
|
[updaterRecordHistory]="scripts"
|
||||||
|
[updaterRefDigest]="scripts"
|
||||||
|
[updaterRegistryDigest]="scripts"
|
||||||
|
[updaterRepoTag]="scripts"
|
||||||
[updaterRollbackApp]="scripts"
|
[updaterRollbackApp]="scripts"
|
||||||
|
[updaterSetAnchorRef]="scripts"
|
||||||
|
[updaterTagOf]="scripts"
|
||||||
[updateTaskFields]="scripts"
|
[updateTaskFields]="scripts"
|
||||||
[userExists]="scripts"
|
[userExists]="scripts"
|
||||||
[validateContainerHealth]="scripts"
|
[validateContainerHealth]="scripts"
|
||||||
@ -2778,6 +2804,7 @@ removeEmptyLineAtFileEnd() { unset -f removeEmptyLineAtFileEnd; __lpAutoload "${
|
|||||||
repairDirectoryStructure() { unset -f repairDirectoryStructure; __lpAutoload "${install_scripts_dir}task/crontab_check_processor.sh"; repairDirectoryStructure "$@"; }
|
repairDirectoryStructure() { unset -f repairDirectoryStructure; __lpAutoload "${install_scripts_dir}task/crontab_check_processor.sh"; repairDirectoryStructure "$@"; }
|
||||||
repairFileSystem() { unset -f repairFileSystem; __lpAutoload "${install_scripts_dir}task/crontab_check_processor.sh"; repairFileSystem "$@"; }
|
repairFileSystem() { unset -f repairFileSystem; __lpAutoload "${install_scripts_dir}task/crontab_check_processor.sh"; repairFileSystem "$@"; }
|
||||||
repairPermissions() { unset -f repairPermissions; __lpAutoload "${install_scripts_dir}task/crontab_check_processor.sh"; repairPermissions "$@"; }
|
repairPermissions() { unset -f repairPermissions; __lpAutoload "${install_scripts_dir}task/crontab_check_processor.sh"; repairPermissions "$@"; }
|
||||||
|
repairStubDirForFile() { unset -f repairStubDirForFile; __lpAutoload "${install_scripts_dir}function/file/copy_file.sh"; repairStubDirForFile "$@"; }
|
||||||
repairSystemIssues() { unset -f repairSystemIssues; __lpAutoload "${install_scripts_dir}task/crontab_check_processor.sh"; repairSystemIssues "$@"; }
|
repairSystemIssues() { unset -f repairSystemIssues; __lpAutoload "${install_scripts_dir}task/crontab_check_processor.sh"; repairSystemIssues "$@"; }
|
||||||
repairSystemService() { unset -f repairSystemService; __lpAutoload "${install_scripts_dir}task/crontab_check_processor.sh"; repairSystemService "$@"; }
|
repairSystemService() { unset -f repairSystemService; __lpAutoload "${install_scripts_dir}task/crontab_check_processor.sh"; repairSystemService "$@"; }
|
||||||
repairTaskSystem() { unset -f repairTaskSystem; __lpAutoload "${install_scripts_dir}task/crontab_check_processor.sh"; repairTaskSystem "$@"; }
|
repairTaskSystem() { unset -f repairTaskSystem; __lpAutoload "${install_scripts_dir}task/crontab_check_processor.sh"; repairTaskSystem "$@"; }
|
||||||
@ -2928,11 +2955,23 @@ updateDockerNetworkSubnet() { unset -f updateDockerNetworkSubnet; __lpAutoload "
|
|||||||
updateDockerSudoPassword() { unset -f updateDockerSudoPassword; __lpAutoload "${install_scripts_dir}docker/update_docker_sudo_pass.sh"; updateDockerSudoPassword "$@"; }
|
updateDockerSudoPassword() { unset -f updateDockerSudoPassword; __lpAutoload "${install_scripts_dir}docker/update_docker_sudo_pass.sh"; updateDockerSudoPassword "$@"; }
|
||||||
updateFileOwnership() { unset -f updateFileOwnership; __lpAutoload "${install_scripts_dir}function/permission/ownership/file.sh"; updateFileOwnership "$@"; }
|
updateFileOwnership() { unset -f updateFileOwnership; __lpAutoload "${install_scripts_dir}function/permission/ownership/file.sh"; updateFileOwnership "$@"; }
|
||||||
updateHostIPToWhitelist() { unset -f updateHostIPToWhitelist; __lpAutoload "${install_scripts_dir}config/utils/update_whitelist.sh"; updateHostIPToWhitelist "$@"; }
|
updateHostIPToWhitelist() { unset -f updateHostIPToWhitelist; __lpAutoload "${install_scripts_dir}config/utils/update_whitelist.sh"; updateHostIPToWhitelist "$@"; }
|
||||||
|
updaterAllServiceImages() { unset -f updaterAllServiceImages; __lpAutoload "${install_scripts_dir}webui/data/generators/updater/webui_updater_scan.sh"; updaterAllServiceImages "$@"; }
|
||||||
updaterApplyAll() { unset -f updaterApplyAll; __lpAutoload "${install_scripts_dir}cli/commands/updater/cli_updater_commands.sh"; updaterApplyAll "$@"; }
|
updaterApplyAll() { unset -f updaterApplyAll; __lpAutoload "${install_scripts_dir}cli/commands/updater/cli_updater_commands.sh"; updaterApplyAll "$@"; }
|
||||||
updaterApplyApp() { unset -f updaterApplyApp; __lpAutoload "${install_scripts_dir}cli/commands/updater/cli_updater_commands.sh"; updaterApplyApp "$@"; }
|
updaterApplyApp() { unset -f updaterApplyApp; __lpAutoload "${install_scripts_dir}cli/commands/updater/cli_updater_commands.sh"; updaterApplyApp "$@"; }
|
||||||
|
updaterClassifyTag() { unset -f updaterClassifyTag; __lpAutoload "${install_scripts_dir}webui/data/generators/updater/webui_updater_scan.sh"; updaterClassifyTag "$@"; }
|
||||||
|
_updaterCleanImageRef() { unset -f _updaterCleanImageRef; __lpAutoload "${install_scripts_dir}webui/data/generators/updater/webui_updater_scan.sh"; _updaterCleanImageRef "$@"; }
|
||||||
updaterComposePull() { unset -f updaterComposePull; __lpAutoload "${install_scripts_dir}cli/commands/updater/cli_updater_commands.sh"; updaterComposePull "$@"; }
|
updaterComposePull() { unset -f updaterComposePull; __lpAutoload "${install_scripts_dir}cli/commands/updater/cli_updater_commands.sh"; updaterComposePull "$@"; }
|
||||||
|
updaterDisplayVersion() { unset -f updaterDisplayVersion; __lpAutoload "${install_scripts_dir}webui/data/generators/updater/webui_updater_scan.sh"; updaterDisplayVersion "$@"; }
|
||||||
|
updaterInspectLocal() { unset -f updaterInspectLocal; __lpAutoload "${install_scripts_dir}webui/data/generators/updater/webui_updater_scan.sh"; updaterInspectLocal "$@"; }
|
||||||
|
updaterLastUpdateFrom() { unset -f updaterLastUpdateFrom; __lpAutoload "${install_scripts_dir}cli/commands/updater/cli_updater_commands.sh"; updaterLastUpdateFrom "$@"; }
|
||||||
|
updaterPrimaryImage() { unset -f updaterPrimaryImage; __lpAutoload "${install_scripts_dir}webui/data/generators/updater/webui_updater_scan.sh"; updaterPrimaryImage "$@"; }
|
||||||
updaterRecordHistory() { unset -f updaterRecordHistory; __lpAutoload "${install_scripts_dir}cli/commands/updater/cli_updater_commands.sh"; updaterRecordHistory "$@"; }
|
updaterRecordHistory() { unset -f updaterRecordHistory; __lpAutoload "${install_scripts_dir}cli/commands/updater/cli_updater_commands.sh"; updaterRecordHistory "$@"; }
|
||||||
|
updaterRefDigest() { unset -f updaterRefDigest; __lpAutoload "${install_scripts_dir}cli/commands/updater/cli_updater_commands.sh"; updaterRefDigest "$@"; }
|
||||||
|
updaterRegistryDigest() { unset -f updaterRegistryDigest; __lpAutoload "${install_scripts_dir}webui/data/generators/updater/webui_updater_scan.sh"; updaterRegistryDigest "$@"; }
|
||||||
|
updaterRepoTag() { unset -f updaterRepoTag; __lpAutoload "${install_scripts_dir}webui/data/generators/updater/webui_updater_scan.sh"; updaterRepoTag "$@"; }
|
||||||
updaterRollbackApp() { unset -f updaterRollbackApp; __lpAutoload "${install_scripts_dir}cli/commands/updater/cli_updater_commands.sh"; updaterRollbackApp "$@"; }
|
updaterRollbackApp() { unset -f updaterRollbackApp; __lpAutoload "${install_scripts_dir}cli/commands/updater/cli_updater_commands.sh"; updaterRollbackApp "$@"; }
|
||||||
|
updaterSetAnchorRef() { unset -f updaterSetAnchorRef; __lpAutoload "${install_scripts_dir}cli/commands/updater/cli_updater_commands.sh"; updaterSetAnchorRef "$@"; }
|
||||||
|
updaterTagOf() { unset -f updaterTagOf; __lpAutoload "${install_scripts_dir}webui/data/generators/updater/webui_updater_scan.sh"; updaterTagOf "$@"; }
|
||||||
updateTaskFields() { unset -f updateTaskFields; __lpAutoload "${install_scripts_dir}task/crontab_task_processor.sh"; updateTaskFields "$@"; }
|
updateTaskFields() { unset -f updateTaskFields; __lpAutoload "${install_scripts_dir}task/crontab_task_processor.sh"; updateTaskFields "$@"; }
|
||||||
userExists() { unset -f userExists; __lpAutoload "${install_scripts_dir}function/checks/user_exists.sh"; userExists "$@"; }
|
userExists() { unset -f userExists; __lpAutoload "${install_scripts_dir}function/checks/user_exists.sh"; userExists "$@"; }
|
||||||
validateContainerHealth() { unset -f validateContainerHealth; __lpAutoload "${install_scripts_dir}task/crontab_check_processor.sh"; validateContainerHealth "$@"; }
|
validateContainerHealth() { unset -f validateContainerHealth; __lpAutoload "${install_scripts_dir}task/crontab_check_processor.sh"; validateContainerHealth "$@"; }
|
||||||
|
|||||||
@ -13,6 +13,12 @@ installLibrePortalImageWebUI()
|
|||||||
# Establish traversal + containers-root ownership FIRST.
|
# Establish traversal + containers-root ownership FIRST.
|
||||||
fixFolderPermissions
|
fixFolderPermissions
|
||||||
|
|
||||||
|
# A previous run that started the container before its config landed leaves
|
||||||
|
# libreportal.config as a Docker-created directory. The tar copy below can't
|
||||||
|
# extract a file over a directory ("Cannot open: File exists") and aborts the
|
||||||
|
# whole source copy, so clear the stub first.
|
||||||
|
repairStubDirForFile "$containers_dir/libreportal/libreportal.config" "loud"
|
||||||
|
|
||||||
local result; result=$(copyFolder "$install_containers_dir/libreportal" "$containers_dir" "$sudo_user_name")
|
local result; result=$(copyFolder "$install_containers_dir/libreportal" "$containers_dir" "$sudo_user_name")
|
||||||
checkSuccess "Copy the LibrePortal to the containers folder"
|
checkSuccess "Copy the LibrePortal to the containers folder"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user