You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
681 B

  1. #!/bin/sh
  2. . /usr/share/libubox/jshn.sh
  3. case "$1" in
  4. list)
  5. json_init
  6. json_add_object "sysupgrade"
  7. json_add_boolean "keep_settings" 1
  8. json_close_object
  9. json_dump
  10. ;;
  11. call)
  12. case "$2" in
  13. sysupgrade)
  14. read input;
  15. json_load "$input"
  16. json_get_var keep_settings keep_settings
  17. if [ -f "/tmp/sysupgrade.bin" ]; then
  18. /etc/init.d/uhttpd stop
  19. /etc/init.d/dropbear stop
  20. sleep 1;
  21. if [ "$keep_settings" -eq "0" ]; then
  22. keep_settings_param="-n"
  23. fi
  24. /sbin/sysupgrade $keep_settings_param /tmp/sysupgrade.bin
  25. fi
  26. json_init
  27. json_add_string "message" "could not find /tmp/sysupgrade.bin"
  28. json_dump
  29. esac
  30. ;;
  31. esac