diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2021-01-22 20:22:08 -0500 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2021-01-23 11:02:04 -0500 |
| commit | cee85ee94fbcd38b2cd506f51e4308f81c622247 (patch) | |
| tree | e2eebefbba46ab09df1936f7e2eb10d9a2264012 /shell/update | |
| parent | 9fb0d9bba9b51096be32c47a92e04c5199bdf3ab (diff) | |
| download | dotfiles-cee85ee94fbcd38b2cd506f51e4308f81c622247.tar.gz dotfiles-cee85ee94fbcd38b2cd506f51e4308f81c622247.tar.xz | |
Update the shell configuration a bit
Diffstat (limited to 'shell/update')
| -rw-r--r-- | shell/update | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/shell/update b/shell/update index a130285..6d2f764 100644 --- a/shell/update +++ b/shell/update @@ -11,7 +11,7 @@ pull() { shift; shift; ;; esac done - CMD="$(which curl wget fetch 2>/dev/null | tail -n1)" + CMD="$(command -v curl wget fetch 2>/dev/null | tail -n1)" case $CMD in *curl) "$CMD" "$url" > "$file" ;; @@ -26,9 +26,9 @@ pulldotfile() { } _make_ssh_dir_if_not_exists() { auth_keys="$HOME/.ssh/authorized_keys" - if ! [ -d $HOME/.ssh ] ; then mkdir $HOME/.ssh ; fi - chmod 700 $HOME/.ssh - chmod 600 $auth_keys + if ! [ -d "$HOME/.ssh" ] ; then mkdir "$HOME/.ssh" ; fi + chmod 700 "$HOME/.ssh" + chmod 600 "$auth_keys" } _pullkeys() { url="$1"; shift @@ -42,7 +42,7 @@ _pullkeys() { ssh-keygen -lf "$auth_keys" || \ mv "${auth_keys}.${_timestamp}" "$auth_keys" - chmod 600 $auth_keys + chmod 600 "$auth_keys" } pullkeys() { file="keys/$1"; shift; @@ -56,20 +56,20 @@ pullkeys_github() { } pulltermcolors() { file="$HOME/bin/terminal-colors" - if ! [ -d $HOME/bin ] ; then - mkdir $HOME/bin + if ! [ -d "$HOME/bin" ] ; then + mkdir "$HOME/bin" fi - pull -u ${UPDATE_URL}/util/terminal-colors -f $file - chmod +x $file + pull -u "${UPDATE_URL}/util/terminal-colors" -f "$file" + chmod +x "$file" } updatetmuxconf() { pulldotfile "tmux/tmux.conf" pulldotfile "tmux/tmux_helper.sh" - if ! [ -e $HOME/.tmux.conf.local ] && [ `id -u` -eq 0 ] ; then + if ! [ -e "$HOME/.tmux.conf.local" ] && [ "$(id -u)" -eq 0 ] ; then # If I ever change the color from green this will have to be updated I guess - grep 'green' $HOME/.tmux.conf | sed -e's/green/red/g' > $HOME/.tmux.conf.local - elif ! [ -e $HOME/.tmux.conf.local ] ; then - touch $HOME/.tmux.conf.local + grep 'green' "$HOME/.tmux.conf" | sed -e's/green/red/g' > "$HOME/.tmux.conf.local" + elif ! [ -e "$HOME/.tmux.conf.local" ] ; then + touch "$HOME/.tmux.conf.local" fi } updategitconf() { @@ -78,24 +78,25 @@ updategitconf() { } updateshell() { pulldotfile "mkshrc" - . $HOME/.mkshrc + #shellcheck disable=SC1090 + . "$HOME/.mkshrc" } updatevimrc() { OLDWD="$(pwd)" + #shellcheck disable=SC2164 cd "$HOME" git clone --recurse-submodules "$VIM_GIT_URL" .vim exit="$?" - cd $HOME/.vim || { echo "Cannot cd to .vim dir" ; return; } + cd "$HOME/.vim" || { echo "Cannot cd to .vim dir" ; return; } if [ "$exit" -gt 0 ] ; then git pull origin master git submodule update fi ./link-vimrc.sh - cd $OLDWD + #shellcheck disable=SC2164 + cd "$OLDWD" } updatevimrc_basic() { pull -u "$VIM_BASIC_URL" -f ~/.vimrc } - - |
