From d2486a87b62879d88d59463b1465273ec2797292 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 8 Dec 2024 00:09:34 -0600 Subject: [PATCH 1/2] Update install.sh: Warn in no RPi camera command was found --- install.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 0bcb6ceb4..a1e9592ff 100755 --- a/install.sh +++ b/install.sh @@ -302,10 +302,11 @@ CT=() # Camera Type array - what to display in whiptail get_connected_cameras() { - local CMD CC MSG NUM_RPI=0 NUM_ZWO=0 + local CMD CMD_RET CC MSG NUM_RPI=0 NUM_ZWO=0 # true == ignore errors. ${CMD} will be "" if no command found. CMD="$( determineCommandToUse "false" "" "true" 2> /dev/null )" + CMD_RET=$? # return of 2 means no command was found setup_rpi_supported_cameras "${CMD}" # Will create full file is CMD == "" # RPi format: RPi \t camera_number \t camera_sensor [\t optional_other_stuff] @@ -357,7 +358,12 @@ get_connected_cameras() whiptail --title "${TITLE}" --msgbox "${MSG}" 12 "${WT_WIDTH}" 3>&1 1>&2 2>&3 MSG="No connected cameras were detected." - display_msg --log error "${MSG}" + local MSG2="" + if [[ ${CMD_RET} -eq 2 ]]; then + MSG2="No command to take RPi images was found" + MSG2+=" - make sure 'libcamera-apps' is installed if you have an RPi camera." + fi + display_msg --log error "${MSG}" "${MSG2}" exit_installation 1 "${STATUS_NO_CAMERA}" "" fi @@ -540,6 +546,7 @@ do_save_camera_capabilities() MSG="No camera was found; one must be connected and working for the installation to succeed.\n" MSG+="After connecting your camera, re-run the installation." whiptail --title "${TITLE}" --msgbox "${MSG}" 12 "${WT_WIDTH}" 3>&1 1>&2 2>&3 + display_msg --log error "No camera detected - installation aborted." [[ -s ${TMP} ]] && display_msg --log error "$( < "${TMP}" )" exit_with_image 1 "${STATUS_ERROR}" "No camera detected" @@ -3518,8 +3525,8 @@ install_installer_dependencies() { sudo apt-get update && run_aptGet gawk jq dialog } > "${TMP}" 2>&1 - check_success $? "gawk,jq installation failed" "${TMP}" "${DEBUG}" || - exit_with_image 1 "${STATUS_ERROR}" "gawk,jq install failed." + check_success $? "gawk,jq,dialog installation failed" "${TMP}" "${DEBUG}" || + exit_with_image 1 "${STATUS_ERROR}" "gawk,jq,dialog install failed." STATUS_VARIABLES+=( "${FUNCNAME[0]}='true'\n" ) } @@ -3901,4 +3908,4 @@ else fi display_msg progress "\nEnjoy Allsky!\n" -exit_installation 0 "${STATUS_OK}" "" \ No newline at end of file +exit_installation 0 "${STATUS_OK}" "" From 33574ea3c33c58809c237754a6f98709d521feed Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 8 Dec 2024 00:10:47 -0600 Subject: [PATCH 2/2] Update functions.sh: Keep track of RPi command was found --- scripts/functions.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index f7bc21e71..4a727e246 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -187,7 +187,7 @@ function determineCommandToUse() local PREFIX="${2}" # Only used if calling doExit(). local IGNORE_ERRORS="${3:-false}" # True if just checking - local CRET RET MSG EXIT_MSG + local CRET RET MSG EXIT_MSG CMD_FOUND="false" # If libcamera is installed and works, use it. # If it's not installed, or IS installed but doesn't work (the user may not have it configured), @@ -203,7 +203,9 @@ function determineCommandToUse() CRET=$? fi if [[ ${CRET} -eq 0 ]]; then - # Found the command - see if it works. + CMD_FOUND="true" # one of the commands were found. + + # Found a command - see if it works. "${CMD_TO_USE_}" --timeout 1 --nopreview > /dev/null 2>&1 RET=$? if [[ ${RET} -eq 137 ]]; then @@ -230,9 +232,15 @@ function determineCommandToUse() fi fi - return 1 + if [[ ${CMD_FOUND} == "true" ]]; then + return 1 + else + return 2 # no command was found + fi fi + CMD_FOUND="true" # some command was found. + # On Buster, raspistill sometimes hangs if no camera is found, # so work around that. if ! timeout 4 "${CMD_TO_USE_}" --timeout 1 --nopreview > /dev/null 2>&1 ; then