sz-prep-docker-system script added
This commit is contained in:
parent
8238a75408
commit
51b56a4a38
2 changed files with 81 additions and 0 deletions
28
_home/dot_sz.shrc.d/01_util.functions
Normal file
28
_home/dot_sz.shrc.d/01_util.functions
Normal file
|
@ -0,0 +1,28 @@
|
|||
error() {
|
||||
(>&2 printf '\E[31mERROR:\E[0m %s\n' "$@" )
|
||||
}
|
||||
|
||||
require_root() {
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
error "This script should only be run using sudo or as the root user"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function setacl() {
|
||||
if [[ $# -lt 4 ]]; then
|
||||
error "setacl missing arguments, called with '$1' ${@:2}"
|
||||
return 1
|
||||
fi
|
||||
local Options=${1}
|
||||
local Ownership=${2}
|
||||
local Permissions=${3}
|
||||
|
||||
[[ -n "${SZ_DEBUG}" ]] \
|
||||
&& echo "chown $Options $Ownership \"${@:4}\""
|
||||
chown $Options $Ownership "${@:4}"
|
||||
[[ -n "${SZ_DEBUG}" ]] \
|
||||
&& echo "chmod $Options $Permissions \"${@:4}\""
|
||||
chmod $Options $Permissions "${@:4}"
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue