summaryrefslogtreecommitdiffstats
path: root/.github/scripts/check-updater.sh
blob: 3df0c9de48cb0af076b48055676660052a902c87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
#
set -e
# shellcheck source=.github/scripts/functions.sh
. "$(dirname "$0")/functions.sh"

check_successful_update() {
  progress "Check netdata version after update"
  (
    netdata_version=$(netdata -v | awk '{print $2}')
    updater_version=$(cat packaging/version)
    if [ "$netdata_version" = "$updater_version" ]; then
      echo "Update successful!"
    else
      exit 1
    fi
  ) >&2
}

check_autoupdate_enabled() {
  progress "Check autoupdate still enabled after update"
  (
    if [ -f /etc/periodic/daily/netdata-updater ] || [ -f /etc/cron.daily/netdata-updater ]; then
      echo "Update successful!"
    else
      exit 1
    fi
  ) >&2
}

steps="check_successful_update check_autoupdate_enabled"

_main() {
  for step in $steps; do
    if ! run "$step"; then
      if [ -t 1 ]; then
        debug
      else
        fail "Build failed"
      fi
    fi
  done

  echo "🎉 All Done!"
}

if [ -n "$0" ] && [ x"$0" != x"-bash" ]; then
  _main "$@"
fi