aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2018-03-15 15:05:07 -0400
committerMitch Riedstra <mitch@riedstra.us>2018-03-15 15:05:07 -0400
commit59aaf11bdab54386d0518d10a6a9a0eccbc3f821 (patch)
tree563ec7df9640ffdd83bc8e4776ed3605e117c247
parent3091eb0c23def474921a5aec8fd53727cb50da98 (diff)
downloaddotfiles-59aaf11bdab54386d0518d10a6a9a0eccbc3f821.tar.gz
dotfiles-59aaf11bdab54386d0518d10a6a9a0eccbc3f821.tar.xz
FreeBSD /bin/sh support and fixed `pull` command
-rw-r--r--mkshrc21
1 files changed, 12 insertions, 9 deletions
diff --git a/mkshrc b/mkshrc
index 0a1440b..80259ae 100644
--- a/mkshrc
+++ b/mkshrc
@@ -303,13 +303,13 @@ pull() {
shift; shift; ;;
esac
done
- if [ -x $(which curl 2>/dev/null) ] ; then
- $(which curl 2>/dev/null) $url > $file
- elif [ -x $(which wget 2>/dev/null) ] ; then
- $(which wget 2>/dev/null) $url -O $file
- elif [ -x $(which fetch 2>/dev/null) ] ; then
- $(which fetch 2>/dev/null) $url -o $file
- fi
+ CMD="$(which curl wget fetch 2>/dev/null | tail -n1)"
+
+ case $CMD in
+ *curl) "$CMD" "$url" > "$file" ;;
+ *wget) "$CMD" "$url" -O "$file" ;;
+ *fetch) "$CMD" "$url" -o "$file" ;;
+ esac
}
pulldotfile() {
file="$1"
@@ -320,7 +320,8 @@ pullkeys() {
if ! [ -d $HOME/.ssh ] ; then mkdir $HOME/.ssh ; fi
chmod 700 $HOME/.ssh
chmod 600 $HOME/.ssh/authorized_keys
- mv "$HOME/.ssh/authorized_keys" "$HOME/.ssh/authorized_keys.$(timestamp)"
+ mv "$HOME/.ssh/authorized_keys" "$HOME/.ssh/authorized_keys.$(timestamp)" || \
+ echo "Authorized Keys do not exist"
pull -u "${UPDATE_URL}${file}" -f "$HOME/.ssh/authorized_keys"
chmod 600 $HOME/.ssh/authorized_keys
}
@@ -480,7 +481,9 @@ elif [ $SHELL = "/bin/zsh" ] ||
[ $SHELL = "/usr/bin/zsh" ] ||
[ $SHELL = "/usr/local/bin/zsh" ] ; then
set -o emacs
-
+elif [ $SHELL = "/bin/sh" ] && [ "$(uname)" = "FreeBSD" ] ; then
+ set -o emacs
+ export PS1="$(whoami)"'@\h:\w \$ '
else
[ $SHELL = "/bin/sh" ] && set_super_basic_prompt
fi