S30patchicamera 904 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:
  4. # Short-Description: Patches the iCamera binary if in self-hosted mode
  5. # Description: The stock iCamera binary will reset the network if it is unable to reach the internet. This binary patch will change this behavior.
  6. ### END INIT INFO
  7. . /opt/wz_mini/wz_mini.conf
  8. case "$1" in
  9. start)
  10. echo "#####$(basename "$0")#####"
  11. if [[ "$ENABLE_SELFHOSTED_MODE" == "true" ]] ; then
  12. # Apply the patch. The script here is idempotent.
  13. if /opt/wz_mini/usr/bin/patch_icamera.sh apply ; then
  14. echo "iCamera patch applied successfully."
  15. exit 0
  16. else
  17. # If the patch failed, we'll fall through and undo
  18. echo "iCamera patch failed."
  19. fi
  20. fi
  21. # If ENABLE_SELFHOSTED_MODE != "true" or if the patch failed, remove the patch if it exists.
  22. /opt/wz_mini/usr/bin/patch_icamera.sh remove
  23. ;;
  24. *)
  25. echo "Usage: $0 {start}"
  26. exit 1
  27. ;;
  28. esac