CreatBotCrowsnest/custompios/crowsnest/start_chroot_script
Stephan Wendel d4a2c08152
refactor: implements new install mechanism
This installer requires to be configured due
make config

Changes:

Add tools/configure.sh script and make config.

Refactor of uninstall.sh according to new installer

Add dev-helper.sh to provide various informations for developing
and also could check existing installation as kinda "unit-test"

This should also fix #46
and fix #41

Signed-off-by: Stephan Wendel <me@stephanwe.de>

Signed-off-by: Stephan Wendel <me@stephanwe.de>
2022-11-04 09:37:40 +01:00

81 lines
2.1 KiB
Bash

#!/usr/bin/env bash
#### crowsnest - 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 enable=requires-variable-braces
# Error handling
set -Ee
# shellcheck disable=SC1091
source /common.sh
install_cleanup_trap
# Module only Variables
CN_BUILD_PACKAGE_FILE="/tmp/cn_packages.lst"
CN_BUILD_INSTALL_SH="/home/${BASE_USER}/crowsnest/tools/install.sh"
echo_green "Installing crowsnest ..."
## Force apt update
apt-get update
## Make sure 'git' is installed!
check_install_pkgs git
## Step 1: Move to Home Dir as WorkingDirectoy
pushd "/home/${BASE_USER}" &> /dev/null || exit 1
## Step 2: clone crowsnest repo
echo_green "Clone crowsnest repository ..."
gitclone CROWSNEST_REPO crowsnest
## Step 3: grep PKGLIST from install.sh for dependencies
echo_green "Generating packages file ..."
grep "PKGLIST=" "${CN_BUILD_INSTALL_SH}" >> "${CN_BUILD_PACKAGE_FILE}"
## Step 4: Rename PKGLIST to Module usable Var
echo_green "Rename variable PKGLIST to CROWSNEST_DEPS ..."
sed -i 's/PKGLIST/CROWSNEST_DEPS/g' "${CN_BUILD_PACKAGE_FILE}"
## Step 5: Source cn_package.lst file
# shellcheck disable=SC1090
# Shellcheck has to be disabled here,
# because it is an dynamic generated file and not checkable
. "${CN_BUILD_PACKAGE_FILE}"
## Step 6: Install packages
echo_green "Install crowsnest dependencies ..."
# shellcheck disable=SC2086
# disabled because we need 'wordsplitting'
check_install_pkgs ${CROWSNEST_DEPS}
## Step 7: Move to crowsnest as working directory
pushd "/home/${BASE_USER}/crowsnest" &> /dev/null || exit 1
## Step 8: Run crowsnest install routine
echo_green "Launch crowsnest install routine ..."
make install
## Step 9: Leave crowsnest
popd &> /dev/null || exit 1
## Step 10: clean packages.lst file
rm -f "${CN_BUILD_PACKAGE_FILE}"
## Step 11: leave home dir
popd &> /dev/null || exit 1
## Step 12:
echo_green "Enable crowsnest.service ..."
systemctl_if_exists enable crowsnest.service
## Finish
echo_green "Installing crowsnest ... DONE!"