mirror of
https://github.com/m8tin/cis.git
synced 2025-12-06 07:48:26 +01:00
Refactoring
This commit is contained in:
@@ -75,11 +75,11 @@ function printRepository(){
|
||||
# Note that an unprivileged user can use this script successfully,
|
||||
# if no user has to be added to the host because it already exists.
|
||||
function addAndCheckGitRepository() {
|
||||
local _FOLDER _REPOSITORY
|
||||
local _FOLDER _REPOSITORY _RIGHTS
|
||||
_FOLDER="${1:?"Missing first parameter FOLDER"}"
|
||||
_REPOSITORY="$(printRepository "${_FOLDER}" "${2}")"
|
||||
_RIGHTS="${3:?"Missing third parameter RIGHTS: (readonly, writable) "}"
|
||||
readonly _FOLDER _REPOSITORY
|
||||
_RIGHTS="${2:?"Missing third parameter RIGHTS: (readonly, writable) "}"
|
||||
_REPOSITORY="$(printRepository "${_FOLDER}" "${3}")"
|
||||
readonly _FOLDER _REPOSITORY _RIGHTS
|
||||
|
||||
echo \
|
||||
&& cloneOrPull "${_FOLDER}" "${_REPOSITORY:?"Missing REPOSITORY: e.g. ssh://git@your.domain.com/cis.git"}" \
|
||||
|
||||
@@ -29,9 +29,9 @@ function addNormalUser() {
|
||||
&& echo " - existing home directories were taken over" \
|
||||
&& return 0
|
||||
|
||||
echo "FAIL: The user could not be created: ("$(readlink -f ${0})")"
|
||||
echo " - '${_USER}'"
|
||||
echo " - due to an error or insufficient rights."
|
||||
echo "FAIL: The user could not be created: ("$(readlink -f ${0})")" >&2
|
||||
echo " - '${_USER}'" >&2
|
||||
echo " - due to an error or insufficient rights." >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@ function addToCrontabEveryHour() {
|
||||
&& echo " - '${_STRING}'" \
|
||||
&& return 0
|
||||
|
||||
echo "FAIL: Entry could not be registered to crontab: ("$(readlink -f ${0})")"
|
||||
echo " - '${_STRING:?"Missing CRON_STRING"}'"
|
||||
echo " - due to an error or insufficient rights."
|
||||
echo "FAIL: Entry could not be registered to crontab: ("$(readlink -f ${0})")" >&2
|
||||
echo " - '${_STRING:?"Missing CRON_STRING"}'" >&2
|
||||
echo " - due to an error or insufficient rights." >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@ function prepareFolder() {
|
||||
&& echo " - '${_SSH_FOLDER}'" \
|
||||
&& return 0
|
||||
|
||||
echo "FAIL: The ssh folder could not be prepared: ("$(readlink -f ${0})")"
|
||||
echo " - '${_SSH_FOLDER}'"
|
||||
echo " - due to an error or insufficient rights."
|
||||
echo "FAIL: The ssh folder could not be prepared: ("$(readlink -f ${0})")" >&2
|
||||
echo " - '${_SSH_FOLDER}'" >&2
|
||||
echo " - due to an error or insufficient rights." >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
@@ -196,8 +196,8 @@ function ensureUsageOfDefinitions() {
|
||||
&& echo "- '${_DEFINED_FULLFILE}'" \
|
||||
&& return 0
|
||||
|
||||
echo "FAIL: The definition could not be ensured: ("$(readlink -f ${0})")"
|
||||
echo " - due to an error or insufficient rights."
|
||||
echo "FAIL: The definition could not be ensured: ("$(readlink -f ${0})")" >&2
|
||||
echo " - due to an error or insufficient rights." >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user