From ce1678ec45b4b0df1c3195b926410e62641de431 Mon Sep 17 00:00:00 2001 From: Galen Guyer Date: Fri, 5 Aug 2022 12:44:06 -0400 Subject: Add git module --- modules/40-git/install.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 modules/40-git/install.sh (limited to 'modules/40-git/install.sh') diff --git a/modules/40-git/install.sh b/modules/40-git/install.sh new file mode 100644 index 0000000..890db77 --- /dev/null +++ b/modules/40-git/install.sh @@ -0,0 +1,21 @@ +_script="$(realpath ${BASH_SOURCE[0]})" +_scriptname="$(basename $_script)" +_scriptdir="$(dirname $_script)" +_modulename="$(basename $_scriptdir)" + +function preinstall() { + if ! [[ -x "$(command -v git)" ]]; then + PACKAGES+=("git") + fi +} + +function install() { + # backup old file if it exists and we haven't backed it up before + if [[ -f "$HOME/.gitconfig" ]] && ! [[ -f "$HOME/.gitconfig.bak" ]] && ! [[ -f "$_scriptdir/.firstrun" ]]; then + echo "making backup" + cp "$HOME/.gitconfig" "$HOME/.gitconfig.bak" + touch "$_scriptdir/.firstrun" + fi + + ln -f "$_scriptdir/gitconfig" "$HOME/.gitconfig" +} -- cgit v1.2.3