From 4082fc2fd4441d769637bdbe6c206d5acb9307ab Mon Sep 17 00:00:00 2001 From: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> Date: Fri, 10 Nov 2023 22:30:31 +0100 Subject: [PATCH] chore: add better dietpi support to installer --- tools/install.sh | 7 +++++++ tools/libs/core.sh | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tools/install.sh b/tools/install.sh index ce0c4f77..1d6ea963 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -155,6 +155,13 @@ main() { set_gpu_mem fi + if [[ "$(is_dietpi)" = "1" ]]; then + msg "\nDietPi detected!" + msg "Adjust settings for camera-streamer ...\n" + dietpi_cs_settings + status_msg "Adjust settings for camera-streamer ..." "0" + fi + if [[ "${CROWSNEST_UNATTENDED}" = "0" ]]; then ask_update_entry fi diff --git a/tools/libs/core.sh b/tools/libs/core.sh index 53dddf8a..c33f2f6f 100755 --- a/tools/libs/core.sh +++ b/tools/libs/core.sh @@ -48,6 +48,14 @@ is_raspbian() { fi } +is_dietpi() { + if [[ -f /boot/config.txt ]] && [[ -d /boot/dietpi ]]; then + echo "1" + else + echo "0" + fi +} + is_raspberry_pi() { if [[ -f /proc/device-tree/model ]] && grep -q "Raspberry" /proc/device-tree/model; then @@ -244,3 +252,15 @@ add_group_video() { msg "\t==> User ${BASE_USER} is already in group 'video'" fi } + +dietpi_cs_settings() { + sudo /boot/dietpi/func/dietpi-set_hardware rpi-codec enable + sudo /boot/dietpi/func/dietpi-set_hardware rpi-camera enable + + if [[ "$(is_buster)" = "0" ]]; then + if ! grep -q "camera_auto_detect=1" /boot/config.txt; then + msg "\nAdd camera_auto_detect=1 to /boot/config.txt ...\n" + echo "camera_auto_detect=1" >> /boot/config.txt + fi + fi +}