summaryrefslogtreecommitdiffstats
path: root/packaging/makeself/build.sh
blob: dca635f0a38a665dc216272b2d2c1c4251786531 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# SPDX-License-Identifier: GPL-3.0-or-later

# -----------------------------------------------------------------------------
# parse command line arguments

set -e

export NETDATA_BUILD_WITH_DEBUG=0

while [ -n "${1}" ]; do
  case "${1}" in
    debug)
      export NETDATA_BUILD_WITH_DEBUG=1
      ;;

    *) ;;

  esac

  shift
done

# -----------------------------------------------------------------------------

# First run install-alpine-packages.sh under alpine linux to install
# the required packages. build-x86_64-static.sh will do this for you
# using docker.

mkdir -p /usr/src
cp -va /netdata /usr/src/netdata
chown -R root:root /usr/src/netdata

cd /usr/src/netdata/packaging/makeself || exit 1

cat >&2 << EOF
This program will create a self-extracting shell package containing
a statically linked netdata, able to run on any 64bit Linux system,
without any dependencies from the target system.

It can be used to have netdata running in no-time, or in cases the
target Linux system cannot compile netdata.
EOF

if [ ! -d tmp ]; then
  mkdir tmp || exit 1
else
  rm -rf tmp/*
fi

if [ -z "${GITHUB_ACTIONS}" ]; then
    export GITHUB_ACTIONS=false
fi

if ! ./run-all-jobs.sh "$@"; then
  printf >&2 "Build failed."
  exit 1
fi

mkdir -p /netdata/artifacts
cp -va /usr/src/netdata/artifacts/* /netdata/artifacts/
chown -R "$(stat -c '%u:%g' /netdata)" /netdata/artifacts/