mirror of
https://github.com/m8tin/cis.git
synced 2025-12-06 07:48:26 +01:00
removed use of dirname
This commit is contained in:
@@ -7,8 +7,7 @@
|
||||
|
||||
# Folders always ends with an tailing '/'
|
||||
_SCRIPT="$(readlink -f "${0}" 2> /dev/null)"
|
||||
_CORE_SCRIPTS="$(dirname ${_SCRIPT:?"Missing SCRIPT"} 2> /dev/null)/"
|
||||
_CIS_ROOT="$(dirname ${_CORE_SCRIPTS:?"Missing CORE_SCRIPTS"} 2> /dev/null)/"
|
||||
_CIS_ROOT="${_SCRIPT%%/core/*}/" #Removes longest matching pattern '/core/*' from the end
|
||||
|
||||
# Note that an unprivileged user can use this script successfully,
|
||||
# if no user has to be added to the host because it already exists.
|
||||
|
||||
@@ -126,8 +126,8 @@ function ensureUsageOfDefinitions() {
|
||||
_DEFINITIONS="$(printIfEqual "${_DEFINITIONS}" "${_CIS_ROOT:?"Missing ROOT"}definitions/${_DOMAIN:?"Missing DOMAIN"}/")"
|
||||
|
||||
|
||||
_CURRENT_FOLDER="$(dirname "${2:?"Missing second parameter CURRENT_FULLFILE"}")"
|
||||
_CURRENT_FOLDER="${_CURRENT_FOLDER%/}/" #Removes shortest matching pattern '/' from the end
|
||||
_CURRENT_FULLFILE="${2:?"Missing second parameter CURRENT_FULLFILE"}"
|
||||
_CURRENT_FOLDER="${_CURRENT_FULLFILE%/*}/" #Removes shortest matching pattern '/*' from the end
|
||||
! [ -d "${_CURRENT_FOLDER}" ] \
|
||||
&& echo "FAIL: The folder cannot be read: ("$(readlink -f ${0})")" \
|
||||
&& echo " - '${_CURRENT_FOLDER}'" \
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
_SCRIPT="$(readlink -f "${0}" 2> /dev/null)"
|
||||
_SCRIPT_FOLDER="$(dirname ${_SCRIPT:?"Missing SCRIPT"} 2> /dev/null)/"
|
||||
_CIS_ROOT="$(dirname ${_SCRIPT_FOLDER:?"Missing SCRIPT_FOLDER"} 2> /dev/null)/"
|
||||
_CIS_ROOT="${_SCRIPT%%/core/*}/" #Removes longest matching pattern '/core/*' from the end
|
||||
|
||||
[ -d "${_CIS_ROOT}" ] \
|
||||
&& [ -d "${_CIS_ROOT}definitions/" ] \
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
|
||||
# Folders always ends with an tailing '/'
|
||||
_SCRIPT="$(readlink -f "${0}" 2> /dev/null)"
|
||||
_CORE_SCRIPTS="$(dirname ${_SCRIPT:?"Missing SCRIPT"} 2> /dev/null)/"
|
||||
_CIS_ROOT="$(dirname ${_CORE_SCRIPTS:?"Missing CORE_SCRIPTS"} 2> /dev/null)/"
|
||||
_CIS_ROOT="${_SCRIPT%%/core/*}/" #Removes longest matching pattern '/core/*' from the end
|
||||
_OVERRIDE_DOMAIN_FILE="${_CIS_ROOT:?"Missing CIS_ROOT"}overrideOwnDomain"
|
||||
|
||||
# There has to be one dot at least.
|
||||
|
||||
Reference in New Issue
Block a user