Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(crowsnest): fix install of crowsnest #111

Merged
merged 1 commit into from
May 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/modules/crowsnest/config
Original file line number Diff line number Diff line change
Expand Up @@ -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"
29 changes: 11 additions & 18 deletions src/modules/crowsnest/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,30 +21,24 @@ 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}"
fi
# 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/
Expand Down