Add platform infrastructure configuration
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PATH='/usr/sbin:/usr/bin:/sbin:/bin'
|
||||
export PATH
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
umask 077
|
||||
|
||||
_k3slrhp_inherited_namespace_is_clean() {
|
||||
if compgen -A function _k3slrh_ >/dev/null; then return 1; fi
|
||||
if compgen -A variable K3SLRH_ >/dev/null; then return 1; fi
|
||||
if compgen -A variable _K3SLRH_ >/dev/null; then return 1; fi
|
||||
if compgen -A variable K3SLR_ >/dev/null; then return 1; fi
|
||||
}
|
||||
|
||||
if ! _k3slrhp_inherited_namespace_is_clean; then
|
||||
return 1 2>/dev/null || exit 1
|
||||
fi
|
||||
|
||||
_k3slrh_wrapper_initial_guard() {
|
||||
local effective_uid="${1-}" shell_options="${2-}"
|
||||
(( $# == 2 )) || return 1
|
||||
[[ "$effective_uid" =~ ^[0-9]+$ && "$effective_uid" != 0 ]] || return 1
|
||||
[[ "$shell_options" != *x* ]]
|
||||
}
|
||||
|
||||
if ! _k3slrh_wrapper_initial_guard "${EUID:-}" "$-"; then
|
||||
return 1 2>/dev/null || exit 1
|
||||
fi
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == */* ]]; then
|
||||
K3SLRH_WRAPPER_DIRECTORY="${BASH_SOURCE[0]%/*}"
|
||||
else
|
||||
K3SLRH_WRAPPER_DIRECTORY='.'
|
||||
fi
|
||||
K3SLRH_REPOSITORY_ROOT="$(cd -- "${K3SLRH_WRAPPER_DIRECTORY}/../.." && pwd -P)" || {
|
||||
return 1 2>/dev/null || exit 1
|
||||
}
|
||||
K3SLRH_CONTRACT_PATH="${K3SLRH_REPOSITORY_ROOT}/infrastructure/security/k3s/local-recovery.env"
|
||||
readonly K3SLRH_WRAPPER_DIRECTORY K3SLRH_REPOSITORY_ROOT K3SLRH_CONTRACT_PATH
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
builtin source "${K3SLRH_REPOSITORY_ROOT}/scripts/lib/k3s-local-recovery.sh" || {
|
||||
return 1 2>/dev/null || exit 1
|
||||
}
|
||||
# shellcheck source=/dev/null
|
||||
builtin source "${K3SLRH_REPOSITORY_ROOT}/scripts/lib/k3s-local-recovery-a1.sh" || {
|
||||
return 1 2>/dev/null || exit 1
|
||||
}
|
||||
# shellcheck source=/dev/null
|
||||
builtin source "${K3SLRH_REPOSITORY_ROOT}/scripts/lib/k3s-local-recovery-header-proof.sh" || {
|
||||
return 1 2>/dev/null || exit 1
|
||||
}
|
||||
|
||||
_k3slr_load_contract "$K3SLRH_CONTRACT_PATH" || {
|
||||
return 1 2>/dev/null || exit 1
|
||||
}
|
||||
readonly K3SLR_SCHEMA_VERSION K3SLR_RECOVERY_DISK_BY_ID K3SLR_RECOVERY_PARTITION_BY_ID
|
||||
readonly K3SLR_RECOVERY_FS_UUID K3SLR_RECOVERY_PARTUUID K3SLR_RECOVERY_MODEL
|
||||
readonly K3SLR_RECOVERY_SERIAL K3SLR_RECOVERY_WWN K3SLR_K3S_DISK_BY_ID
|
||||
readonly K3SLR_K3S_PARTITION_BY_ID K3SLR_K3S_FS_UUID K3SLR_K3S_PARTUUID
|
||||
readonly K3SLR_K3S_MODEL K3SLR_K3S_SERIAL K3SLR_K3S_WWN K3SLR_OWNER_UID
|
||||
readonly K3SLR_OWNER_GID K3SLR_OUTER_MOUNT K3SLR_INNER_MOUNT K3SLR_ROOT_RELATIVE
|
||||
readonly K3SLR_DATABASE_RELATIVE K3SLR_CONTAINER_RELATIVE K3SLR_RUNTIME_METADATA_RELATIVE
|
||||
readonly K3SLR_MAPPING_NAME K3SLR_PROOF_MAPPING_NAME K3SLR_INNER_LABEL
|
||||
readonly K3SLR_CONTAINER_SIZE_BYTES K3SLR_MINIMUM_FREE_BYTES K3SLR_OUTER_MIN_REMAINING_PERCENT
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
_k3slrh_header_proof_main "$@"
|
||||
fi
|
||||
Reference in New Issue
Block a user