Skip to content

Instantly share code, notes, and snippets.

@coffeemancy
Last active December 22, 2016 16:09
Show Gist options
  • Save coffeemancy/f36345cfe8aabf7383127b8e108e6030 to your computer and use it in GitHub Desktop.
Save coffeemancy/f36345cfe8aabf7383127b8e108e6030 to your computer and use it in GitHub Desktop.
Setup oh-my-zsh on remote server when supplied SSHFN
#!/usr/bin/env bash
set -euo pipefail
export IFS=$'\n\t'
SSHFN=$@
ohmyzsh="curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -o \~/install.sh"
# replace "clark" with non-admin user
if [[ $SSHFN == *"clark"* ]]; then
echo "Skipping package updates because clark..."
else
set -x
eval $SSHFN "sudo yum makecache fast" \
|| eval $SSHFN "sudo apt-get update"
eval $SSHFN "sudo yum install -y git zsh vim tmux" \
|| eval $SSHFN "sudo apt-get install -y git zsh vim tmux"
set +x
fi
set -x
eval $SSHFN $ohmyzsh
eval $SSHFN "zsh \~/install.sh"
eval $SSHFN "sed -i 's/robbyrussell/norm/g' \~/.zshrc"
set +x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment