The task processor is a systemd-service daemon, not a cron job — move it out of the misleadingly-named scripts/crontab/task/ to scripts/task/. To stop the systemd unit from baking the processor's in-tree path (the footprint coupling that forces a reinstall on every reorg), the unit now ExecStarts the stable wrapper: /usr/local/bin/libreportal __task-processor. start.sh intercepts that early (after paths.sh, before the heavy load), exports install_scripts_dir, and exec's the processor with start_script. Future moves/renames need only the one hand-off updated + a regen — no footprint bump. - git mv scripts/crontab/task -> scripts/task (filenames kept; cron-watchdog grep + function names unchanged) - libreportal-svc: ExecStart -> stable wrapper launcher - start.sh: __task-processor internal launcher (export install_scripts_dir; exec) - crontab_task_processor.sh: fix self-location ../.. -> .. for the new 1-level depth (latent bug the move would otherwise have introduced) - regen files_*/function_manifest; add task_scripts to the app/cli aggregates - footprint_version 3 -> 4 (root-owned svc unit changed -> needs a root reinstall) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
88 lines
3.4 KiB
Bash
Executable File
88 lines
3.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Used for mainly CLI
|
|
initial_command1="$1"
|
|
initial_command2="$2"
|
|
initial_command3="$3"
|
|
initial_command4="$4"
|
|
initial_command5="$5"
|
|
initial_command6="$6"
|
|
initial_command7="$7"
|
|
|
|
displayLibrePortalLogo()
|
|
{
|
|
[[ "$LIBREPORTAL_SKIP_LOGO" == "1" ]] && return
|
|
local hbar; hbar=$(printf '═%.0s' $(seq 1 50))
|
|
printf '\n╔%s╗\n' "$hbar"
|
|
printf '║%6s%s%8s║\n' '' '╦ ┬┌┐ ┬─┐┌─┐ ╭─╮ ╔═╗┌─┐┬─┐┌┬┐┌─┐┬' ''
|
|
printf '║%6s%s%8s║\n' '' '║ │├┴┐├┬┘├┤ │◉│ ╠═╝│ │├┬┘ │ ├─┤│' ''
|
|
printf '║%6s%s%6s║\n' '' '╩═╝┴└─┘┴└─└─┘ ╨─╨ ╩ └─┘┴└─ ┴ ┴ ┴┴─┘' ''
|
|
printf '╚%s╝\n\n' "$hbar"
|
|
}
|
|
|
|
showRunHelp()
|
|
{
|
|
displayLibrePortalLogo;
|
|
echo "Available Run Commands:"
|
|
echo ""
|
|
echo " libreportal run install - Run the automated installer (WebUI flow)"
|
|
echo " libreportal run terminal - Open the terminal menu / Setup Wizard"
|
|
echo ""
|
|
echo "Pick one to continue."
|
|
echo ""
|
|
}
|
|
|
|
initLibrePortal()
|
|
{
|
|
# Load the relocatable path roots up front (sets logs_dir/docker_dir/…) — the
|
|
# install-log below needs logs_dir before load_sources runs. cwd is the install
|
|
# dir, so the relative path resolves.
|
|
[[ -f "scripts/source/paths.sh" ]] && source "scripts/source/paths.sh"
|
|
|
|
# Internal launcher: the systemd unit starts the task processor through this
|
|
# stable entry (`libreportal __task-processor`) so the unit never bakes the
|
|
# processor's in-tree path — only this hand-off knows where the script lives.
|
|
# paths.sh above resolved install_scripts_dir; export it so the exec'd
|
|
# processor inherits the roots and skips its own self-location. Intercept here,
|
|
# before the heavy load_sources — we only need to hand off to the daemon.
|
|
if [[ "$initial_command1" == "__task-processor" ]]; then
|
|
export install_scripts_dir
|
|
exec "${install_scripts_dir}task/crontab_task_processor.sh" start_script
|
|
fi
|
|
|
|
# For the full application loading
|
|
if [[ "$initial_command1" == "run" ]]; then
|
|
if [[ -z "$initial_command2" ]]; then
|
|
showRunHelp;
|
|
exit 0
|
|
fi
|
|
|
|
init_run_flag="true"
|
|
|
|
# Capture the install run to a log so credentials/URLs can be recovered
|
|
# after we clear the screen at the end.
|
|
if [[ "$initial_command2" == "install" ]]; then
|
|
install_log_path="${logs_dir:-/libreportal-system/logs/}install-$(date +%Y%m%d-%H%M%S).log"
|
|
sudo mkdir -p "${logs_dir:-/libreportal-system/logs/}" 2>/dev/null
|
|
sudo touch "$install_log_path" 2>/dev/null
|
|
# Own it by whoever runs the install (the manager under Model A) so the
|
|
# tee below — which runs as that user, not root — can append. A
|
|
# sudo-touched file is root:root 644, leaving the manager unable to
|
|
# write it → the empty install-*.log files.
|
|
sudo chown "$(id -un):$(id -gn)" "$install_log_path" 2>/dev/null
|
|
sudo chmod 644 "$install_log_path" 2>/dev/null
|
|
export install_log_path
|
|
exec > >(tee -a "$install_log_path") 2>&1
|
|
fi
|
|
|
|
displayLibrePortalLogo;
|
|
source "scripts/source/load_sources.sh"
|
|
else
|
|
# For the CLI loading
|
|
init_run_flag="false"
|
|
displayLibrePortalLogo;
|
|
source "scripts/source/load_sources.sh"
|
|
fi
|
|
}
|
|
|
|
initLibrePortal; |