diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-04-26 16:22:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-04-26 16:22:55 +0000 |
commit | caf1a5281f9e974ba73ceded3a782db3d0142c5f (patch) | |
tree | a09197b1fd2e984a0e8598e7007deb2a8e1969d7 /packaging/installer/functions.sh | |
parent | Releasing debian version 1.14.0~rc0-1. (diff) | |
download | netdata-caf1a5281f9e974ba73ceded3a782db3d0142c5f.tar.xz netdata-caf1a5281f9e974ba73ceded3a782db3d0142c5f.zip |
Merging upstream version 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.sh | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh index 7016b4f34..4270c4ee0 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 +} |