check-updater.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. #
  3. set -e
  4. # shellcheck source=.github/scripts/functions.sh
  5. . "$(dirname "$0")/functions.sh"
  6. check_successful_update() {
  7. progress "Check netdata version after update"
  8. (
  9. netdata_version=$(netdata -v | awk '{print $2}')
  10. updater_version=$(cat packaging/version)
  11. echo "Version: netdata '$netdata_version', updater '$updater_version'"
  12. if [ "$netdata_version" = "$updater_version" ]; then
  13. echo "Update successful!"
  14. else
  15. exit 1
  16. fi
  17. ) >&2
  18. }
  19. check_autoupdate_enabled() {
  20. progress "Check autoupdate still enabled after update"
  21. (
  22. if [ -f /etc/periodic/daily/netdata-updater ] || [ -f /etc/cron.daily/netdata-updater ]; then
  23. echo "Update successful!"
  24. else
  25. exit 1
  26. fi
  27. ) >&2
  28. }
  29. steps="check_successful_update check_autoupdate_enabled"
  30. _main() {
  31. for step in $steps; do
  32. if ! run "$step"; then
  33. if [ -t 1 ]; then
  34. debug
  35. else
  36. fail "Build failed"
  37. fi
  38. fi
  39. done
  40. echo "🎉 All Done!"
  41. }
  42. if [ -n "$0" ] && [ x"$0" != x"-bash" ]; then
  43. _main "$@"
  44. fi