From 319d65f21be07da082b965a539da5c8ff9598093 Mon Sep 17 00:00:00 2001 From: Max Kovgan Date: Mon, 26 Feb 2024 14:04:39 +0200 Subject: [PATCH] implement #2241 - update `install.sh` & `uninstall.sh` - update `README.md` Signed-off-by: Max Kovgan --- docs/README.md | 7 +++++++ install.sh | 7 +++++++ uninstall.sh | 3 +++ 3 files changed, 17 insertions(+) diff --git a/docs/README.md b/docs/README.md index b307a7abfd..44c438babe 100644 --- a/docs/README.md +++ b/docs/README.md @@ -46,6 +46,13 @@ That's it! :smiley: You can check out more components of Bash-it, and customize it to your desire. For more information, see detailed instructions [here](https://bash-it.readthedocs.io/en/latest/installation/). +### custom configuration file location + +By default the instller modifies/creates the actual ``~/.bashrc`` is updated. +If this is undesirable, you can create another file, by run the installer: +```bash +BASH_IT_CONFIG_FILE=path/to/my/custom/location.bash ~/.bash_it/install.sh +``` ## Contributing diff --git a/install.sh b/install.sh index 58c25537b6..4063f516ed 100755 --- a/install.sh +++ b/install.sh @@ -194,6 +194,13 @@ case $OSTYPE in ;; esac +# overriding CONFIG_FILE: +CONFIG_FILE="${BASH_IT_CONFIG_FILE:-"${CONFIG_FILE}"}" +# create subdir if CONFIG_FILE has subdirectory components +if [[ "${CONFIG_FILE%/*}" != "${CONFIG_FILE}" ]]; then + mkdir -p "${HOME}/${CONFIG_FILE%/*}" +fi + BACKUP_FILE=$CONFIG_FILE.bak echo "Installing bash-it" if [[ -z "${no_modify_config}" ]]; then diff --git a/uninstall.sh b/uninstall.sh index 1771261060..f1e559bdcf 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -13,6 +13,9 @@ case $OSTYPE in ;; esac +# overriding CONFIG_FILE: +CONFIG_FILE="${BASH_IT_CONFIG_FILE:-"${CONFIG_FILE}"}" + BACKUP_FILE=$CONFIG_FILE.bak if [ ! -e "$HOME/$BACKUP_FILE" ]; then