2021-01-08 10:29:43 +00:00
|
|
|
#!/usr/bin/env bash
|
2020-10-12 13:04:21 +00:00
|
|
|
|
2020-11-05 19:51:35 +00:00
|
|
|
# Copyright (c) 2018-2020 Status Research & Development GmbH. Licensed under
|
2020-10-12 13:04:21 +00:00
|
|
|
# either of:
|
|
|
|
# - Apache License, version 2.0
|
|
|
|
# - MIT license
|
|
|
|
# at your option. This file may not be copied, modified, or distributed except
|
|
|
|
# according to those terms.
|
|
|
|
|
2020-11-05 19:51:35 +00:00
|
|
|
[[ -z "$1" ]] && { echo "Usage: $(basename $0) path"; exit 1; }
|
|
|
|
|
|
|
|
if uname | grep -qiE "mingw|msys"; then
|
|
|
|
ON_WINDOWS=1
|
|
|
|
else
|
|
|
|
ON_WINDOWS=0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${ON_WINDOWS}" == "1" ]]; then
|
|
|
|
if [[ ! -d "$1" ]]; then
|
2020-10-12 13:04:21 +00:00
|
|
|
# Create full path.
|
2020-11-05 19:51:35 +00:00
|
|
|
mkdir -p "$1";
|
|
|
|
# Remove all inherited access from path $1 ACL and grant full access rights
|
2020-10-27 11:04:17 +00:00
|
|
|
# to current user only in $1 ACL.
|
2020-11-05 19:51:35 +00:00
|
|
|
icacls "$1" /inheritance:r /grant:r $USERDOMAIN\\$USERNAME:\(OI\)\(CI\)\(F\)&>/dev/null;
|
2020-10-12 13:04:21 +00:00
|
|
|
fi
|
|
|
|
else
|
2020-10-30 00:36:47 +00:00
|
|
|
# Create full path with proper permissions.
|
|
|
|
mkdir -m 0700 -p $1
|
2020-10-12 13:04:21 +00:00
|
|
|
fi
|
2020-11-05 19:51:35 +00:00
|
|
|
|