add os-based versions of get_octal_perms

pull/245/head
joshr 6 years ago
parent 2e7d6a12a5
commit ffc50acd6a

@ -16,6 +16,7 @@ _SECRETS_DIR_PATHS_MAPPING="${_SECRETS_DIR_PATHS}/mapping.cfg"
# Commands:
: "${SECRETS_GPG_COMMAND:="gpg"}"
: "${SECRETS_CHECKSUM_COMMAND:="_os_based __sha256"}"
: "${SECRETS_OCTAL_PERMS_COMMAND:="_os_based __get_octal_perms"}"
# AWK scripts:
@ -204,6 +205,11 @@ function _unique_filename {
echo "$result"
}
#function _get_octal_perms {
# local file=$1
# perms=$(stat -f "'%a'" "$filename")
#}
# Helper function

@ -16,3 +16,9 @@ function __temp_file_linux {
function __sha256_linux {
sha256sum "$1"
}
function __get_octal_perms_linux {
local file=$1
perms=$(stat --format "'%a'" "$filename")
echo "$perms"
}

@ -18,3 +18,9 @@ function __temp_file_osx {
function __sha256_osx {
/usr/bin/shasum -a256 "$1"
}
function __get_octal_perms_osx {
local file=$1
local perms
perms=$(stat -f "'%p'" "$filename")
echo "$perms"
}

Loading…
Cancel
Save