CreatBotCrowsnest/custompios/crowsnest/start_chroot_script
Stephan Wendel 0176ce769c
refactor: refactored custompios module
CustomPIOS Module now uses Crowsnest Install Mechanism

Signed-off-by: Stephan Wendel <me@stephanwe.de>
2022-03-04 19:52:43 +01:00

46 lines
1.2 KiB
Bash

#!/usr/bin/env bash
#### webcamd - A webcam Service for multiple Cams and Stream Services.
####
#### Written by Stephan Wendel aka KwadFan <me@stephanwe.de>
#### Copyright 2021
#### https://github.com/mainsail-crew/crowsnest
####
#### This File is distributed under GPLv3
####
# shellcheck disable=all
# Error handling
# set -x # Uncomment for debugging purposes
set -e
source /common.sh
install_cleanup_trap
echo_green "Installing crowsnest and enable webcam Service ..."
# install dependencies
apt_update_skip
check_install_pkgs ${CROWSNEST_CROWSNEST_DEPS}
# Move to $HOME dir
pushd /home/${BASE_USER}
# make sure config folder exist
if [ ! -d "${CROWSNEST_DEFAULT_CONF_DIR}" ]; then
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
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
cat file_templates/moonraker_update.txt | \
sudo -u ${BASE_USER} tee -a /home/${BASE_USER}/klipper_config/moonraker.conf
fi
popd
popd