Skip to content

Commit

Permalink
chore: add check to disable webcamd (#211)
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Gehrsitz <[email protected]>
  • Loading branch information
mryel00 authored Nov 22, 2023
1 parent b38c959 commit 44e2d07
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ main() {

if [[ "${CROWSNEST_UNATTENDED}" != "1" ]]; then
msg "Doing some tests ...\n"
detect_existing_webcamd
if shallow_cs_dependencies_check; then
CN_INSTALL_CS="1"
else
Expand Down
33 changes: 33 additions & 0 deletions tools/libs/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,36 @@ dietpi_cs_settings() {
fi
fi
}

### Detect legacy webcamd.
detect_existing_webcamd() {
local disable
msg "Checking for mjpg-streamer ...\n"
if [[ -x "/usr/local/bin/webcamd" ]] && [[ -d "/home/${BASE_USER}/mjpg-streamer" ]]; then
msg "Found an existing mjpg-streamer installation!"
msg "This should be stopped and disabled!"
while true; do
read -erp "Do you want to stop and disable existing 'webcamd'? (Y/n) " -i "Y" disable
case "${disable}" in
y|Y|yes|Yes|YES)
msg "Stopping webcamd.service ..."
sudo systemctl stop webcamd.service &> /dev/null
status_msg "Stopping webcamd.service ..." "0"

msg "\nDisabling webcamd.service ...\r"
sudo systemctl disable webcamd.service &> /dev/null
status_msg "Disabling webcamd.service ..." "0"
return
;;

n|N|no|No|NO)
msg "\nYou should disable and stop webcamd to use crowsnest without problems!\n"
return
;;
*)
msg "You answered '${disable}'! Invalid input ..." ;;
esac
done
fi
status_msg "Checking for mjpg-streamer ..." "0"
}

0 comments on commit 44e2d07

Please sign in to comment.