Handle removing old tools
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
58
install.sh
58
install.sh
@@ -6,17 +6,17 @@ export PATH="/home/linuxbrew/.linuxbrew/bin:/opt/homebrew/bin/:$PATH"
|
|||||||
[ -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)
|
[ -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)
|
||||||
|
|
||||||
# Install homebrew
|
# Install homebrew
|
||||||
|
echo ""
|
||||||
echo "🔵 Installing homebrew"
|
echo "🔵 Installing homebrew"
|
||||||
which brew >/dev/null || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
which brew >/dev/null || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
brew tap homebrew/core
|
echo "✅"
|
||||||
printf " ✅\n"
|
|
||||||
|
|
||||||
# Install oh-my-zsh
|
# Install oh-my-zsh
|
||||||
|
echo ""
|
||||||
echo "🔵 Setting up zsh"
|
echo "🔵 Setting up zsh"
|
||||||
printf "Cloning oh-my-zsh..."
|
printf "Cloning oh-my-zsh..."
|
||||||
[ -d ${HOME}/.oh-my-zsh ] || sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
[ -d ${HOME}/.oh-my-zsh ] || sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||||
printf " ✅\n"
|
printf " ✅\n"
|
||||||
|
|
||||||
# Install ZSH plugins
|
# Install ZSH plugins
|
||||||
printf "Cloning zsh plugins..."
|
printf "Cloning zsh plugins..."
|
||||||
[ -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-autosuggestions ] || git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
|
||||||
@@ -55,6 +55,13 @@ MAS_TOOLS=(
|
|||||||
1470584107 # Dato
|
1470584107 # Dato
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Tools removed to be cleaned up
|
||||||
|
REMOVED_BREW_TOOLS=(
|
||||||
|
exa karabiner-elements kubectx
|
||||||
|
)
|
||||||
|
REMOVED_KREW_TOOLS=( gs )
|
||||||
|
|
||||||
|
echo ""
|
||||||
echo "🔵 Installing / updating tools"
|
echo "🔵 Installing / updating tools"
|
||||||
|
|
||||||
# Install Debian/Ubuntu specific packages if apt exists
|
# Install Debian/Ubuntu specific packages if apt exists
|
||||||
@@ -64,6 +71,7 @@ if command -v apt &>/dev/null; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Homebrew
|
# Homebrew
|
||||||
|
echo ""
|
||||||
echo "🔵 Homebrew tools"
|
echo "🔵 Homebrew tools"
|
||||||
export HOMEBREW_NO_INSTALL_CLEANUP=true
|
export HOMEBREW_NO_INSTALL_CLEANUP=true
|
||||||
for tool in "${BREW_TOOLS[@]}"
|
for tool in "${BREW_TOOLS[@]}"
|
||||||
@@ -78,6 +86,7 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Cargo
|
# Cargo
|
||||||
|
echo ""
|
||||||
echo "🔵 Cargo tools"
|
echo "🔵 Cargo tools"
|
||||||
for tool in "${CARGO_TOOLS[@]}"
|
for tool in "${CARGO_TOOLS[@]}"
|
||||||
do
|
do
|
||||||
@@ -91,6 +100,7 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Krew
|
# Krew
|
||||||
|
echo ""
|
||||||
echo "🔵 Krew tools"
|
echo "🔵 Krew tools"
|
||||||
kubectl-krew update &>/dev/null
|
kubectl-krew update &>/dev/null
|
||||||
for tool in "${KREW_TOOLS[@]}"
|
for tool in "${KREW_TOOLS[@]}"
|
||||||
@@ -113,6 +123,7 @@ fulllink() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo ""
|
||||||
echo "🔵 OS Specific setup"
|
echo "🔵 OS Specific setup"
|
||||||
echo "Detected OS type: ${OSTYPE}"
|
echo "Detected OS type: ${OSTYPE}"
|
||||||
|
|
||||||
@@ -122,6 +133,8 @@ case "${OSTYPE}" in
|
|||||||
;;
|
;;
|
||||||
*darwin*)
|
*darwin*)
|
||||||
# Mac specific setup
|
# Mac specific setup
|
||||||
|
echo ""
|
||||||
|
echo "Instaling Mac-specific Brew tools..."
|
||||||
for tool in "${MAC_BREW_TOOLS[@]}"
|
for tool in "${MAC_BREW_TOOLS[@]}"
|
||||||
do
|
do
|
||||||
printf "${tool}..."
|
printf "${tool}..."
|
||||||
@@ -134,6 +147,8 @@ case "${OSTYPE}" in
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Mac App Store
|
# Mac App Store
|
||||||
|
echo ""
|
||||||
|
echo "Instaling Mac-specific App Store tools..."
|
||||||
for tool in "${MAS_TOOLS[@]}"
|
for tool in "${MAS_TOOLS[@]}"
|
||||||
do
|
do
|
||||||
printf "MAS ID: ${tool}..."
|
printf "MAS ID: ${tool}..."
|
||||||
@@ -145,6 +160,8 @@ case "${OSTYPE}" in
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Setting up config files"
|
||||||
FILES=$(/usr/bin/find ./os-specific/darwin/home -maxdepth 1 -mindepth 1 | tr '\n' ' ')
|
FILES=$(/usr/bin/find ./os-specific/darwin/home -maxdepth 1 -mindepth 1 | tr '\n' ' ')
|
||||||
for file in $FILES
|
for file in $FILES
|
||||||
do
|
do
|
||||||
@@ -166,6 +183,7 @@ case "${OSTYPE}" in
|
|||||||
|
|
||||||
|
|
||||||
# Handle other files outside of the user's home directory
|
# Handle other files outside of the user's home directory
|
||||||
|
echo ""
|
||||||
echo "🔵 Handiling non-standard files:"
|
echo "🔵 Handiling non-standard files:"
|
||||||
# 1. Tabby config
|
# 1. Tabby config
|
||||||
mkdir -p "/Users/${USER}/Library/Application Support/tabby"
|
mkdir -p "/Users/${USER}/Library/Application Support/tabby"
|
||||||
@@ -188,6 +206,7 @@ case "${OSTYPE}" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
echo ""
|
||||||
echo "🔵 Adding configuration"
|
echo "🔵 Adding configuration"
|
||||||
FILES=$(/usr/bin/find ./home -maxdepth 1 -mindepth 1 | tr '\n' ' ')
|
FILES=$(/usr/bin/find ./home -maxdepth 1 -mindepth 1 | tr '\n' ' ')
|
||||||
for file in $FILES
|
for file in $FILES
|
||||||
@@ -198,3 +217,36 @@ do
|
|||||||
ln -sfn ${f} ${dst}
|
ln -sfn ${f} ${dst}
|
||||||
printf " ✅\n"
|
printf " ✅\n"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "🔵 Updating installed tools..."
|
||||||
|
brew upgrade
|
||||||
|
mas upgrade
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "🔵 Removing old Homebrew tools"
|
||||||
|
export HOMEBREW_NO_INSTALL_CLEANUP=true
|
||||||
|
for tool in "${REMOVED_BREW_TOOLS[@]}"
|
||||||
|
do
|
||||||
|
printf "${tool}..."
|
||||||
|
brew uninstall ${tool} &>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
printf " ✅\n"
|
||||||
|
else
|
||||||
|
printf " ❌\n"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "🔵 Removing old Krew tools"
|
||||||
|
for tool in "${REMOVED_KREW_TOOLS[@]}"
|
||||||
|
do
|
||||||
|
printf "${tool}..."
|
||||||
|
kubectl-krew uninstall ${tool} &>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
printf " ✅\n"
|
||||||
|
else
|
||||||
|
printf " ❌\n"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
Reference in New Issue
Block a user