diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/README.md | 52 | ||||
-rw-r--r-- | contrib/debian/changelog | 2 | ||||
-rw-r--r-- | contrib/debian/control | 26 | ||||
-rw-r--r-- | contrib/debian/control.buster | 64 | ||||
-rw-r--r-- | contrib/debian/control.jessie | 62 | ||||
-rw-r--r-- | contrib/debian/control.trusty | 62 | ||||
-rw-r--r-- | contrib/debian/control.wheezy | 31 | ||||
-rw-r--r-- | contrib/debian/control.xenial | 64 | ||||
-rw-r--r-- | contrib/debian/netdata.conf | 16 | ||||
-rw-r--r-- | contrib/debian/netdata.default | 6 | ||||
-rwxr-xr-x | contrib/debian/netdata.init | 2 | ||||
-rw-r--r-- | contrib/debian/netdata.postinst | 74 | ||||
-rw-r--r-- | contrib/debian/netdata.postinst.in | 55 | ||||
-rw-r--r-- | contrib/debian/netdata.postrm | 81 | ||||
-rw-r--r-- | contrib/debian/netdata.preinst | 2 | ||||
-rw-r--r-- | contrib/debian/netdata.service | 14 | ||||
-rwxr-xr-x | contrib/debian/rules | 57 | ||||
-rwxr-xr-x | contrib/rhel/build-netdata-rpm.sh | 37 | ||||
-rw-r--r-- | contrib/sles11/README.md | 7 |
19 files changed, 222 insertions, 492 deletions
diff --git a/contrib/README.md b/contrib/README.md index 4f32d9df..e253efa9 100644 --- a/contrib/README.md +++ b/contrib/README.md @@ -1,3 +1,8 @@ +<!-- +title: "Netdata contrib" +custom_edit_url: https://github.com/netdata/netdata/edit/master/contrib/README.md +--> + # Netdata contrib ## Building .deb packages @@ -15,6 +20,17 @@ way to do this is with a symlink: ln -s contrib/debian ``` +Edit the `debian/changelog` file to reflect the package version and +the build time: + +```sh +netdata (1.21.0) unstable; urgency=medium + + * Initial Release + + -- Netdata Builder <bot@netdata.cloud> Tue, 12 May 2020 10:36:52 +0200 +``` + Then build the debian package: ```sh @@ -25,36 +41,16 @@ This should give a package that can be installed in the parent directory, which you can install manually with dpkg. ```sh -ls ../*.deb -../netdata_1.0.0_amd64.deb -sudo dpkg -i ../netdata_1.0.0_amd64.deb +ls -1 ../*.deb +../netdata_1.21.0_amd64.deb +../netdata-dbgsym_1.21.0_amd64.deb +../netdata-plugin-cups_1.21.0_amd64.deb +../netdata-plugin-cups-dbgsym_1.21.0_amd64.deb +../netdata-plugin-freeipmi_1.21.0_amd64.deb +../netdata-plugin-freeipmi-dbgsym_1.21.0_amd64.deb +sudo dpkg -i ../netdata_1.21.0_amd64.deb ``` -### Building for a Debian system without systemd - -The included packaging is designed for modern Debian systems that -are based on systemd. To build non-systemd packages (for example, -for Debian wheezy), you will need to make a couple of minor -updates first. - -- edit `contrib/debian/rules` and adjust the `dh` rule near the - top to remove systemd (see comments in that file). - -- rename `contrib/debian/control.wheezy` to `contrib/debian/control`. - -- change `control.wheezy from contrib/Makefile* to control`. - -- uncomment `EXTRA_OPTS="-P /var/run/netdata.pid"` in - `contrib/debian/netdata.default` - -- edit `contrib/debian/netdata.init` and change `PIDFILE` to - `/var/run/netdata.pid` - -- remove `dpkg-statoverride --update --add --force root netdata 0775 /var/lib/netdata/registry` from - `contrib/debian/netdata.postinst.in`. If you are going to handle the unique id file differently. - -Then proceed as the main instructions above. - ### Reinstalling Netdata The recommended way to upgrade Netdata packages built from this diff --git a/contrib/debian/changelog b/contrib/debian/changelog index ddfffe4e..5ac1edb3 100644 --- a/contrib/debian/changelog +++ b/contrib/debian/changelog @@ -2,5 +2,5 @@ netdata (PREVIOUS_PACKAGE_VERSION) unstable; urgency=medium * Initial Release --- Netdata Builder <bot@netdata.cloud> PREVIOUS_PACKAGE_DATE + -- Netdata Builder <bot@netdata.cloud> PREVIOUS_PACKAGE_DATE diff --git a/contrib/debian/control b/contrib/debian/control index a06f2937..2659c389 100644 --- a/contrib/debian/control +++ b/contrib/debian/control @@ -5,6 +5,7 @@ Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.13.19), zlib1g-dev, uuid-dev, + libelf-dev, libuv1-dev, liblz4-dev, libjudy-dev, @@ -17,13 +18,13 @@ Build-Depends: debhelper (>= 9), libsnappy-dev, libprotobuf-dev, libprotoc-dev, + cmake, autogen, autoconf, automake, pkg-config, curl, - gcc, - g++ + protobuf-compiler Section: net Priority: optional Maintainer: Netdata Builder <bot@netdata.cloud> @@ -35,19 +36,7 @@ Architecture: any Depends: adduser, libcap2-bin (>= 1:2.0), lsb-base (>= 3.1-23.2), - zlib1g, - libuuid1, - libuv1, - liblz4-1, - libjudydebian1, openssl, - libmnl0, - libjson-c3, - freeipmi, - libnetfilter-acct1, - libprotobuf-c1, - libsnappy1v5, - libprotoc10, ${misc:Depends}, ${shlibs:Depends} Pre-Depends: dpkg (>= 1.17.14) @@ -62,3 +51,12 @@ Architecture: any Depends: cups, netdata (>= ${source:Version}) Description: The Common Unix Printing System plugin for metrics collection from cupsd + +Package: netdata-plugin-freeipmi +Architecture: any +Depends: freeipmi, + netdata (= ${source:Version}) +Description: FreeIPMI - The Intelligent Platform Management System. + The IPMI specification defines a set of interfaces for platform management. + It is implemented by a number vendors for system management. The features of IPMI that most users will be interested in + are sensor monitoring, system event monitoring, power control, and serial-over-LAN (SOL). diff --git a/contrib/debian/control.buster b/contrib/debian/control.buster deleted file mode 100644 index 7c4d6e89..00000000 --- a/contrib/debian/control.buster +++ /dev/null @@ -1,64 +0,0 @@ -Source: netdata -Build-Depends: debhelper (>= 9), - dh-autoreconf, - dh-systemd (>= 1.5), - dpkg-dev (>= 1.13.19), - zlib1g-dev, - uuid-dev, - libuv1-dev, - liblz4-dev, - libjudy-dev, - libssl-dev, - libmnl-dev, - libjson-c-dev, - libcups2-dev, - libipmimonitoring-dev, - libnetfilter-acct-dev, - libsnappy-dev, - libprotobuf-dev, - libprotoc-dev, - autogen, - autoconf, - automake, - pkg-config, - curl, - gcc, - g++ -Section: net -Priority: optional -Maintainer: Netdata Builder <bot@netdata.cloud> -Standards-Version: 3.9.6 -Homepage: https://netdata.cloud - -Package: netdata -Architecture: any -Depends: adduser, - libcap2-bin (>= 1:2.0), - lsb-base (>= 3.1-23.2), - zlib1g, - libuuid1, - libuv1, - liblz4-1, - libjudydebian1, - openssl, - libmnl0, - libjson-c3, - freeipmi, - libnetfilter-acct1, - libprotobuf-c1, - libsnappy1v5, - libprotoc17, - ${misc:Depends}, - ${shlibs:Depends} -Pre-Depends: dpkg (>= 1.17.14) -Description: real-time charts for system monitoring - Netdata is a daemon that collects data in realtime (per second) - and presents a web site to view and analyze them. The presentation - is also real-time and full of interactive charts that precisely - render all collected values. - -Package: netdata-plugin-cups -Architecture: any -Depends: cups, - netdata (>= ${source:Version}) -Description: The Common Unix Printing System plugin for metrics collection from cupsd diff --git a/contrib/debian/control.jessie b/contrib/debian/control.jessie deleted file mode 100644 index 15e0d133..00000000 --- a/contrib/debian/control.jessie +++ /dev/null @@ -1,62 +0,0 @@ -Source: netdata -Build-Depends: debhelper (>= 9), - dh-autoreconf, - dh-systemd (>= 1.5), - dpkg-dev (>= 1.13.19), - zlib1g-dev, - uuid-dev, - liblz4-dev, - libjudy-dev, - libssl-dev, - libmnl-dev, - libjson-c-dev, - libcups2-dev, - libipmimonitoring-dev, - libnetfilter-acct-dev, - libsnappy-dev, - libprotobuf-dev, - libprotoc-dev, - autogen, - autoconf, - automake, - pkg-config, - curl, - gcc, - g++ -Section: net -Priority: optional -Maintainer: Costa Tsaousis <costa@tsaousis.gr> -Standards-Version: 3.9.6 -Homepage: https://github.com/netdata/netdata/wiki - -Package: netdata -Architecture: any -Depends: adduser, - libcap2-bin (>= 1:2.0), - lsb-base (>= 3.1-23.2), - zlib1g, - libuuid1, - liblz4-1, - libjudydebian1, - openssl, - libmnl0, - libjson-c2, - freeipmi, - libnetfilter-acct1, - libprotobuf-c1, - libsnappy1, - libprotoc9, - ${misc:Depends}, - ${shlibs:Depends} -Pre-Depends: dpkg (>= 1.17.14) -Description: real-time charts for system monitoring - Netdata is a daemon that collects data in realtime (per second) - and presents a web site to view and analyze them. The presentation - is also real-time and full of interactive charts that precisely - render all collected values. - -Package: netdata-plugin-cups -Architecture: any -Depends: cups, - netdata (>= ${source:Version}) -Description: The Common Unix Printing System plugin for metrics collection from cupsd diff --git a/contrib/debian/control.trusty b/contrib/debian/control.trusty deleted file mode 100644 index 9e4e43b8..00000000 --- a/contrib/debian/control.trusty +++ /dev/null @@ -1,62 +0,0 @@ -Source: netdata -Build-Depends: debhelper (>= 9), - dh-autoreconf, - dh-systemd (>= 1.5), - dpkg-dev (>= 1.13.19), - zlib1g-dev, - uuid-dev, - liblz4-dev, - libjudy-dev, - libssl-dev, - libmnl-dev, - libjson-c-dev, - libcups2-dev, - libipmimonitoring-dev, - libnetfilter-acct-dev, - libsnappy-dev, - libprotobuf-dev, - libprotoc-dev, - autogen, - autoconf, - automake, - pkg-config, - curl, - gcc, - g++ -Section: net -Priority: optional -Maintainer: Netdata Builder <bot@netdata.cloud> -Standards-Version: 3.9.6 -Homepage: https://netdata.cloud - -Package: netdata -Architecture: any -Depends: adduser, - libcap2-bin (>= 1:2.0), - lsb-base (>= 3.1-23.2), - zlib1g, - libuuid1, - liblz4-1, - libjudydebian1, - openssl, - libmnl0, - libjson-c2, - freeipmi, - libnetfilter-acct1, - libprotobuf-c0, - libsnappy1, - libprotoc8, - ${misc:Depends}, - ${shlibs:Depends} -Pre-Depends: dpkg (>= 1.17.14) -Description: real-time charts for system monitoring - Netdata is a daemon that collects data in realtime (per second) - and presents a web site to view and analyze them. The presentation - is also real-time and full of interactive charts that precisely - render all collected values. - -Package: netdata-plugin-cups -Architecture: any -Depends: cups, - netdata (>= ${source:Version}) -Description: The Common Unix Printing System plugin for metrics collection from cupsd diff --git a/contrib/debian/control.wheezy b/contrib/debian/control.wheezy deleted file mode 100644 index cc725c04..00000000 --- a/contrib/debian/control.wheezy +++ /dev/null @@ -1,31 +0,0 @@ -Source: netdata -Build-Depends: debhelper (>= 9), - dh-autoreconf, - pkg-config, - dpkg-dev (>= 1.13.19), - zlib1g-dev, - uuid-dev -Section: net -Priority: optional -Maintainer: Costa Tsaousis <costa@tsaousis.gr> -Standards-Version: 3.9.6 -Homepage: https://github.com/netdata/netdata/wiki - -Package: netdata -Architecture: any -Depends: adduser, - libcap2-bin (>= 1:2.0), - lsb-base (>= 3.1-23.2), - ${misc:Depends}, - ${shlibs:Depends} -Description: real-time charts for system monitoring - Netdata is a daemon that collects data in realtime (per second) - and presents a web site to view and analyze them. The presentation - is also real-time and full of interactive charts that precisely - render all collected values. - -Package: netdata-plugin-cups -Architecture: any -Depends: cups, - netdata (>= ${source:Version}) -Description: The Common Unix Printing System plugin for metrics collection from cupsd diff --git a/contrib/debian/control.xenial b/contrib/debian/control.xenial deleted file mode 100644 index 2d986d5e..00000000 --- a/contrib/debian/control.xenial +++ /dev/null @@ -1,64 +0,0 @@ -Source: netdata -Build-Depends: debhelper (>= 9), - dh-autoreconf, - dh-systemd (>= 1.5), - dpkg-dev (>= 1.13.19), - zlib1g-dev, - uuid-dev, - libuv1-dev, - liblz4-dev, - libjudy-dev, - libssl-dev, - libmnl-dev, - libjson-c-dev, - libcups2-dev, - libipmimonitoring-dev, - libnetfilter-acct-dev, - libsnappy-dev, - libprotobuf-dev, - libprotoc-dev, - autogen, - autoconf, - automake, - pkg-config, - curl, - gcc, - g++ -Section: net -Priority: optional -Maintainer: Netdata Builder <bot@netdata.cloud> -Standards-Version: 3.9.6 -Homepage: https://netdata.cloud - -Package: netdata -Architecture: any -Depends: adduser, - libcap2-bin (>= 1:2.0), - lsb-base (>= 3.1-23.2), - zlib1g, - libuuid1, - libuv1, - liblz4-1, - libjudydebian1, - openssl, - libmnl0, - libjson-c2, - freeipmi, - libnetfilter-acct1, - libprotobuf-c1, - libsnappy1v5, - libprotoc9v5, - ${misc:Depends}, - ${shlibs:Depends} -Pre-Depends: dpkg (>= 1.17.14) -Description: real-time charts for system monitoring - Netdata is a daemon that collects data in realtime (per second) - and presents a web site to view and analyze them. The presentation - is also real-time and full of interactive charts that precisely - render all collected values. - -Package: netdata-plugin-cups -Architecture: any -Depends: cups, - netdata (>= ${source:Version}) -Description: The Common Unix Printing System plugin for metrics collection from cupsd diff --git a/contrib/debian/netdata.conf b/contrib/debian/netdata.conf deleted file mode 100644 index a963d80b..00000000 --- a/contrib/debian/netdata.conf +++ /dev/null @@ -1,16 +0,0 @@ -# NetData Configuration - -# The current full configuration can be retrieved from the running -# server at the URL -# -# http://localhost:19999/netdata.conf -# -# for example: -# -# wget -O /etc/netdata/netdata.conf http://localhost:19999/netdata.conf -# - -[global] - run as user = netdata - web files owner = root - web files group = netdata diff --git a/contrib/debian/netdata.default b/contrib/debian/netdata.default index 9e7f8ae6..1d9a9c4e 100644 --- a/contrib/debian/netdata.default +++ b/contrib/debian/netdata.default @@ -1,5 +1,7 @@ # Extra arguments to pass to netdata # #EXTRA_OPTS="" -#uncomment following line if you are building a wheezy-package -#EXTRA_OPTS="-P /var/run/netdata.pid" +# +# Location of pidfile. Only used on SysV init based systems. +# +#PIDFILE="/var/run/netdata/netdata.pid" diff --git a/contrib/debian/netdata.init b/contrib/debian/netdata.init index c1b2b74d..c2706caa 100755 --- a/contrib/debian/netdata.init +++ b/contrib/debian/netdata.init @@ -31,7 +31,7 @@ test -f $DAEMON || exit 0 case "$1" in start) log_daemon_msg "Starting real-time system monitoring" "netdata" - start_daemon -p $PIDFILE $DAEMON $EXTRA_OPTS + start_daemon -p $PIDFILE $DAEMON -P $PIDFILE $EXTRA_OPTS log_end_msg $? ;; stop) log_daemon_msg "Stopping real-time system monitoring" "netdata" diff --git a/contrib/debian/netdata.postinst b/contrib/debian/netdata.postinst new file mode 100644 index 00000000..eb9104bb --- /dev/null +++ b/contrib/debian/netdata.postinst @@ -0,0 +1,74 @@ +#! /bin/sh + +set -e + +dpkg-maintscript-helper dir_to_symlink \ + /var/lib/netdata/www/.well-known /usr/share/netdata/www/.well-known 1.18.1~ netdata -- "$@" +dpkg-maintscript-helper dir_to_symlink \ + /var/lib/netdata/www/css /usr/share/netdata/www/css 1.18.1~ netdata -- "$@" +dpkg-maintscript-helper dir_to_symlink \ + /var/lib/netdata/www/fonts /usr/share/netdata/www/fonts 1.18.1~ netdata -- "$@" +dpkg-maintscript-helper dir_to_symlink \ + /var/lib/netdata/www/images /usr/share/netdata/www/images 1.18.1~ netdata -- "$@" +dpkg-maintscript-helper dir_to_symlink \ + /var/lib/netdata/www/lib /usr/share/netdata/www/lib 1.18.1~ netdata -- "$@" +dpkg-maintscript-helper dir_to_symlink \ + /var/lib/netdata/www/static /usr/share/netdata/www/static 1.18.1~ netdata -- "$@" + +case "$1" in + configure) + if [ -z "$2" ]; then + if ! getent group netdata > /dev/null; then + addgroup --quiet --system netdata + fi + + if ! getent passwd netdata > /dev/null; then + adduser --quiet --system --ingroup netdata --home /var/lib/netdata --no-create-home netdata + fi + + if ! dpkg-statoverride --list /var/lib/netdata > /dev/null 2>&1; then + dpkg-statoverride --update --add netdata netdata 0755 /var/lib/netdata + fi + + if ! dpkg-statoverride --list /var/lib/netdata/www > /dev/null 2>&1; then + dpkg-statoverride --update --add root netdata 0755 /var/lib/netdata/www + fi + + if ! dpkg-statoverride --list /var/cache/netdata > /dev/null 2>&1; then + dpkg-statoverride --update --add netdata netdata 0755 /var/cache/netdata + fi + + if ! dpkg-statoverride --list /var/run/netdata > /dev/null 2>&1; then + dpkg-statoverride --update --add netdata netdata 0755 /var/run/netdata + fi + + if ! dpkg-statoverride --list /var/log/netdata > /dev/null 2>&1; then + dpkg-statoverride --update --add netdata adm 02750 /var/log/netdata + fi + + fi + + dpkg-statoverride --force --update --add root netdata 0775 /var/lib/netdata/registry > /dev/null 2>&1 + + chown -R root:netdata /usr/share/netdata + chown -R root:netdata /usr/libexec/netdata/plugins.d + chown -R root:netdata /var/lib/netdata/www + setcap cap_dac_read_search,cap_sys_ptrace+ep /usr/libexec/netdata/plugins.d/apps.plugin + + chmod 4750 /usr/libexec/netdata/plugins.d/perf.plugin + chmod 4750 /usr/libexec/netdata/plugins.d/slabinfo.plugin + chmod 4750 /usr/libexec/netdata/plugins.d/cgroup-network + chmod 4750 /usr/libexec/netdata/plugins.d/nfacct.plugin + + # Workaround if system does not have ebpf.plugin + chmod -f 4750 /usr/libexec/netdata/plugins.d/ebpf.plugin || true + + # Workaround for other plugins not installed directly by this package + chmod -f 4750 /usr/libexec/netdata/plugins.d/freeipmi.plugin || true + + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/contrib/debian/netdata.postinst.in b/contrib/debian/netdata.postinst.in deleted file mode 100644 index 602f21c7..00000000 --- a/contrib/debian/netdata.postinst.in +++ /dev/null @@ -1,55 +0,0 @@ -#! /bin/sh - -set -e - -dpkg-maintscript-helper dir_to_symlink \ - /var/lib/netdata/www/.well-known /usr/share/netdata/www/.well-known 1.18.1~ netdata -- "$@" -dpkg-maintscript-helper dir_to_symlink \ - /var/lib/netdata/www/css /usr/share/netdata/www/css 1.18.1~ netdata -- "$@" -dpkg-maintscript-helper dir_to_symlink \ - /var/lib/netdata/www/fonts /usr/share/netdata/www/fonts 1.18.1~ netdata -- "$@" -dpkg-maintscript-helper dir_to_symlink \ - /var/lib/netdata/www/images /usr/share/netdata/www/images 1.18.1~ netdata -- "$@" -dpkg-maintscript-helper dir_to_symlink \ - /var/lib/netdata/www/lib /usr/share/netdata/www/lib 1.18.1~ netdata -- "$@" -dpkg-maintscript-helper dir_to_symlink \ - /var/lib/netdata/www/static /usr/share/netdata/www/static 1.18.1~ netdata -- "$@" - -case "$1" in - configure) - if [ -z "$2" ]; then - if ! getent group netdata >/dev/null; then - addgroup --quiet --system netdata - fi - - if ! getent passwd netdata >/dev/null; then - adduser --quiet --system --ingroup netdata --home /var/lib/netdata --no-create-home netdata - fi - - if ! dpkg-statoverride --list /var/lib/netdata >/dev/null 2>&1; then - dpkg-statoverride --update --add netdata netdata 0755 /var/lib/netdata - fi - - if ! dpkg-statoverride --list /var/lib/netdata/www >/dev/null 2>&1; then - dpkg-statoverride --update --add root netdata 0755 /var/lib/netdata/www - fi - - if ! dpkg-statoverride --list /var/cache/netdata >/dev/null 2>&1; then - dpkg-statoverride --update --add netdata netdata 0755 /var/cache/netdata - fi - - fi - - dpkg-statoverride --update --add --force root netdata 0775 /var/lib/netdata/registry - chown -R root:netdata /usr/share/netdata - chown -R root:netdata /usr/libexec/netdata/plugins.d - chown -R root:netdata /var/lib/netdata/www - setcap cap_dac_read_search,cap_sys_ptrace+ep /usr/libexec/netdata/plugins.d/apps.plugin - -#PERMS# - ;; -esac - -#DEBHELPER# - -exit 0 diff --git a/contrib/debian/netdata.postrm b/contrib/debian/netdata.postrm index de93dad1..5644e22a 100644 --- a/contrib/debian/netdata.postrm +++ b/contrib/debian/netdata.postrm @@ -1,60 +1,53 @@ -#! /bin/sh +#!/bin/sh set -e dpkg-maintscript-helper dir_to_symlink \ - /var/lib/netdata/www/.well-known /usr/share/netdata/www/.well-known 1.18.1~ netdata -- "$@" + /var/lib/netdata/www/.well-known /usr/share/netdata/www/.well-known 1.18.1~ netdata -- "$@" dpkg-maintscript-helper dir_to_symlink \ - /var/lib/netdata/www/css /usr/share/netdata/www/css 1.18.1~ netdata -- "$@" + /var/lib/netdata/www/css /usr/share/netdata/www/css 1.18.1~ netdata -- "$@" dpkg-maintscript-helper dir_to_symlink \ - /var/lib/netdata/www/fonts /usr/share/netdata/www/fonts 1.18.1~ netdata -- "$@" + /var/lib/netdata/www/fonts /usr/share/netdata/www/fonts 1.18.1~ netdata -- "$@" dpkg-maintscript-helper dir_to_symlink \ - /var/lib/netdata/www/images /usr/share/netdata/www/images 1.18.1~ netdata -- "$@" + /var/lib/netdata/www/images /usr/share/netdata/www/images 1.18.1~ netdata -- "$@" dpkg-maintscript-helper dir_to_symlink \ - /var/lib/netdata/www/lib /usr/share/netdata/www/lib 1.18.1~ netdata -- "$@" + /var/lib/netdata/www/lib /usr/share/netdata/www/lib 1.18.1~ netdata -- "$@" dpkg-maintscript-helper dir_to_symlink \ - /var/lib/netdata/www/static /usr/share/netdata/www/static 1.18.1~ netdata -- "$@" + /var/lib/netdata/www/static /usr/share/netdata/www/static 1.18.1~ netdata -- "$@" case "$1" in - remove) - ;; - - purge) - if dpkg-statoverride --list | grep -qw /var/cache/netdata; then - dpkg-statoverride --remove /var/cache/netdata - fi - - if dpkg-statoverride --list | grep -qw /var/lib/netdata/www; then - dpkg-statoverride --remove /var/lib/netdata/www - fi - - if dpkg-statoverride --list | grep -qw /var/lib/netdata/registry; then - dpkg-statoverride --remove /var/lib/netdata/registry - fi - - if dpkg-statoverride --list | grep -qw /var/lib/netdata; then - dpkg-statoverride --remove /var/lib/netdata - fi - - if getent passwd netdata >/dev/null; then - if [ -x /usr/sbin/deluser ]; then - deluser --quiet --system netdata || echo "Unable to remove netdata user" - fi - fi - - if getent group netdata >/dev/null; then - if [ -x /usr/sbin/delgroup ]; then - delgroup --quiet --system netdata || echo "Unable to remove netdata group" - fi - fi - - ;; - - *) - ;; + remove) ;; + + purge) + if dpkg-statoverride --list | grep -qw /var/cache/netdata; then + dpkg-statoverride --remove /var/cache/netdata + fi + + if dpkg-statoverride --list | grep -qw /var/lib/netdata/www; then + dpkg-statoverride --remove /var/lib/netdata/www + fi + + if dpkg-statoverride --list | grep -qw /var/lib/netdata/registry; then + dpkg-statoverride --remove /var/lib/netdata/registry + fi + + if dpkg-statoverride --list | grep -qw /var/lib/netdata; then + dpkg-statoverride --remove /var/lib/netdata + fi + + if dpkg-statoverride --list | grep -qw /var/run/netdata; then + dpkg-statoverride --remove /var/run/netdata + fi + + if dpkg-statoverride --list | grep -qw /var/log/netdata; then + dpkg-statoverride --remove /var/log/netdata + fi + ;; + + *) ;; + esac #DEBHELPER# exit 0 - diff --git a/contrib/debian/netdata.preinst b/contrib/debian/netdata.preinst index c4da80fc..3bbdea0b 100644 --- a/contrib/debian/netdata.preinst +++ b/contrib/debian/netdata.preinst @@ -14,3 +14,5 @@ dpkg-maintscript-helper dir_to_symlink \ /var/lib/netdata/www/lib /usr/share/netdata/www/lib 1.18.1~ netdata -- "$@" dpkg-maintscript-helper dir_to_symlink \ /var/lib/netdata/www/static /usr/share/netdata/www/static 1.18.1~ netdata -- "$@" + +#DEBHELPER# diff --git a/contrib/debian/netdata.service b/contrib/debian/netdata.service deleted file mode 100644 index e5d3a386..00000000 --- a/contrib/debian/netdata.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=netdata real-time system monitoring -After=network.target - -[Service] -Type=simple -EnvironmentFile=-/etc/default/netdata -ExecStart=/usr/sbin/netdata -D $EXTRA_OPTS -TimeoutStopSec=30 -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target diff --git a/contrib/debian/rules b/contrib/debian/rules index 56d346ae..9bfd057f 100755 --- a/contrib/debian/rules +++ b/contrib/debian/rules @@ -2,10 +2,19 @@ # Find the arch we are building for, as this determines # the location of plugins in /usr/lib -DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) TOP = $(CURDIR)/debian/netdata TEMPTOP = $(CURDIR)/debian/tmp +BASE_CONFIG = system/netdata.conf + +SYSTEMD_VERSION = $(shell /bin/sh -c "systemd --version 2>&1 | head -n 1 | cut -f 2 -d ' '") + +ifeq ($(shell test $(SYSTEMD_VERSION) -ge 235 && echo "1"), 1) +SYSTEMD_UNIT = system/netdata.service.v235 +else +SYSTEMD_UNIT = system/netdata.service +endif + %: # For jessie and beyond # @@ -17,15 +26,25 @@ TEMPTOP = $(CURDIR)/debian/tmp # #dh $@ --with autoreconf +override_dh_installinit: + echo "SystemD Version: $(SYSTEMD_VERSION)" + echo "Using SystemD Unit: $(SYSTEMD_UNIT)" + cp -v $(SYSTEMD_UNIT) debian/netdata.service + + dh_installinit + override_dh_auto_configure: + packaging/bundle-mosquitto.sh . + packaging/bundle-lws.sh . + packaging/bundle-libbpf.sh . autoreconf -ivf dh_auto_configure -- --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib \ - --libexecdir=/usr/libexec --with-user=netdata --with-math --with-zlib --with-webdir=/var/lib/netdata/www + --libexecdir=/usr/libexec --with-user=netdata --with-math --with-zlib --with-webdir=/var/lib/netdata/www \ + --with-bundled-lws=externaldeps/libwebsockets -debian/%.postinst: debian/%.postinst.in - sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@ +override_dh_install: + cp -v $(BASE_CONFIG) debian/netdata.conf -override_dh_install: debian/netdata.postinst dh_install # Set the CUPS plugin install rule @@ -34,14 +53,24 @@ override_dh_install: debian/netdata.postinst mv -f $(TEMPTOP)/usr/libexec/netdata/plugins.d/cups.plugin \ $(TOP)-plugin-cups/usr/libexec/netdata/plugins.d/cups.plugin + # Add free IPMI plugin install rules + # + mkdir -p $(TOP)-plugin-freeipmi/usr/libexec/netdata/plugins.d + mv -f $(TEMPTOP)/usr/libexec/netdata/plugins.d/freeipmi.plugin \ + $(TOP)-plugin-freeipmi/usr/libexec/netdata/plugins.d/freeipmi.plugin + # Set the rest of the software in the main package # cp -rp $(TEMPTOP)/usr $(TOP) cp -rp $(TEMPTOP)/var $(TOP) cp -rp $(TEMPTOP)/etc $(TOP) + mkdir -p "$(TOP)/var/log/netdata" + mkdir -p "$(TOP)/var/cache/netdata" + mkdir -p "$(TOP)/var/run/netdata" # Move files that local user shouldn't be editing to /usr/share/netdata # + packaging/bundle-dashboard.sh . ${TOP}/var/lib/netdata/www mkdir -p "$(TOP)/usr/share/netdata/www" for D in $$(find "$(TOP)/var/lib/netdata/www/" -maxdepth 1 -type d -printf '%f '); do \ echo Relocating $$D; \ @@ -49,18 +78,7 @@ override_dh_install: debian/netdata.postinst ln -s "/usr/share/netdata/www/$$D" "$(TOP)/var/lib/netdata/www/$$D"; \ done - # Update postinst to set correct group for www files on installation. - # Should probably be dpkg-statoverride really, but that gets *really* - # messy. We also set all web files in /var as conffiles so an upgrade - # doesn't splat them. - # - for D in $$(find "$(TOP)/var/lib/netdata/www/" -maxdepth 1 -type f -printf '%f '); do \ - echo Updating postinst for $$D; \ - sed -i "s/^#PERMS#/chgrp netdata \/var\/lib\/netdata\/www\/$$D\n#PERMS#/g" \ - $(CURDIR)/debian/netdata.postinst; \ - echo "/var/lib/netdata/www/$$D" >> $(CURDIR)/debian/netdata.conffiles; \ - done - sed -i "/^#PERMS#/d" $(CURDIR)/debian/netdata.postinst + packaging/bundle-ebpf.sh . ${TOP}/usr/libexec/netdata/plugins.d # Install go # @@ -86,7 +104,6 @@ override_dh_fixperms: # given extra capabilities in the postinst script. # chmod 0754 $(TOP)/usr/libexec/netdata/plugins.d/apps.plugin - chmod 0754 $(TOP)/usr/libexec/netdata/plugins.d/freeipmi.plugin chmod 0754 $(TOP)/usr/libexec/netdata/plugins.d/perf.plugin chmod 0754 $(TOP)/usr/libexec/netdata/plugins.d/slabinfo.plugin chmod 0750 $(TOP)/usr/libexec/netdata/plugins.d/go.d.plugin @@ -94,6 +111,9 @@ override_dh_fixperms: # CUPS plugin package chmod 0750 $(TOP)-plugin-cups/usr/libexec/netdata/plugins.d/cups.plugin + # freeIPMI plugin package + chmod 4750 $(TOP)-plugin-freeipmi/usr/libexec/netdata/plugins.d/freeipmi.plugin + override_dh_installlogrotate: cp system/netdata.logrotate debian/netdata.logrotate dh_installlogrotate @@ -104,5 +124,4 @@ override_dh_clean: # Tidy up copied/generated files # -[ -r $(CURDIR)/debian/netdata.logrotate ] && rm $(CURDIR)/debian/netdata.logrotate - -[ -r $(CURDIR)/debian/netdata.postinst ] && rm $(CURDIR)/debian/netdata.postinst -[ -r $(CURDIR)/debian/netdata.conffiles ] && rm $(CURDIR)/debian/netdata.conffiles diff --git a/contrib/rhel/build-netdata-rpm.sh b/contrib/rhel/build-netdata-rpm.sh index df33d806..9ce3863b 100755 --- a/contrib/rhel/build-netdata-rpm.sh +++ b/contrib/rhel/build-netdata-rpm.sh @@ -13,24 +13,33 @@ run autoreconf -ivf run ./configure --enable-maintainer-mode run make dist -version=$(grep PACKAGE_VERSION < config.h | cut -d '"' -f 2) -if [ -z "${version}" ] -then - echo >&2 "Cannot find netdata version." - exit 1 +typeset version="$(grep PACKAGE_VERSION < config.h | cut -d '"' -f 2)" +if [[ -z "${version}" ]]; then + run_failed "Cannot find netdata version." + exit 1 fi -tgz="netdata-${version}.tar.gz" -if [ ! -f "${tgz}" ] -then - echo >&2 "Cannot find the generated tar.gz file '${tgz}'" +if [[ "${version//-/}" != "$version" ]]; then + # Remove all -* and _* suffixes to be as close as netdata release + typeset versionfix="${version%%-*}"; versionfix="${versionfix%%_*}" + # Append the current datetime fox a 'unique' build + versionfix+="_$(date '+%m%d%H%M%S')" + # And issue hints & details on why this failed, and how to fix it + run_failed "Current version contains '-' which is fobidden by rpm. You must create a git annotated tag and rerun this script. Exemple:" + run_failed " git tag -a $versionfix -m 'Release by $(id -nu) on $(uname -n)' && $0" + exit 1 +fi + + +typeset tgz="netdata-${version}.tar.gz" +if [[ ! -f "${tgz}" ]]; then + run_failed "Cannot find the generated tar.gz file '${tgz}'" exit 1 fi -srpm=$(run rpmbuild -ts "${tgz}" | cut -d ' ' -f 2) -if [ -z "${srpm}" ] || [ ! -f "${srpm}" ] -then - echo >&2 "Cannot find the generated SRPM file '${srpm}'" +typeset srpm="$(run rpmbuild -ts "${tgz}" | cut -d ' ' -f 2)" +if [[ -z "${srpm}" ]] || ! [[ -f "${srpm}" ]]; then + run_failed "Cannot find the generated SRPM file '${srpm}'" exit 1 fi @@ -44,4 +53,4 @@ fi run rpmbuild --rebuild "${srpm}" -echo >&2 "All done!" +run_ok "All done! Packages created in '$(rpm -E '%_rpmdir/%_arch')'" diff --git a/contrib/sles11/README.md b/contrib/sles11/README.md index 2c938001..4cdf7e9f 100644 --- a/contrib/sles11/README.md +++ b/contrib/sles11/README.md @@ -1,6 +1,11 @@ +<!-- +title: "Spec to build Netdata RPM for sles 11" +custom_edit_url: https://github.com/netdata/netdata/edit/master/contrib/sles11/README.md +--> + # Spec to build Netdata RPM for sles 11 -Based on [opensuse rpm spec](https://build.opensuse.org/package/show/network/netdata) with some +Based on [openSUSE rpm spec](https://build.opensuse.org/package/show/network/netdata) with some changes and additions for sles 11 backport, namely: - init.d script |