From 4744842ce6c574e923a7872db248ab5eaf402c0c Mon Sep 17 00:00:00 2001 From: Vasili Svirydau Date: Tue, 23 Mar 2021 16:26:57 -0700 Subject: [PATCH] Added setup scripts --- bash.d/10-prompt.sh | 4 +++- setup.d/10-shellcheck.sh | 6 ++++++ setup.d/10-starship.sh | 9 +++++++++ setup.sh | 3 +++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 setup.d/10-shellcheck.sh create mode 100755 setup.d/10-starship.sh diff --git a/bash.d/10-prompt.sh b/bash.d/10-prompt.sh index 8b6727b..d4163b5 100644 --- a/bash.d/10-prompt.sh +++ b/bash.d/10-prompt.sh @@ -1,3 +1,5 @@ #!/bin/bash -eval "$(starship init bash)" +if test -x starship; then + eval "$(starship init bash)" +fi diff --git a/setup.d/10-shellcheck.sh b/setup.d/10-shellcheck.sh new file mode 100755 index 0000000..3dd3eb3 --- /dev/null +++ b/setup.d/10-shellcheck.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +if ! command -v shellcheck > /dev/null; then + sudo apt update > /dev/null && sudo apt install shellcheck > /dev/null; + echo "Installed Shellcheck" +fi diff --git a/setup.d/10-starship.sh b/setup.d/10-starship.sh new file mode 100755 index 0000000..0616056 --- /dev/null +++ b/setup.d/10-starship.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if ! test -x /usr/local/bin/starship; then + curl -fsSL https://starship.rs/install.sh | bash +fi + +if ! grep starship ~/.bashrc > /dev/null; then + echo "eval \"\$(starship init bash)\"" >> ~/.bashrc +fi diff --git a/setup.sh b/setup.sh index cd3e504..4b6603c 100755 --- a/setup.sh +++ b/setup.sh @@ -39,6 +39,9 @@ find . -maxdepth 1 -type f -printf "%f\0" | while IFS= read -r -d $'\0' P; do chmod -R o-rwx,g-rwx "$target" done +for f in $DOTFILES/setup.d/*.sh; do source "$f"; done +unset f; + ( echo "for f in \"$DOTFILES/bash.d/*.sh\"; do source \"\$f\"; done" echo "unset f"