summaryrefslogtreecommitdiffstats
path: root/packaging/installer/functions.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-04-26 16:22:17 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-04-26 16:22:17 +0000
commit58b482856cf37b0519e516ab8dc1105ba958f8b2 (patch)
tree0c46396e98741dfae4ce907bc8ef8c54418b3753 /packaging/installer/functions.sh
parentAdding upstream version 1.14.0~rc0. (diff)
downloadnetdata-58b482856cf37b0519e516ab8dc1105ba958f8b2.tar.xz
netdata-58b482856cf37b0519e516ab8dc1105ba958f8b2.zip
Adding upstream version 1.14.0.upstream/1.14.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/installer/functions.sh')
-rw-r--r--packaging/installer/functions.sh31
1 files changed, 22 insertions, 9 deletions
diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh
index 7016b4f3..4270c4ee 100644
--- a/packaging/installer/functions.sh
+++ b/packaging/installer/functions.sh
@@ -614,11 +614,11 @@ portable_add_user() {
portable_add_group() {
local groupname="${1}"
- # Check if group exist
+ # Check if group exist
if cut -d ':' -f 1 </etc/group | grep "^${groupname}$" 1>/dev/null 2>&1; then
- echo >&2 "Group '${groupname}' already exists."
- return 0
- fi
+ echo >&2 "Group '${groupname}' already exists."
+ return 0
+ fi
echo >&2 "Adding ${groupname} user group ..."
@@ -644,13 +644,13 @@ portable_add_group() {
portable_add_user_to_group() {
local groupname="${1}" username="${2}"
- # Check if group exist
+ # Check if group exist
if ! cut -d ':' -f 1 </etc/group | grep "^${groupname}$" >/dev/null 2>&1; then
- echo >&2 "Group '${groupname}' does not exist."
- return 1
- fi
+ echo >&2 "Group '${groupname}' does not exist."
+ return 1
+ fi
- # Check if user is in group
+ # Check if user is in group
if [[ ",$(grep "^${groupname}:" </etc/group | cut -d ':' -f 4)," =~ ,${username}, ]]; then
# username is already there
echo >&2 "User '${username}' is already in group '${groupname}'."
@@ -678,3 +678,16 @@ portable_add_user_to_group() {
return 1
fi
}
+
+
+safe_sha256sum() {
+ # Within the contexct of the installer, we only use -c option that is common between the two commands
+ # We will have to reconsider if we start non-common options
+ if command -v sha256sum >/dev/null 2>&1; then
+ sha256sum $@
+ elif command -v shasum >/dev/null 2>&1; then
+ shasum -a 256 $@
+ else
+ fatal "I could not find a suitable checksum binary to use"
+ fi
+}