From 5a67110c0f8552e9a80488b0fcddb8c031b1942d Mon Sep 17 00:00:00 2001 From: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> Date: Mon, 13 Nov 2023 21:21:33 +0100 Subject: [PATCH] chore: add better dietpi support to installer (#204) --- 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 07c109b6..5483561b 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -161,6 +161,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 c50ce442..279e8819 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 @@ -262,3 +270,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 +}