This commit is contained in:
thek4n 2025-03-25 11:25:05 +03:00
parent c2d4b02cb6
commit f216ea9e5e

13
install
View File

@ -19,7 +19,7 @@ export SUB
_die() { _die() {
echo "$(basename "${0}"): ${1}" >&2 printf '%s: %s\n' "$(basename "${0}")" "${1}" >&2
exit "${2}" exit "${2}"
} }
@ -54,7 +54,7 @@ map_key_exists() (
_link_files_in_sandbox() ( _link_files_in_sandbox() (
for targetfile in "$@" for targetfile in "$@"
do do
echo "installing: ${targetfile}" printf 'installing: %s\n' "${targetfile}"
if [ "$(string_get_first_char "${targetfile}")" = "%" ]; then if [ "$(string_get_first_char "${targetfile}")" = "%" ]; then
files="$(map_get_value "${TARGETS}" "$(string_exclude_first_char "${targetfile}")")" files="$(map_get_value "${TARGETS}" "$(string_exclude_first_char "${targetfile}")")"
#shellcheck disable=SC2086 #shellcheck disable=SC2086
@ -97,7 +97,7 @@ _execute_hook_if_executable() (
hook_path="${DOTFILES_ROOT}/install-hooks/${target}/${hook_name}" hook_path="${DOTFILES_ROOT}/install-hooks/${target}/${hook_name}"
if [ -x "${hook_path}" ]; then if [ -x "${hook_path}" ]; then
echo "Executing ${hook_name} for target '${target}'" printf 'Executing %s for target "%s"\n' "${hook_name}" "${target}"
"${hook_path}" "${hook_path}"
fi fi
) )
@ -160,14 +160,13 @@ is_target_installed() (
is_target_installed "$(string_exclude_first_char "${targetfile}")" || not_fully_installed=true is_target_installed "$(string_exclude_first_char "${targetfile}")" || not_fully_installed=true
else else
if [ ! -e "${TARGET_PATH}/${targetfile}" ]; then if [ ! -e "${TARGET_PATH}/${targetfile}" ]; then
echo "${targetfile} not linked" printf '%s not linked\n' "${targetfile}"
not_fully_installed=true not_fully_installed=true
fi fi
fi fi
done done
if ${not_fully_installed}; then if ${not_fully_installed}; then
echo "Target '${1}' not fully installed" printf 'Target "%s" not fully installed\n\n' "${target}"
echo
return 1 return 1
fi fi
return 0 return 0
@ -179,7 +178,7 @@ find_targets_that_depend_on() (
files="$(map_get_value "${TARGETS}" "${target}")" files="$(map_get_value "${TARGETS}" "${target}")"
if map_key_exists "${TARGETS}" "%${1}"; then if map_key_exists "${TARGETS}" "%${1}"; then
echo "${target}" printf '%s\n' "${target}"
fi fi
done done
) )