82 lines
1.8 KiB
Bash
Executable File
82 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
#
|
|
# myzsh installation script
|
|
#
|
|
|
|
#dependencies
|
|
readonly deps="git zsh vim curl wget"
|
|
|
|
#check for dependencies
|
|
missingdeps=""
|
|
i=0
|
|
for dep in $deps; do
|
|
if [ $(command -v $dep > /dev/null; echo $?) -ne "0" ]; then
|
|
missingdeps="$missingdeps $dep"
|
|
i=$((i+1))
|
|
fi
|
|
done
|
|
|
|
#try to install unmet dependencies
|
|
if [ $i -ne 0 ]; then
|
|
|
|
#checking for system
|
|
echo "[myzsh]: installing missing dependencies ($missingdeps)"
|
|
readonly systems="ubuntu arch raspbian solus"
|
|
issue="$(cat /etc/issue)"
|
|
for item in $systems; do
|
|
echo $issue | grep -i $item
|
|
if [ $? -eq 0 ]; then
|
|
system=$item
|
|
fi
|
|
done
|
|
|
|
case $system in
|
|
ubuntu)
|
|
sudo apt-get update && sudo apt-get install -y $missingdeps
|
|
;;
|
|
arch)
|
|
sudo pacman -Su $missingdeps
|
|
;;
|
|
raspbian)
|
|
sudo apt-get update && sudo apt-get install -y $missingdeps
|
|
;;
|
|
solus)
|
|
sudo eopkg update-repo && sudo eopkg install $missingdeps
|
|
;;
|
|
|
|
?)
|
|
echo "[myzsh]: i cannot install dependencies. goodbye."
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
fi
|
|
|
|
#install
|
|
echo "[myzsh]: cleaning up previous installations."
|
|
rm -rf ~/.myzsh
|
|
|
|
echo "[myzsh]: downloading repository."
|
|
if [ -r ~/.ssh/id_rsa ]; then
|
|
git clone git@socialg.it:david/myzsh.git ~/.myzsh
|
|
else
|
|
git clone https://socialg.it/david/myzsh.git ~/.myzsh
|
|
fi
|
|
if [ $? -ne 0 ]; then
|
|
echo "[myzsh]: i cannot clone repository. goodbye."
|
|
exit 1
|
|
fi
|
|
|
|
#config
|
|
echo "[myzsh]: setting up config."
|
|
echo 'ZSH="$HOME/.myzsh"' > ~/.zshrc
|
|
echo 'THEME="david"' >> ~/.zshrc
|
|
echo 'plugins=(david)' >> ~/.zshrc
|
|
echo 'source $ZSH/myzsh.sh' >> ~/.zshrc
|
|
echo "export PATH=$PATH" >> ~/.zshrc
|
|
|
|
echo "[myzsh]: successfully installed."
|
|
|
|
exit 0
|