chore: add check to disable webcamd (#211)

Signed-off-by: Patrick Gehrsitz <mryel00.github@gmail.com>
This commit is contained in:
Patrick Gehrsitz 2023-11-22 20:53:49 +01:00 committed by GitHub
parent b38c959bae
commit 44e2d07a4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 0 deletions

View File

@ -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

View File

@ -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"
}