BASH CASE FLOW
Added bash case flow - added two mode single installation and global installation - tested all cases [PASS]
This commit is contained in:
parent
a776d9ceac
commit
24b5d58262
4
.vimrc
4
.vimrc
@ -11,6 +11,8 @@ Plug 'kaicataldo/material.vim', { 'branch': 'main' }
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'} " Intelisense
|
||||
Plug 'sheerun/vim-polyglot'
|
||||
Plug 'lifepillar/vim-gruvbox8'
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
Plug 'rakr/vim-two-firewatch'
|
||||
|
||||
call plug#end()
|
||||
|
||||
@ -57,7 +59,7 @@ augroup vimrc-remember-cursor-position
|
||||
augroup END
|
||||
|
||||
set background=dark
|
||||
colo default
|
||||
colo two-firewatch
|
||||
|
||||
map <C-k><C-k> :NERDTreeToggle<cr> " Use Ctrl-P to open the fuzzy file opener
|
||||
nnoremap <C-p> :Files<cr>
|
||||
|
102
install.sh
102
install.sh
@ -4,15 +4,97 @@
|
||||
# cp -r ./.vim/ /home/$(whoami)/
|
||||
# cp -r ./.tmux.conf /home/$(whoami)/
|
||||
|
||||
echo "VIM Conf"
|
||||
ln -sf $(pwd)/.vimrc /home/$(whoami)/
|
||||
ln -sf $(pwd)/.vim/ /home/$(whoami)/
|
||||
vim -c 'PlugInstall'
|
||||
user_guide () {
|
||||
echo
|
||||
echo "Usage: $0 [options]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -i : Install for Single User [user,root]"
|
||||
echo " -a : Install for all user"
|
||||
|
||||
echo "TMUX Conf"
|
||||
ln -sf $(pwd)/.vimrc /home/$(whoami)/
|
||||
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
|
||||
}
|
||||
|
||||
user_install () {
|
||||
echo "VIM Conf"
|
||||
ln -sf $(pwd)/.vimrc /home/$(whoami)/
|
||||
ln -sf $(pwd)/.vim/ /home/$(whoami)/
|
||||
vim -c 'PlugInstall'
|
||||
|
||||
echo "TMUX Conf"
|
||||
ln -sf $(pwd)/.vimrc /home/$(whoami)/
|
||||
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 -c 'PlugInstall'
|
||||
|
||||
echo "TMUX Conf"
|
||||
sudo ln -sf $(pwd)/.vimrc /root/
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user