Skip to content

Commit

Permalink
chore: add check to disable webcamd
Browse files Browse the repository at this point in the history
  • Loading branch information
mryel00 committed Nov 21, 2023
1 parent 1a0af83 commit aa25e26
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ main() {
status_msg "Running apt-get update first ..." "1"
fi

detect_existing_webcamd

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

### Detect legacy webcamd.
detect_existing_webcamd() {
local disable
if [[ -x "/usr/local/bin/webcamd" ]] && [[ -d "${HOME}/mjpg-streamer" ]]; then
msg "Found an existing mjpg-streamer"
msg "This should be stopped and disabled..."
while true; do
read -erp "Do you want to stop and disable existing 'webcamd'? (y/N) " -i "N" 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
}

0 comments on commit aa25e26

Please sign in to comment.