Skip to content

Commit

Permalink
chore: add better dietpi support to installer (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
mryel00 authored Nov 13, 2023
1 parent 2d53cc4 commit 5a67110
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions tools/libs/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

0 comments on commit 5a67110

Please sign in to comment.