aboutsummaryrefslogtreecommitdiff
path: root/shell/update
diff options
context:
space:
mode:
Diffstat (limited to 'shell/update')
-rw-r--r--shell/update102
1 files changed, 0 insertions, 102 deletions
diff --git a/shell/update b/shell/update
deleted file mode 100644
index 6d2f764..0000000
--- a/shell/update
+++ /dev/null
@@ -1,102 +0,0 @@
-pull() {
- url=""
- file=""
- while [ $# -gt 0 ] ; do
- case $1 in
- -f)
- file="$2"
- shift; shift; ;;
- -u)
- url="$2"
- shift; shift; ;;
- esac
- done
- CMD="$(command -v 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"
- destfile="$(basename "${file}")"
- pull -u "${UPDATE_URL}${file}" -f "$HOME/.${destfile}"
-}
-_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"
-}
-_pullkeys() {
- url="$1"; shift
- _timestamp="$(timestamp)"
- _make_ssh_dir_if_not_exists
- auth_keys="$HOME/.ssh/authorized_keys"
- mv "$auth_keys" "${auth_keys}.${_timestamp}" || \
- echo "Authorized Keys do not currently exist"
- pull -u "$url" -f "$auth_keys" || \
- mv "${auth_keys}.${_timestamp}" "$auth_keys"
- ssh-keygen -lf "$auth_keys" || \
- mv "${auth_keys}.${_timestamp}" "$auth_keys"
-
- chmod 600 "$auth_keys"
-}
-pullkeys() {
- file="keys/$1"; shift;
- url="${UPDATE_URL}${file}"
- _pullkeys "$url"
-}
-pullkeys_github() {
- _username="$1"; shift;
- url="https://github.com/${_username}.keys"
- _pullkeys "$url"
-}
-pulltermcolors() {
- file="$HOME/bin/terminal-colors"
- if ! [ -d "$HOME/bin" ] ; then
- mkdir "$HOME/bin"
- fi
- 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 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"
- fi
-}
-updategitconf() {
- file="gitconfig/$1"
- pull -u "${UPDATE_URL}${file}" -f "$HOME/.gitconfig"
-}
-updateshell() {
- pulldotfile "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; }
- if [ "$exit" -gt 0 ] ; then
- git pull origin master
- git submodule update
- fi
- ./link-vimrc.sh
- #shellcheck disable=SC2164
- cd "$OLDWD"
-}
-updatevimrc_basic() {
- pull -u "$VIM_BASIC_URL" -f ~/.vimrc
-}
-