fix: Improve daemon install path resolution for compiled script
Some checks failed
Compile apt-layer (v2) / compile (push) Has been cancelled

- Fixed daemon source path resolution to work with both compiled and source versions
- Added multiple fallback paths for daemon source discovery
- Enhanced error reporting to show all attempted paths
- Ensures daemon install works regardless of script execution context

This fixes the issue where daemon install failed when running from compiled apt-layer.sh
This commit is contained in:
robojerk 2025-07-15 18:39:30 -07:00
parent 1925ce65df
commit 432661f7cb
2 changed files with 47 additions and 7 deletions

View file

@ -6,7 +6,7 @@
# DO NOT modify this file directly as it will be overwritten #
# #
# apt-layer Tool #
# Generated on: 2025-07-15 17:57:47 #
# Generated on: 2025-07-15 18:39:00 #
# #
################################################################################################################
@ -7571,12 +7571,32 @@ install_daemon() {
log_info "Installing apt-ostree daemon..." "apt-layer"
# Check if Python daemon directory exists
local daemon_dir="$(dirname "$0")/../apt-ostree.py/python"
if [[ ! -d "$daemon_dir" ]]; then
log_error "Daemon source not found: $daemon_dir" "apt-layer"
# Try multiple possible paths for daemon source
local daemon_dir=""
local possible_paths=(
"$(dirname "$0")/../apt-ostree.py/python"
"$(dirname "$0")/../../src/apt-ostree.py/python"
"./src/apt-ostree.py/python"
"../src/apt-ostree.py/python"
)
for path in "${possible_paths[@]}"; do
if [[ -d "$path" ]]; then
daemon_dir="$path"
break
fi
done
if [[ -z "$daemon_dir" ]]; then
log_error "Daemon source not found. Tried paths:" "apt-layer"
for path in "${possible_paths[@]}"; do
log_error " - $path" "apt-layer"
done
return 1
fi
log_info "Found daemon source at: $daemon_dir" "apt-layer"
# Run the daemon install script
if [[ -f "$daemon_dir/install.py" ]]; then
if python3 "$daemon_dir/install.py"; then

View file

@ -458,12 +458,32 @@ install_daemon() {
log_info "Installing apt-ostree daemon..." "apt-layer"
# Check if Python daemon directory exists
local daemon_dir="$(dirname "$0")/../apt-ostree.py/python"
if [[ ! -d "$daemon_dir" ]]; then
log_error "Daemon source not found: $daemon_dir" "apt-layer"
# Try multiple possible paths for daemon source
local daemon_dir=""
local possible_paths=(
"$(dirname "$0")/../apt-ostree.py/python"
"$(dirname "$0")/../../src/apt-ostree.py/python"
"./src/apt-ostree.py/python"
"../src/apt-ostree.py/python"
)
for path in "${possible_paths[@]}"; do
if [[ -d "$path" ]]; then
daemon_dir="$path"
break
fi
done
if [[ -z "$daemon_dir" ]]; then
log_error "Daemon source not found. Tried paths:" "apt-layer"
for path in "${possible_paths[@]}"; do
log_error " - $path" "apt-layer"
done
return 1
fi
log_info "Found daemon source at: $daemon_dir" "apt-layer"
# Run the daemon install script
if [[ -f "$daemon_dir/install.py" ]]; then
if python3 "$daemon_dir/install.py"; then