aboutsummaryrefslogtreecommitdiffstats
path: root/coin/provisioning/common/unix/telegraf_install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'coin/provisioning/common/unix/telegraf_install.sh')
-rwxr-xr-xcoin/provisioning/common/unix/telegraf_install.sh83
1 files changed, 31 insertions, 52 deletions
diff --git a/coin/provisioning/common/unix/telegraf_install.sh b/coin/provisioning/common/unix/telegraf_install.sh
index b2dd244e..7e1f8a47 100755
--- a/coin/provisioning/common/unix/telegraf_install.sh
+++ b/coin/provisioning/common/unix/telegraf_install.sh
@@ -1,37 +1,6 @@
-#!/bin/sh
-
-#############################################################################
-##
-## Copyright (C) 2019 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the provisioning scripts of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:LGPL21$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see http://www.qt.io/terms-conditions. For further
-## information use the contact form at http://www.qt.io/contact-us.
-##
-## GNU Lesser General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU Lesser
-## General Public License version 2.1 or version 3 as published by the Free
-## Software Foundation and appearing in the file LICENSE.LGPLv21 and
-## LICENSE.LGPLv3 included in the packaging of this file. Please review the
-## following information to ensure the GNU Lesser General Public License
-## requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-##
-## As a special exception, The Qt Company gives you certain additional
-## rights. These rights are described in The Qt Company LGPL Exception
-## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+#!/bin/bash
+# Copyright (C) 2019 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
# This script installs telegraf and ioping and our script telegraf-ioping.sh
@@ -46,46 +15,56 @@
######################## BOILERPLATE ###########################
set -e
-
PROVISIONING_DIR="$(dirname "$0")/../../"
-. "$PROVISIONING_DIR"/common/unix/common.sourced.sh
-
-. "$PROVISIONING_DIR"/common/unix/DownloadURL.sh
+# shellcheck source=./common.sourced.sh
+source "$PROVISIONING_DIR"/common/unix/common.sourced.sh
+# shellcheck source=./DownloadURL.sh
+source "$PROVISIONING_DIR"/common/unix/DownloadURL.sh
-is_script_executed telegraf_install.sh \
+is_script_executed telegraf_install.sh \
|| fatal "Script telegraf_install.sh should be executed, not sourced"
################################################################
-[ "$PROVISIONING_OS" = linux ] \
- && ioping_sha256=259abf04bcb84f4126ff97c04b6651e1cf5ea6d8a9ff364c769a26c95b6eeb44 \
- || ioping_sha256=55de6a2f1a5343e0ce8df31d82d47a9e79c7e612edbc6dfb39b5fc6fb358b2e3
-DownloadURL "http://ci-files01-hki.intra.qt.io/input/ioping/ioping.${PROVISIONING_OS}-${PROVISIONING_ARCH}" \
- '' "$ioping_sha256" ioping
+if [ "$PROVISIONING_OS" = linux ]
+then ioping_sha256=259abf04bcb84f4126ff97c04b6651e1cf5ea6d8a9ff364c769a26c95b6eeb44
+else ioping_sha256=55de6a2f1a5343e0ce8df31d82d47a9e79c7e612edbc6dfb39b5fc6fb358b2e3
+fi
+
+DownloadURL "http://ci-files01-hki.ci.qt.io/input/ioping/ioping.${PROVISIONING_OS}-${PROVISIONING_ARCH}" \
+ '' "$ioping_sha256" ioping
$CMD_INSTALL -m 755 ./ioping /usr/bin/
rm -f ioping
# 2. Install custom ioping monitoring script
-$CMD_INSTALL -m 755 "$PROVISIONING_DIR"/common/shared/telegraf/telegraf-ioping.sh /usr/bin/
+$CMD_INSTALL -m 755 "$PROVISIONING_DIR"/common/shared/telegraf/telegraf-ioping.sh /usr/bin/
# 3. Download and install telegraf
-[ x"$PROVISIONING_OS" = xmacos ] && os=darwin || os=linux
-[ x"$PROVISIONING_ARCH" = xx86 ] && arch=i386 || arch=amd64
+if [ "$PROVISIONING_OS" = macos ]
+then os=darwin
+else os=linux
+fi
+
+if [ "$PROVISIONING_ARCH" = x86 ]
+then arch=i386
+else arch=amd64
+fi
+
package_filename=telegraf-1.12.6_${os}_${arch}.tar.gz
package_sha256_list="$PROVISIONING_DIR"/common/shared/telegraf/telegraf_packages.sha256.txt
package_sha256=$(sed -n "s/.*$package_filename *//p" "$package_sha256_list")
-DownloadURL \
- http://ci-files01-hki.intra.qt.io/input/telegraf/"$package_filename" \
- https://dl.influxdata.com/telegraf/releases/"$package_filename" \
- "$package_sha256" \
+DownloadURL \
+ http://ci-files01-hki.ci.qt.io/input/telegraf/"$package_filename" \
+ https://dl.influxdata.com/telegraf/releases/"$package_filename" \
+ "$package_sha256" \
telegraf.tar.gz
tar -xzf ./telegraf.tar.gz -C /tmp
telegraf_binary=$(find /tmp/telegraf* -name telegraf -type f | grep /bin/ | head -1)
-$CMD_INSTALL -m 755 "$telegraf_binary" /usr/bin/
+$CMD_INSTALL -m 755 "$telegraf_binary" /usr/bin/
rm -rf /tmp/telegraf*
# 4. Edit config file with passwords