diff --git a/install.sh b/install.sh index 00ba6844..92dff366 100755 --- a/install.sh +++ b/install.sh @@ -36,7 +36,7 @@ unset CDPATH function logError() { local -r msg=$1 - shift 1 || die "could not shift by 1" + shift 1 || traceAndDie "could not shift by 1" # shellcheck disable=SC2059 printf >&2 "\033[0;31mERROR\033[0m: $msg\n" "$@" } @@ -48,14 +48,14 @@ function die() { function logSuccess() { local -r msg=$1 - shift 1 || die "could not shift by 1" + shift 1 || traceAndDie "could not shift by 1" # shellcheck disable=SC2059 printf "\033[0;32mSUCCESS\033[0m: $msg\n" "$@" } function logInfo() { local msg=$1 - shift || die "could not shift by 1" + shift 1 || traceAndDie "could not shift by 1" # shellcheck disable=SC2059 printf "\033[0;34mINFO\033[0m: $msg\n" "$@" } @@ -76,7 +76,7 @@ function exitIfCommandDoesNotExist() { function deleteDirChmod777() { local -r dir=$1 - shift 1 || die "could not shift by 1" + shift 1 || traceAndDie "could not shift by 1" # e.g files in .git will be write-protected and we don't want sudo for this command # yet, if it fails, then we ignore the problem and still try to delete the folder chmod -R 777 "$dir" || true @@ -103,7 +103,7 @@ function install() { local -r tag=$1 local -r installDir=$2 local -r symbolicLink=$3 - shift 3 || die "could not shift by 3" + shift 3 || traceAndDie "could not shift by 3" local -r versionRegex="^(v[0-9]+)\.([0-9]+)\.[0-9]+(-RC[0-9]+)?$" if ! grep -Eq "$versionRegex" >/dev/null <<<"$tag"; then diff --git a/scripts/prepare-next-dev-cycle.sh b/scripts/prepare-next-dev-cycle.sh index 949cd07f..7dc280fb 100755 --- a/scripts/prepare-next-dev-cycle.sh +++ b/scripts/prepare-next-dev-cycle.sh @@ -32,7 +32,7 @@ sourceOnce "$scriptsDir/before-pr.sh" sourceOnce "$scriptsDir/update-version-in-non-sh-files.sh" function prepareNextDevCycle() { - source "$dir_of_tegonal_scripts/releasing/common-constants.source.sh" || die "could not source common-constants.source.sh" + source "$dir_of_tegonal_scripts/releasing/common-constants.source.sh" || traceAndDie "could not source common-constants.source.sh" # shellcheck disable=SC2034 # they seem unused but are necessary in order that parseArguments doesn't create global readonly vars local version projectsRootDir additionalPattern beforePrFn diff --git a/scripts/release.sh b/scripts/release.sh index d084c064..c93a982d 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -33,7 +33,7 @@ sourceOnce "$scriptsDir/prepare-next-dev-cycle.sh" sourceOnce "$scriptsDir/update-version-in-non-sh-files.sh" function release() { - source "$dir_of_tegonal_scripts/releasing/common-constants.source.sh" || die "could not source common-constants.source.sh" + source "$dir_of_tegonal_scripts/releasing/common-constants.source.sh" || traceAndDie "could not source common-constants.source.sh" local version # shellcheck disable=SC2034 # they seem unused but are necessary in order that parseArguments doesn't create global readonly vars diff --git a/scripts/update-version-in-non-sh-files.sh b/scripts/update-version-in-non-sh-files.sh index da272d82..c9601869 100755 --- a/scripts/update-version-in-non-sh-files.sh +++ b/scripts/update-version-in-non-sh-files.sh @@ -37,7 +37,7 @@ sourceOnce "$dir_of_tegonal_scripts/releasing/update-version-scripts.sh" sourceOnce "$dir_of_tegonal_scripts/utility/parse-args.sh" function updateVersionInNonShFiles() { - source "$dir_of_tegonal_scripts/releasing/common-constants.source.sh" || die "could not source common-constants.source.sh" + source "$dir_of_tegonal_scripts/releasing/common-constants.source.sh" || traceAndDie "could not source common-constants.source.sh" local version projectsRootDir additionalPattern parseArguments afterVersionHookParams "" "$GT_VERSION" "$@" diff --git a/src/gt-pull.sh b/src/gt-pull.sh index 63b361fc..98e520ae 100755 --- a/src/gt-pull.sh +++ b/src/gt-pull.sh @@ -64,7 +64,7 @@ function gt_pull() { local -r currentDir local pulledTsvLatestVersionPragma pulledTsvHeader - source "$dir_of_gt/common-constants.source.sh" || die "could not source common-constants.source.sh" + source "$dir_of_gt/common-constants.source.sh" || traceAndDie "could not source common-constants.source.sh" local -r UNSECURE_NO_VERIFY_PATTERN='--unsecure-no-verification' local remote tag path pullDir chopPath workingDir autoTrust unsecure forceNoVerification @@ -145,14 +145,14 @@ function gt_pull() { exitIfRemoteDirDoesNotExist "$workingDirAbsolute" "$remote" local publicKeysDir repo gpgDir pulledTsv pullHookFile - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" if ! [[ -d $pullDirAbsolute ]]; then mkdir -p "$pullDirAbsolute" || die "failed to create the pull directory %s" "$pullDirAbsolute" fi if ! [[ -f $pulledTsv ]]; then - echo "$pulledTsvLatestVersionPragma"$'\n'"$pulledTsvHeader" >"$pulledTsv" || die "failed to initialise the pulled.tsv file at %s" "$pulledTsv" + echo "$pulledTsvLatestVersionPragma"$'\n'"$pulledTsvHeader" >"$pulledTsv" || die "failed to initialise the pulled.tsv file at \033[0;36m%s\033[0m" "$pulledTsv" else exitIfHeaderOfPulledTsvIsWrong "$pulledTsv" fi @@ -162,7 +162,7 @@ function gt_pull() { local tagToPull="$tag" # tag was actually omitted, so we use the latest remote tag instead if [[ $tag == "$fakeTag" ]]; then - tagToPull=$(latestRemoteTagIncludingChecks "$workingDirAbsolute" "$remote") || die "could not determine latest tag, see above" + tagToPull=$(latestRemoteTagIncludingChecks "$workingDirAbsolute" "$remote") || die "could not determine latest tag of remote \033[0;36m%s\033[0m, see above" "$remote" fi local -r tagToPull @@ -261,7 +261,7 @@ function gt_pull() { local pullHookAfter="gt_pull_noop" if [[ -f $pullHookFile ]]; then # shellcheck disable=SC2310 # we are aware of that || will disable set -e for sourceOnce - sourceOnce "$pullHookFile" || die "could not source %s" "$pullHookFile" + sourceOnce "$pullHookFile" || traceAndDie "could not source %s" "$pullHookFile" pullHookBefore="gt_pullHook_${remote//-/_}_before" pullHookAfter="gt_pullHook_${remote//-/_}_after" fi diff --git a/src/gt-re-pull.sh b/src/gt-re-pull.sh index a9861e33..62be2f07 100755 --- a/src/gt-re-pull.sh +++ b/src/gt-re-pull.sh @@ -54,7 +54,7 @@ function gt_re_pull() { startTime=$(date +%s.%3N) local defaultWorkingDir - source "$dir_of_gt/common-constants.source.sh" || die "could not source common-constants.source.sh" + source "$dir_of_gt/common-constants.source.sh" || traceAndDie "could not source common-constants.source.sh" local -r onlyMissingPattern="--only-missing" @@ -100,7 +100,7 @@ function gt_re_pull() { function gt_re_pull_incrementError() { local -r entryFile=$1 local -r remote=$2 - shift 2 || die "could not shift by 2" + shift 2 || traceAndDie "could not shift by 2" logError "could not pull \033[0;36m%s\033[0m from remote %s" "$entryFile" "$remote" ((++errors)) } @@ -108,10 +108,10 @@ function gt_re_pull() { # shellcheck disable=SC2317 # called by name function gt_re_pull_rePullInternal() { local -r remote=$1 - shift 1 || die "could not shift by 1" + shift 1 || traceAndDie "could not shift by 1" local repo - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" function gt_re_pull_rePullInternal_callback() { local entryTag entryFile _entryRelativePath entryAbsolutePath @@ -140,7 +140,7 @@ function gt_re_pull() { function gt_re_pull_rePullRemote() { local -r remote=$1 - shift 1 || die "could not shift by 1" + shift 1 || traceAndDie "could not shift by 1" withCustomOutputInput 5 6 gt_re_pull_rePullInternal "$remote" } diff --git a/src/gt-remote.sh b/src/gt-remote.sh index 32c9fd8b..c72a6c57 100755 --- a/src/gt-remote.sh +++ b/src/gt-remote.sh @@ -53,7 +53,7 @@ function gt_remote_cleanupRemoteOnUnexpectedExit() { local -r remoteDir=$1 local -r currentDir=$2 - shift 2 || die "could not shift by 2" + shift 2 || traceAndDie "could not shift by 2" if ! ((result == 0)) && [[ -d $remoteDir ]]; then deleteDirChmod777 "$remoteDir" @@ -61,7 +61,7 @@ function gt_remote_cleanupRemoteOnUnexpectedExit() { } function gt_remote_add() { - source "$dir_of_gt/common-constants.source.sh" || die "could not source common-constants.source.sh" + source "$dir_of_gt/common-constants.source.sh" || traceAndDie "could not source common-constants.source.sh" local currentDir currentDir=$(pwd) || die "could not determine currentDir, maybe it does not exist anymore?" @@ -126,7 +126,7 @@ function gt_remote_add() { mkdir -p "$workingDirAbsolute/remotes" || die "was not able to create directory %s" "$workingDirAbsolute/remotes" local remoteDir publicKeysDir repo gpgDir pullArgsFile gitconfig - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" if [[ -f $remoteDir ]]; then die "cannot create remote directory, there is a file at this location: %s" "$remoteDir" @@ -229,7 +229,7 @@ function gt_remote_list_raw() { local remotesDir local -r remote="not really a remote but paths.source.sh requires it, hence we set it here but don't use it afterwards" - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" local cutLength cutLength=$((${#remotesDir} + 2)) @@ -254,7 +254,7 @@ function gt_remote_list() { } function gt_remote_remove() { - source "$dir_of_gt/common-constants.source.sh" || die "could not source common-constants.source.sh" + source "$dir_of_gt/common-constants.source.sh" || traceAndDie "could not source common-constants.source.sh" local remote workingDir # shellcheck disable=SC2034 # is passed by name to parseArguments @@ -286,7 +286,7 @@ function gt_remote_remove() { local -r workingDirAbsolute local remoteDir pulledTsv pullHookFile - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" if [[ -f $remoteDir ]]; then logError "cannot delete remote \033[0;36m%s\033[0m, looks like it is broken there is a file at this location: %s" "$remote" "$remoteDir" diff --git a/src/gt-reset.sh b/src/gt-reset.sh index b3cca1cd..1d368f62 100755 --- a/src/gt-reset.sh +++ b/src/gt-reset.sh @@ -55,7 +55,7 @@ sourceOnce "$dir_of_tegonal_scripts/utility/parse-args.sh" function gt_reset() { local defaultWorkingDir unsecureParamPattern - source "$dir_of_gt/common-constants.source.sh" || die "could not source common-constants.source.sh" + source "$dir_of_gt/common-constants.source.sh" || traceAndDie "could not source common-constants.source.sh" local remote workingDir # shellcheck disable=SC2034 # is passed by name to parseArguments @@ -97,7 +97,7 @@ function gt_reset() { exitIfRepoBrokenAndReInitIfAbsent "$workingDirAbsolute" "$remote" local publicKeysDir gpgDir repo pullArgsFile - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" if [[ -d $publicKeysDir ]]; then logInfo "Going to re-establish gpg trust in remote \033[0;36m%s\033[0m, removing %s" "$remote" "$publicKeysDir" deleteDirChmod777 "$publicKeysDir" || die "could not delete the public keys dir of remote \033[0;36m%s\033[0m" "$remote" @@ -170,7 +170,7 @@ function gt_reset() { if [[ -n $remote ]]; then #shellcheck disable=SC2310 # we know that set -e is disabled for gt_reset_resetRemote due to || - gt_reset_resetRemote "$remote" || die "could not remove gpg directory for remote %s, see above" "$remote" + gt_reset_resetRemote "$remote" || die "could not remove gpg directory for remote \033[0;36m%s\033[0m, see above" "$remote" if [[ $gpgOnly != true ]]; then gt_re_pull -w "$workingDirAbsolute" --only-missing false -r "$remote" fi diff --git a/src/gt-self-update.sh b/src/gt-self-update.sh index 80c2b7e4..23404d67 100755 --- a/src/gt-self-update.sh +++ b/src/gt-self-update.sh @@ -87,7 +87,7 @@ function gt_self_update() { printf ", but '%s true' was specified, going to re-install it\n" "$forcePattern" fi fi - cd "$currentDir" || die "could not cd back to the current dir" + cd "$currentDir" || die "could not cd back to the current dir %s" "$currentDir" else logInfo "looks like you did not install gt via install.sh (%s does not exist)" "$installDir/.git" if ! askYesOrNo "Do you want to run the following command to replace the current installation with the latest version:\ninstall.sh --directory \"%s\"" "$installDir"; then @@ -99,7 +99,7 @@ function gt_self_update() { local tmpDir tmpDir=$(mktemp -d -t gt-install-XXXXXXXXXX) cp -r "$installDir" "$tmpDir/gt" - cd "$tmpDir/gt" || die "could not cd to the tmpDir, see above" + cd "$tmpDir/gt" || die "could not cd to the tmpDir %s, see above" "$tmpDir/gt" ./install.sh --directory "$installDir" } diff --git a/src/gt-update.sh b/src/gt-update.sh index aec475bb..2270540d 100755 --- a/src/gt-update.sh +++ b/src/gt-update.sh @@ -51,7 +51,7 @@ function gt_update() { startTime=$(date +%s.%3N) local defaultWorkingDir - source "$dir_of_gt/common-constants.source.sh" || die "could not source common-constants.source.sh" + source "$dir_of_gt/common-constants.source.sh" || traceAndDie "could not source common-constants.source.sh" local remote workingDir autoTrust tag # shellcheck disable=SC2034 # is passed by name to parseFnArgs @@ -98,7 +98,7 @@ function gt_update() { function gt_update_incrementError() { local -r entryFile=$1 local -r remote=$2 - shift 2 || die "could not shift by 2" + shift 2 || traceAndDie "could not shift by 2" logError "could not pull \033[0;36m%s\033[0m from remote %s" "$entryFile" "$remote" ((++errors)) } @@ -106,7 +106,7 @@ function gt_update() { # shellcheck disable=SC2317 # called by name function gt_update_rePullInternal() { local -r remote=$1 - shift 1 || die "could not shift by 1" + shift 1 || traceAndDie "could not shift by 1" local tagToPull if [[ -n $tag ]]; then @@ -135,7 +135,7 @@ function gt_update() { function gt_update_rePullRemote() { local -r remote=$1 - shift 1 || die "could not shift by 1" + shift 1 || traceAndDie "could not shift by 1" exitIfRemoteDirDoesNotExist "$workingDir" "$remote" diff --git a/src/gt.sh b/src/gt.sh index ea69a87c..3fe4db38 100755 --- a/src/gt.sh +++ b/src/gt.sh @@ -65,7 +65,7 @@ sourceOnce "$dir_of_tegonal_scripts/utility/parse-commands.sh" function gt_source() { local -r command=$1 - shift || die "could not shift by 1" + shift 1 || traceAndDie "could not shift by 1" sourceOnce "$dir_of_gt/gt-$command.sh" } diff --git a/src/install/include-install-doc.sh b/src/install/include-install-doc.sh index 7be04a61..a4d9b3a5 100755 --- a/src/install/include-install-doc.sh +++ b/src/install/include-install-doc.sh @@ -67,7 +67,7 @@ function includeInstallDoc() { # using unconventional naming in order to avoid name clashes with the variables we will initialise further below local -r installDocSh=$1 local -rn includeInstallDoc_files=$2 - shift 2 || die "could not shift by 2" + shift 2 || traceAndDie "could not shift by 2" if ! [[ -f "$installDocSh" ]]; then returnDying "%s does not exist" "$installDocSh" @@ -98,7 +98,7 @@ function includeInstallDoc() { perl -0777 -i \ -pe "s@(\n\s+# see install.doc.sh.*\n)[^#]+(# end install.doc.sh\n)@\${1}$content\n$indent\${2}@g" \ "$file" || return $? - done || die "could not replace the install instructions" + done || traceAndDie "could not replace the install instructions" } ${__SOURCED__:+return} diff --git a/src/pulled-utils.sh b/src/pulled-utils.sh index 877e2248..68bc80df 100644 --- a/src/pulled-utils.sh +++ b/src/pulled-utils.sh @@ -41,11 +41,11 @@ function pulledTsvEntry() { function migratePulledTsvFormat() { local pulledTsvLatestVersionPragma - source "$dir_of_gt/common-constants.source.sh" || die "could not source common-constants.source.sh" + source "$dir_of_gt/common-constants.source.sh" || traceAndDie "could not source common-constants.source.sh" local -r pulledTsv=$1 local -r fromVersion=$2 local -r toVersion=$3 - shift 3 || die "could not shift by 2" + shift 3 || traceAndDie "could not shift by 2" if [[ $fromVersion == "unspecified" ]]; then # pulled.tsv without version pragma, convert to current @@ -60,10 +60,10 @@ function migratePulledTsvFormat() { function exitIfHeaderOfPulledTsvIsWrong() { local -r pulledTsv=$1 - shift 1 || die "could not shift by 1" + shift 1 || traceAndDie "could not shift by 1" local pulledTsvLatestVersion pulledTsvLatestVersionPragma pulledTsvHeader - source "$dir_of_gt/common-constants.source.sh" || die "could not source common-constants.source.sh" + source "$dir_of_gt/common-constants.source.sh" || traceAndDie "could not source common-constants.source.sh" local currentVersionPragma currentHeader currentVersionPragma="$(head -n 1 "$pulledTsv")" || die "could not read the current pulled.tsv at %s" "$pulledTsv" @@ -100,7 +100,7 @@ function setEntryVariables() { function grepPulledEntryByFile() { local -r pulledTsv=$1 local -r file=$2 - shift 2 || die "could not shift by 2" + shift 2 || traceAndDie "could not shift by 2" grep -E "^[^\t]+ $file" "$@" "$pulledTsv" } @@ -124,7 +124,7 @@ function readPulledTsv() { exitIfArgIsNotFunction "$readPulledTsv_callback" 3 local pulledTsv - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" if ! [[ -f $pulledTsv ]]; then logWarning "Looks like remote \033[0;36m%s\033[0m is broken or no file has been fetched so far, there is no pulled.tsv, skipping it" "$remote" return 0 diff --git a/src/utils.sh b/src/utils.sh index 9d92166b..70ce43fa 100644 --- a/src/utils.sh +++ b/src/utils.sh @@ -43,13 +43,13 @@ function exitBecauseNoGpgKeysImported() { function findAscInDir() { local -r dir=$1 - shift 1 || die "could not shift by 1" + shift 1 || traceAndDie "could not shift by 1" find "$dir" -maxdepth 1 -type f -name "*.asc" "$@" } function noAscInDir() { local -r dir=$1 - shift 1 || die "could not shift by 1" + shift 1 || traceAndDie "could not shift by 1" local numberOfAsc #shellcheck disable=SC2310 # we are aware of that set -e is disabled for findAscInDir numberOfAsc=$(findAscInDir "$dir" | wc -l) || die "could not determine the number of *.asc files in dir %s, see errors above (use \`gt reset\` to re-import the remote's GPG keys)" "$dir" @@ -58,10 +58,10 @@ function noAscInDir() { function checkWorkingDirExists() { local workingDirAbsolute=$1 - shift 1 || die "could not shift by 1" + shift 1 || traceAndDie "could not shift by 1" local workingDirParamPattern - source "$dir_of_gt/common-constants.source.sh" || die "could not source common-constants.source.sh" + source "$dir_of_gt/common-constants.source.sh" || traceAndDie "could not source common-constants.source.sh" if ! [[ -d $workingDirAbsolute ]]; then logError "working directory \033[0;36m%s\033[0m does not exist" "$workingDirAbsolute" @@ -82,7 +82,7 @@ function exitIfRemoteDirDoesNotExist() { parseFnArgs params "$@" local remoteDir - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" if ! [[ -d $remoteDir ]]; then logError "remote \033[0;36m%s\033[0m does not exist, check for typos.\nFollowing the remotes which exist:" "$remote" @@ -94,7 +94,7 @@ function exitIfRemoteDirDoesNotExist() { function invertBool() { local b=$1 - shift 1 || die "could not shift by 1" + shift 1 || traceAndDie "could not shift by 1" if [[ $b == true ]]; then echo "false" else @@ -104,9 +104,9 @@ function invertBool() { function gitDiffChars() { local hash1 hash2 - hash1=$(git hash-object -w --stdin <<<"$1") || die "cannot calculate hash for string: %" "$1" - hash2=$(git hash-object -w --stdin <<<"$2") || die "cannot calculate hash for string: %" "$2" - shift 2 || die "could not shift by 2" + hash1=$(git hash-object -w --stdin <<<"$1") || traceAndDie "cannot calculate hash for string: %" "$1" + hash2=$(git hash-object -w --stdin <<<"$2") || traceAndDie "cannot calculate hash for string: %" "$2" + shift 2 || traceAndDie "could not shift by 2" git --no-pager diff "$hash1" "$hash2" \ --word-diff=color --word-diff-regex . --ws-error-highlight=all | @@ -120,7 +120,7 @@ function initialiseGitDir() { parseFnArgs params "$@" local repo gitconfig - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" mkdir -p "$repo" || die "could not create the repo at %s" "$repo" git --git-dir="$repo/.git" init || die "could not git init the repo at %s" "$repo" @@ -138,7 +138,7 @@ function askToDeleteAndReInitialiseGitDirIfRemoteIsBroken() { parseFnArgs params "$@" local repo gitconfig - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" if ! git --git-dir="$repo/.git" remote | grep "$remote" >/dev/null; then logError "looks like the .git directory of remote \033[0;36m%s\033[0m is broken. There is no remote %s set up in its gitconfig. Following the remotes:" "$remote" "$remote" @@ -164,7 +164,7 @@ function reInitialiseGitDirIfDotGitNotPresent() { parseFnArgs params "$@" local repo - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" if ! [[ -d "$repo/.git" ]]; then logInfo "repo directory (or its .git directory) does not exist for remote \033[0;36m%s\033[0m. We are going to re-initialise it based on the stored gitconfig" "$remote" @@ -176,7 +176,7 @@ function reInitialiseGitDirIfDotGitNotPresent() { function initialiseGpgDir() { local -r gpgDir=$1 - shift 1 || die "could not shift by 1" + shift 1 || traceAndDie "could not shift by 1" mkdir "$gpgDir" || die "could not create the gpg directory at %s" "$gpgDir" # it's OK if we are not able to set the rights as we only use it temporary. This will cause warnings by gpg # so the user could be aware of that something went wrong @@ -190,10 +190,10 @@ function latestRemoteTagIncludingChecks() { parseFnArgs params "$@" local repo - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" local tagParamPattern - source "$dir_of_gt/common-constants.source.sh" || die "could not source common-constants.source.sh" + source "$dir_of_gt/common-constants.source.sh" || traceAndDie "could not source common-constants.source.sh" logInfo >&2 "no tag provided via argument %s, will determine latest and use it instead" "$tagParamPattern" local tag @@ -211,7 +211,7 @@ function validateGpgKeysAndImport() { exitIfArgIsNotFunction "$validateGpgKeysAndImport_callback" 4 local autoTrustParamPattern - source "$dir_of_gt/common-constants.source.sh" || die "could not source common-constants.source.sh" + source "$dir_of_gt/common-constants.source.sh" || traceAndDie "could not source common-constants.source.sh" local -r sigExtension="sig" @@ -276,16 +276,16 @@ function importRemotesPulledPublicKeys() { exitIfArgIsNotFunction "$importRemotesPulledPublicKeys_callback" 3 local gpgDir publicKeysDir repo - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" # shellcheck disable=SC2317 # called by name function importRemotesPublicKeys_importKeyCallback() { local -r publicKey=$1 local -r sig=$2 - shift 2 || die "could not shift by 2" + shift 2 || traceAndDie "could not shift by 2" - mv "$publicKey" "$publicKeysDir/" || die "unable to move public key %s into public keys directory %s" "$publicKey" "$publicKeysDir" - mv "$sig" "$publicKeysDir/" || die "unable to move the public key's signature %s into public keys directory %s" "$sig" "$publicKeysDir" + mv "$publicKey" "$publicKeysDir/" || die "unable to move public key \033[0;36m%s\033[0m into public keys directory %s" "$publicKey" "$publicKeysDir" + mv "$sig" "$publicKeysDir/" || die "unable to move the public key's signature \033[0;36m%s\033[0m into public keys directory %s" "$sig" "$publicKeysDir" "$importRemotesPulledPublicKeys_callback" "$publicKey" "$sig" } validateGpgKeysAndImport "$repo/.gt" "$gpgDir" "$publicKeysDir" importRemotesPublicKeys_importKeyCallback false @@ -300,7 +300,7 @@ function determineDefaultBranch() { parseFnArgs params "$@" local repo - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" git --git-dir "$repo/.git" remote show "$remote" | sed -n '/HEAD branch/s/.*: //p' || ( @@ -316,7 +316,7 @@ function checkoutGtDir() { parseFnArgs params "$@" local repo - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" git -C "$repo" fetch --depth 1 "$remote" "$branch" || die "was not able to \033[0;36mgit fetch\033[0m from remote \033[0;36m%s\033[0m" "$remote" # execute as if we are inside repo as we want to checkout there, remove all folders @@ -330,7 +330,7 @@ function exitIfRepoBrokenAndReInitIfAbsent() { parseFnArgs params "$@" local remoteDir repo - source "$dir_of_gt/paths.source.sh" || die "could not source paths.source.sh" + source "$dir_of_gt/paths.source.sh" || traceAndDie "could not source paths.source.sh" if [[ -f $repo ]]; then die "looks like the remote \033[0;36m%s\033[0m is broken there is a file at the repo's location: %s" "$remote" "$remoteDir"