From 3232beff25d4f11e49806b670ed95adf80fc58fc Mon Sep 17 00:00:00 2001 From: Hans Goor Date: Sun, 1 Sep 2024 21:25:42 +0200 Subject: [PATCH] Add a fallback function to the config.sh in case the stowing failed but the module is required. --- install.sh | 1 + stowers/git/config.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/install.sh b/install.sh index fe6fb04..22e79ba 100755 --- a/install.sh +++ b/install.sh @@ -44,6 +44,7 @@ install_stower() { --dir "${STOWERS_DIR}" \ --target "${TARGET_DIR}" \ --ignore "config.sh" "${stower_name}" || \ + { [[ "$(type -t fallback)" == "function" ]] && fallback "${stower_dir}" "${TARGET_DIR}"; } || \ { echo "[!] [${stower_name}] Failed to install!" >&2; return 1; } echo "[+] [${stower_name}] Installed!" diff --git a/stowers/git/config.sh b/stowers/git/config.sh index 8ea9ae7..2fe01b8 100644 --- a/stowers/git/config.sh +++ b/stowers/git/config.sh @@ -1,3 +1,16 @@ #!/bin/bash COMMAND_DEPS=("git") + +fallback() { + local stower_dir target_dir + stower_dir="$1" + target_dir="$2" + + git config --global user.name "Hans Goor" + git config --global user.email "me@eyedevelop.org" + git config --global commit.gpgSign true + git config --global push.autoSetupRemote true + git config --global init.defaultBranch main + git config --global pull.rebase true +}