infidel_env/install.sh

125 lines
2.9 KiB
Bash
Raw Normal View History

2022-02-02 11:18:50 -05:00
#!/bin/bash
2022-03-23 13:01:51 -04:00
# cp ./.vimrc /home/$(whoami)/
# cp -r ./.vim/ /home/$(whoami)/
# cp -r ./.tmux.conf /home/$(whoami)/
2022-02-02 11:18:50 -05:00
user_guide () {
echo
echo "Usage: $0 [options]"
echo
echo "Options:"
echo " -i : Install for Single User [user,root]"
echo " -a : Install for all user"
}
vim_extension () {
vim +PlugInstall +qall
2022-04-14 15:10:24 -04:00
vim -c "CocInstall coc-vimlsp coc-sh coc-python coc-spell-checker"
2022-04-14 15:33:20 -04:00
vim -c "CocCommand cSpell.enableLanguage sh" # Add SH Script for spell checking
if [ ! -d "$HOME/.local/bin" ] ; then
mkdir -p $HOME/.local/bin/
fi
echo 'export PATH="$HOME/.local/bin:$PATH"' >> $HOME/.profile # Temporary add exclusion next time
2022-05-06 10:54:11 -04:00
curl -sL install-node.vercel.app/lts | bash -s -- -P $HOME/.local
}
user_install () {
echo "VIM Conf"
ln -sf $(pwd)/.vimrc /home/$(whoami)/
if [ -d "$HOME/.vim" ] ; then
echo -e "\tExisting .vim directory detected..."
mv "$HOME/.vim" "$HOME/.vim.bak"
fi
ln -sf $(pwd)/.vim/ /home/$(whoami)/
vim_extension
echo "TMUX Conf"
ln -sf $(pwd)/.tmux.conf /home/$(whoami)/
echo "TMUX Plugin"
mkdir -p "/home/$(whoami)/.tmux/plugins"
[ -d "/home/$(whoami)/.tmux/plugins/tpm" ] || git clone https://github.com/tmux-plugins/tpm /home/$(whoami)/.tmux/plugins/tpm
}
root_install () {
# sudo su
echo "VIM Conf"
sudo ln -sf $(pwd)/.vimrc /root/
sudo ln -sf $(pwd)/.vim/ /root/
vim_extension
echo "TMUX Conf"
sudo ln -sf $(pwd)/.tmux.conf /root/
echo "TMUX Plugin"
sudo mkdir -p "/root/.tmux/plugins"
[ -d "/root/.tmux/plugins/tpm" ] || sudo git clone https://github.com/tmux-plugins/tpm /root/.tmux/plugins/tpm
}
# echo "What : $#"
if [ $# -lt 1 ]
then
user_guide # Call user guide
exit
fi
# echo "case $1"
case "$1" in
-i) echo "Installing For Single User "
if [ $# -lt 2 ]
then
echo "Error Syntax"
user_guide # Call user guide
exit
fi
case "$2" in
user) echo "USER Installation"
echo "Case $2"
user_install # Call User install function
;;
root) echo "ROOT Installation"
echo "Case $2"
root_install # Call User install function
;;
*)
echo "Error Syntax"
user_guide # Call user guide
;;
esac
;;
-a) echo "Installing...."
echo "Case Global"
if [ $# -gt 1 ]
then
user_guide # Call user guide
exit
fi
user_install # Call User install function
root_install # Call User install function
;;
*)
echo "Error Syntax"
user_guide # Call user guide
;;
esac