2021-11-29 08:07:17 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-12-03 17:12:52 +00:00
|
|
|
export PATH="/home/linuxbrew/.linuxbrew/bin:/opt/homebrew/bin/:$PATH"
|
2021-11-29 08:07:17 +00:00
|
|
|
|
|
|
|
GITEMAIL=$(git config --get user.email)
|
|
|
|
|
|
|
|
[ -d ~/.additional_dotfiles ] || (mkdir -p ~/.additional_dotfiles && touch ~/.additional_dotfiles/credentials)
|
2021-12-03 18:20:33 +00:00
|
|
|
[ -d /usr/local/share/zsh/site-functions ] || (sudo mkdir -p /usr/local/share/zsh/site-functions && sudo chmod 777 /usr/local/share/zsh/site-functions)
|
2021-11-29 08:07:17 +00:00
|
|
|
|
|
|
|
# Install homebrew
|
|
|
|
which brew >/dev/null || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
|
|
|
|
|
|
echo "🔵 Setting up zsh"
|
|
|
|
|
|
|
|
# Install oh-my-zsh
|
|
|
|
printf "Cloning oh-my-zsh..."
|
2021-12-03 17:12:52 +00:00
|
|
|
[ -d ${HOME}/.oh-my-zsh ] || sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
2021-11-29 08:07:17 +00:00
|
|
|
printf " ✅\n"
|
|
|
|
|
|
|
|
# Install ZSH plugins
|
|
|
|
printf "Cloning zsh plugins..."
|
2021-12-03 17:12:52 +00:00
|
|
|
[ -d ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-autosuggestions ] || git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
|
|
|
|
[ -d ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
|
2021-11-29 08:07:17 +00:00
|
|
|
printf " ✅\n"
|
|
|
|
|
|
|
|
# Install tools
|
|
|
|
BREW_TOOLS=(
|
|
|
|
argocd bandwhich bat danielfoehrkn/switch/switch derailed/k9s/k9s dive dog duf dust exa fd fzf
|
2022-01-04 11:46:34 +00:00
|
|
|
git-delta go helm homebrew/cask-fonts/font-open-dyslexic-nerd-font htop jq kind krew
|
2021-11-29 08:07:17 +00:00
|
|
|
kubectl kubectx kustomize node procs progress ripgrep rs/tap/curlie rust starship
|
2022-01-20 08:57:46 +00:00
|
|
|
tektoncd/tools/tektoncd-cli tldr tailscale yq hashicorp/tap/vault stats
|
2022-01-09 19:03:45 +00:00
|
|
|
tabby
|
2021-11-29 08:07:17 +00:00
|
|
|
)
|
|
|
|
CARGO_TOOLS=( macchina bottom )
|
|
|
|
NODE_TOOLS=( git-split-diffs )
|
2022-01-07 08:03:52 +00:00
|
|
|
KREW_TOOLS=( gs outdated tree stern )
|
2021-11-29 08:07:17 +00:00
|
|
|
|
|
|
|
echo "🔵 Installing / updating tools"
|
|
|
|
|
|
|
|
# Homebrew
|
|
|
|
export HOMEBREW_NO_INSTALL_CLEANUP=true
|
|
|
|
for tool in "${BREW_TOOLS[@]}"
|
|
|
|
do
|
|
|
|
printf "${tool}..."
|
|
|
|
brew upgrade ${tool} &>/dev/null || brew install ${tool} &>/dev/null
|
|
|
|
printf " ✅\n"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Cargo
|
|
|
|
for tool in "${CARGO_TOOLS[@]}"
|
|
|
|
do
|
|
|
|
printf "${tool}..."
|
|
|
|
cargo install ${tool} &>/dev/null
|
|
|
|
printf " ✅\n"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Krew
|
|
|
|
kubectl-krew update &>/dev/null
|
|
|
|
for tool in "${KREW_TOOLS[@]}"
|
|
|
|
do
|
|
|
|
printf "${tool}..."
|
|
|
|
kubectl-krew upgrade ${tool} &>/dev/null || kubectl-krew install ${tool} &>/dev/null
|
|
|
|
printf " ✅\n"
|
|
|
|
done
|
|
|
|
|
2021-12-03 17:12:52 +00:00
|
|
|
fulllink() {
|
|
|
|
if [ ! -z `which greadlink` ]
|
|
|
|
then
|
|
|
|
greadlink -f $1
|
2021-12-03 18:20:33 +00:00
|
|
|
else
|
2021-12-03 17:12:52 +00:00
|
|
|
readlink -f $1
|
|
|
|
fi
|
|
|
|
}
|
2021-11-29 08:07:17 +00:00
|
|
|
|
|
|
|
echo "🔵 OS Specific setup"
|
|
|
|
echo "Detected OS type: ${OSTYPE}"
|
|
|
|
|
|
|
|
case "${OSTYPE}" in
|
|
|
|
*linux*)
|
|
|
|
# Do stuff
|
|
|
|
;;
|
|
|
|
*darwin*)
|
|
|
|
# Mac specific setup
|
2021-12-03 18:20:33 +00:00
|
|
|
MAC_BREW_TOOLS=( pinentry-mac gpg gawk coreutils wget )
|
2021-11-29 08:07:17 +00:00
|
|
|
for tool in "${MAC_BREW_TOOLS[@]}"
|
|
|
|
do
|
|
|
|
printf "${tool}..."
|
|
|
|
brew upgrade ${tool} &>/dev/null || brew install ${tool} &>/dev/null
|
|
|
|
printf " ✅\n"
|
|
|
|
done
|
2021-12-03 18:20:33 +00:00
|
|
|
|
2021-11-29 08:07:17 +00:00
|
|
|
|
2021-12-24 10:29:45 +00:00
|
|
|
FILES=$(/usr/bin/find ./os-specific/darwin/home -maxdepth 1 -mindepth 1 | tr '\n' ' ')
|
2021-11-29 08:07:17 +00:00
|
|
|
for file in $FILES
|
|
|
|
do
|
2021-12-03 17:12:52 +00:00
|
|
|
f=$(fulllink "${file}")
|
|
|
|
dst="${HOME}/$(basename "./os-specific/darwin/home/${file}")"
|
|
|
|
printf "Linking ${f}=>${dst}"
|
|
|
|
ln -sfn ${f} ${dst}
|
2021-11-29 08:07:17 +00:00
|
|
|
printf " ✅\n"
|
|
|
|
done
|
2021-12-03 17:12:52 +00:00
|
|
|
|
|
|
|
[ -f "/usr/local/bin/pinentry-mac" ] || sudo ln -s `which pinentry-mac` /usr/local/bin/pinentry-mac
|
|
|
|
gpgconf --kill gpg-agent
|
|
|
|
|
|
|
|
if [ $(gpg --list-secret-keys --keyid-format=long 2>/dev/null | wc -l | xargs) -eq 0 ]; then
|
|
|
|
echo "⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️"
|
|
|
|
echo "⚠️ You'll need to create a new GPG key ⚠️"
|
|
|
|
echo "⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️"
|
|
|
|
fi
|
2022-01-09 14:28:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Handle other files outside of the user's home directory
|
|
|
|
echo "Handiling non-standard files:"
|
|
|
|
# 1. Tabby config
|
2022-01-09 19:03:45 +00:00
|
|
|
f=$(fulllink "./other-files/tabby/config.yaml")
|
|
|
|
dst="/Users/${USER}/Library/Application Support/tabby/config.yaml"
|
2022-01-09 14:28:57 +00:00
|
|
|
printf "Linking ${f}=>${dst}"
|
|
|
|
ln -sfn ${f} ${dst}
|
|
|
|
printf " ✅\n"
|
|
|
|
|
2021-11-29 08:07:17 +00:00
|
|
|
;;
|
|
|
|
esac
|
2021-12-03 17:12:52 +00:00
|
|
|
|
|
|
|
echo "🔵 Adding configuration"
|
2021-12-24 10:29:45 +00:00
|
|
|
FILES=$(/usr/bin/find ./home -maxdepth 1 -mindepth 1 | tr '\n' ' ')
|
2021-12-03 17:12:52 +00:00
|
|
|
for file in $FILES
|
|
|
|
do
|
|
|
|
f=$(fulllink "${file}")
|
|
|
|
dst="${HOME}/$(basename "./home/${file}")"
|
2021-12-24 10:29:45 +00:00
|
|
|
printf "Linking ${f} => ${dst}"
|
2021-12-03 17:12:52 +00:00
|
|
|
ln -sfn ${f} ${dst}
|
|
|
|
printf " ✅\n"
|
2021-12-03 18:20:33 +00:00
|
|
|
done
|