diff --git a/src/modules/crowsnest/config b/src/modules/crowsnest/config index afdaa5ed2..47787d9c7 100644 --- a/src/modules/crowsnest/config +++ b/src/modules/crowsnest/config @@ -15,11 +15,14 @@ [ -n "$CROWSNEST_CROWSNEST_DEPS" ] || CROWSNEST_CROWSNEST_DEPS="git crudini bsdutils findutils v4l-utils ffmpeg" [ -n "$CROWSNEST_DEFAULT_CONF" ] || CROWSNEST_DEFAULT_CONF="mainsail_default.conf" [ -n "$CROWSNEST_DEFAULT_CONF_DIR" ] || CROWSNEST_DEFAULT_CONF_DIR="/home/${BASE_USER}/klipper_config" -[ -n "$CROWSNEST_MOONRAKER_SUPPORT" ] || CROWSNEST_MOONRAKER_SUPPORT="y" -[ -n "$CROWSNEST_FORCE_RASPICAMFIX" ] || CROWSNEST_FORCE_RASPICAMFIX="y" +# Force Raspicam fix bool (1:yes / 0:no) +[ -n "$CROWSNEST_FORCE_RASPICAMFIX" ] || CROWSNEST_FORCE_RASPICAMFIX=1 +# Add Crowsnest to moonraker.conf (update manager) bool (1:yes / 0:no) +[ -n "$CROWSNEST_ADD_CROWSNEST_MOONRAKER" ] || CROWSNEST_ADD_CROWSNEST_MOONRAKER=1 + # ustreamer -[ -n "$CROWSNEST_USTREAMER_DEPS" ] || CROWSNEST_USTREAMER_DEPS="git build-essential libevent-dev libjpeg62-turbo-dev \ +[ -n "$CROWSNEST_USTREAMER_DEPS" ] || CROWSNEST_USTREAMER_DEPS="git build-essential libevent-dev libjpeg8-dev \ libbsd-dev libraspberrypi-dev libgpiod-dev" [ -n "$CROWSNEST_USTREAMER_WITH_OMX" ] || CROWSNEST_USTREAMER_WITH_OMX="y" [ -n "$CROWSNEST_USTREAMER_WITH_GPIO" ] || CROWSNEST_USTREAMER_WITH_GPIO="n" diff --git a/src/modules/crowsnest/start_chroot_script b/src/modules/crowsnest/start_chroot_script index 7dac25024..4961f3f55 100644 --- a/src/modules/crowsnest/start_chroot_script +++ b/src/modules/crowsnest/start_chroot_script @@ -12,8 +12,7 @@ # shellcheck disable=all # Error handling -# set -x # Uncomment for debugging purposes -set -e +set -Ee source /common.sh install_cleanup_trap @@ -22,9 +21,10 @@ echo_green "Installing crowsnest and enable webcam Service ..." # install dependencies # force apt update apt update -check_install_pkgs ${CROWSNEST_CROWSNEST_DEPS} +# It could use inbuilt dependencie check, but should speed up if preinstalled. +check_install_pkgs "${CROWSNEST_CROWSNEST_DEPS}" # Move to $HOME dir -pushd /home/${BASE_USER} &> /dev/null || exit 1 +pushd "/home/${BASE_USER}" &> /dev/null || exit 1 # make sure config folder exist if [ ! -d "${CROWSNEST_DEFAULT_CONF_DIR}" ]; then sudo -u "${BASE_USER}" mkdir -p "${CROWSNEST_DEFAULT_CONF_DIR}" @@ -32,20 +32,13 @@ pushd /home/${BASE_USER} &> /dev/null || exit 1 # clone Repo echo_green "Clone crowsnest repository ..." gitclone CROWSNEST_CROWSNEST_REPO crowsnest - # install crowsnest - pushd /home/${BASE_USER}/crowsnest &> /dev/null || exit 1 - echo_green "Running crowsnest installer ..." - sudo -u "${BASE_USER}" make install - # add update manager section to moonraker.conf - if [ -f "/home/${BASE_USER}/klipper_config/moonraker.conf" ] && - [ "${CROWSNEST_MOONRAKER_SUPPORT}" == "y" ]; then - sudo -u ${BASE_USER} \ - sh -c 'echo -e "\n" >> /home/$(whoami)/klipper_config/moonraker.conf' - sudo -u ${BASE_USER} \ - sh -c 'cat file_templates/moonraker_update.txt \ - >> /home/$(whoami)/klipper_config/moonraker.conf' - fi - if [ "${CROWSNEST_FORCE_RASPICAMFIX}" == "y" ]; then + # install crowsnest - use crowsnest's make unattended + pushd "/home/${BASE_USER}/crowsnest" &> /dev/null || exit 1 + echo_green "Launch crowsnest install routine ..." + pushd "/home/${BASE_USER}/crowsnest" &> /dev/null || exit 1 + sudo -u "${BASE_USER}" make unattended + # Apply Raspicam fix if enabled. + if [ "${CROWSNEST_FORCE_RASPICAMFIX}" == "1" ]; then echo -en "Applying Raspicam Fix ... \r" sudo sh -c 'echo "bcm2835-v4l2" >> /etc/modules' sudo cp file_templates/bcm2835-v4l2.conf /etc/modprobe.d/