summaryrefslogtreecommitdiffstats
path: root/packaging/installer/functions.sh
diff options
context:
space:
mode:
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 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
+}