cf-node-bootstrap/install.sh
2022-02-25 06:47:56 -08:00

81 lines
No EOL
1.9 KiB
Bash

#!/bin/bash
# initial vars
rundir=${0%/*}
source ${rundir}/functions
scriptname=${0##*/}
runuser=$(whoami)
#-----------------------------------------------------------------#
# Script-specific Parameters
#-----------------------------------------------------------------#
VERSION=1.0
#-----------------------------------------------------------------#
# Script-specific Funcitons
#-----------------------------------------------------------------#
usage(){
boxtop
boxline "${lyl}$scriptname - v${VERSION}:${dfl}"
boxline "${lbl}Usage:${dfl}"
boxline "${lyl}$scriptname ${bld}[args]"
boxseparator
boxline "[args:]"
boxline " -i [--install]"
boxline " -r [--remove]"
boxline " -u [--update]"
boxline " -h [--help]"
boxbottom
}
install(){
scp -r $rundir/lib/skel/* $HOME
cp $rundir/lib/vimfiles/crystallite.vim /usr/share/vim/vim*/colors/crystallite.vim
cp $rundir/lib/vimfiles/vimrc.local /etc/vim/vimrc.local
}
remove(){
echo -e "\n"
}
update(){
pushd $rundir
remove
git fetch && git pull
install
popd
}
#------------------------------------------------------#
# Options and Arguments Parser
#------------------------------------------------------#
if [[ $runuser == root ]] ; then
case $1 in
-i | --install)
install
;;
-r | --remove)
remove
;;
-u | --update)
update
#sleep $ratelimit
exit 0
;;
-h | --help)
usage
;;
*)
warn "Invalid argument $@"
usage
#exit 2
;;
esac
else
fail "Must be run as user 'root'"
fi
#------------------------------------------------------#
# Script begins here
#------------------------------------------------------#