fix(setup/update): detect native installs first (/opt/picpeak/app/backend or systemd unit); avoid false docker updates on root
Mirror to GitHub / mirror (push) Successful in 35s
Test and Lint / backend-test (push) Successful in 1m29s
Test and Lint / frontend-test (push) Has been cancelled
Version and Release / version-bump (push) Has been cancelled
Version and Release / trigger-drone (push) Has been cancelled
Mirror to GitHub / mirror (push) Successful in 35s
Test and Lint / backend-test (push) Successful in 1m29s
Test and Lint / frontend-test (push) Has been cancelled
Version and Release / version-bump (push) Has been cancelled
Version and Release / trigger-drone (push) Has been cancelled
This commit is contained in:
+22
-7
@@ -944,16 +944,31 @@ print_success_message() {
|
||||
|
||||
update_installation() {
|
||||
print_header "Updating PicPeak"
|
||||
|
||||
# Detect existing installation
|
||||
if [[ -d "$DOCKER_APP_DIR" ]] || [[ -d "/home/${SUDO_USER:-}/picpeak" ]]; then
|
||||
INSTALL_METHOD="docker"
|
||||
update_docker_installation
|
||||
elif [[ -d "$NATIVE_APP_DIR" ]]; then
|
||||
|
||||
# Prefer explicit native install detection first
|
||||
native_detected=false
|
||||
docker_detected=false
|
||||
|
||||
# Native detection: app/backend exists OR systemd unit present
|
||||
if [[ -d "$NATIVE_APP_DIR/app/backend" ]]; then
|
||||
native_detected=true
|
||||
elif command -v systemctl >/dev/null 2>&1 && systemctl list-unit-files | grep -q '^picpeak-backend.service'; then
|
||||
native_detected=true
|
||||
fi
|
||||
|
||||
# Docker detection: docker app dir or user home picpeak dir exists
|
||||
if [[ -d "$DOCKER_APP_DIR" ]] || [[ -n "${SUDO_USER:-}" && -d "/home/${SUDO_USER}/picpeak" ]]; then
|
||||
docker_detected=true
|
||||
fi
|
||||
|
||||
if [[ "$native_detected" == true ]]; then
|
||||
INSTALL_METHOD="native"
|
||||
update_native_installation
|
||||
elif [[ "$docker_detected" == true ]]; then
|
||||
INSTALL_METHOD="docker"
|
||||
update_docker_installation
|
||||
else
|
||||
die "No existing PicPeak installation found"
|
||||
die "No existing PicPeak installation found (native dir $NATIVE_APP_DIR/app/backend or docker dir $DOCKER_APP_DIR not present)"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user