diff --git a/bash.d/10-paths.sh b/bash.d/10-paths.sh new file mode 100644 index 0000000..29e5aaf --- /dev/null +++ b/bash.d/10-paths.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +export PATH="./node_modules/.bin;$PATH" +export PATH="$HOME/.cargo/bin;$PATH" diff --git a/bash.d/10-prompt.sh b/bash.d/10-prompt.sh index 65d394d..78756c2 100644 --- a/bash.d/10-prompt.sh +++ b/bash.d/10-prompt.sh @@ -2,10 +2,5 @@ PROMPT_SUBMODULE="${SUBMODULES}/romkatv-gitstatus" -if ls -A "$PROMPT_SUBMODULE"; then - git submodule init - git submodule update -fi - # shellcheck disable=SC1090 source "$PROMPT_SUBMODULE/gitstatus.prompt.sh" diff --git a/dotfiles/.angular-config.json b/dotfiles/.angular-config.json new file mode 100644 index 0000000..20d8187 --- /dev/null +++ b/dotfiles/.angular-config.json @@ -0,0 +1,6 @@ +{ + "version": 1, + "cli": { + "analytics": false + } +} \ No newline at end of file diff --git a/gitconfig b/dotfiles/.gitconfig similarity index 100% rename from gitconfig rename to dotfiles/.gitconfig diff --git a/htoprc b/dotfiles/.htoprc similarity index 100% rename from htoprc rename to dotfiles/.htoprc diff --git a/rubocop.yml b/dotfiles/.rubocop.yml similarity index 100% rename from rubocop.yml rename to dotfiles/.rubocop.yml diff --git a/tmux.conf b/dotfiles/.tmux.conf similarity index 100% rename from tmux.conf rename to dotfiles/.tmux.conf diff --git a/setup.sh b/setup.sh index ed96531..910e4a7 100755 --- a/setup.sh +++ b/setup.sh @@ -1,34 +1,41 @@ #!/bin/bash +OLD_PWD=$PWD +timestamp=$(date '+%m%d%Y%H%M') + +function finish { + cd "$OLD_PWD" || exit; +} + +trap finish EXIT + # From aaronjensen/dotfiles +DOTFILES=$( cd "$(dirname "${BASH_SOURCE[0]}")" && pwd || return) -cd "$(dirname "$0")" -F=$( pwd |sed -e "s#$HOME/\?##" ) +cd "$DOTFILES/dotfiles" || exit; -for P in * -do - # skip setup - if [ "$P" = "setup.sh" ]; then continue; fi - if [ "$P" = "README.md" ]; then continue; fi +find . -maxdepth 1 -type f -printf "%f\0" | while IFS= read -r -d $'\0' P; do + target="${HOME}/${P}" + backup="${HOME}/${P}.orig.${timestamp}" - # ensure permissions - chmod -R o-rwx,g-rwx "$P" + # skip existing links + if [ -h "$target" ]; then continue; fi - # skip existing links - if [ -h "$HOME/.$P" ]; then continue; fi + # move existing dir out of the way + if [ -e "$target" ]; then + if [ -e "$backup" ]; then + echo "want to override $target but backup exists" + continue; + fi - # move existing dir out of the way - if [ -e "$HOME/.$P" ]; then - if [ -e "$HOME/__$P" ]; then - echo "want to override $HOME/.$P but backup exists" - continue; + echo -n "Backup ${P}" + mv -v "$target" "$backup" fi - echo -n "Backup " - mv -v "$HOME/.$P" "$HOME/__$P" - fi + # create link + ln -v -s "$PWD/$P" "$target" - # create link - echo -n "Link " - ln -v -s "$F/$P" "$HOME/.$P" + # ensure permissions + chmod -R o-rwx,g-rwx "$target" done +