diff options
-rwxr-xr-x | provision_openbsd.ksh | 109 |
1 files changed, 66 insertions, 43 deletions
diff --git a/provision_openbsd.ksh b/provision_openbsd.ksh index a0047ff..4098e8b 100755 --- a/provision_openbsd.ksh +++ b/provision_openbsd.ksh @@ -9,67 +9,90 @@ # download ISO from https://cdn.openbsd.org/pub/OpenBSD/$(uname -r)/amd64/install71.iso -ssh-add -v +INC_CODE=0 -while getopts c provopts + +usage() +{ + print "Usage: $0 [-c]" + exit 2 +} + +while getopts 'ch' opt do - case $provopts in - c) flag=1, print "Got flag" ;; - ?) print "Bonkers"; exit ;; + case $opt in + c) INC_CODE=1; print "Will fetch code from github." ;; + h) usage ;; + ?) usage ;; esac done -pkg_add vim the_silver_searcher zip - -echo -n "Creating necessary directories..." -mkdir -p ~/code/python -mkdir -p ~/.config/ -echo "ok" -echo -n "Fetching dotfiles..." -if [ ! -d ~/openbsddotfiles ]; then - git clone git@github.com:yulqen/openbsddotfiles.git ~/openbsddotfiles 2>&1 > /dev/null - echo "ok" -else - echo "dotfiles directory already exists." +command -v vim > /dev/null 2>&1 +if [ "$?" != 0 ]; then + doas pkg-add vim fi -echo -n "Fetching dbasik..." -if [ ! -d ~/code/python/dbasik ]; then - git clone git@github.com:yulqen/dbasik.git ~/code/python/dbasik 2>&1 > /dev/null - echo "ok" -else - echo "dbasik directory already exists." -fi -echo -n "Fetching datamaps..." -if [ ! -d ~/code/python/datamaps ]; then - git clone git@github.com:yulqen/datamaps.git ~/code/python/datamaps 2>&1 > /dev/null - echo "ok" -else - echo "datamaps directory already exists." -fi +doas pkg_add the_silver_searcher zip + +if [ $INC_CODE -eq 1 ]; then + ssh-add -v + print -n "Creating necessary directories..." + mkdir -p ~/code/python + mkdir -p ~/.config/ + print "ok" -echo -n "Fetching bcompiler-engine..." -if [ ! -d ~/code/python/bcompiler-engine ]; then - git clone git@github.com:yulqen/bcompiler-engine.git ~/code/python/bcompiler-engine 2>&1 > /dev/null - echo "ok" -else - echo "bcompiler-engine directory already exists." + print -n "Fetching dotfiles..." + if [ ! -d ~/openbsddotfiles ]; then + git clone git@github.com:yulqen/openbsddotfiles.git ~/openbsddotfiles 2>&1 > /dev/null + print "ok" + else + print "dotfiles directory already exists." + fi + + print -n "Fetching dbasik..." + if [ ! -d ~/code/python/dbasik ]; then + git clone git@github.com:yulqen/dbasik.git ~/code/python/dbasik 2>&1 > /dev/null + print "ok" + else + print "dbasik directory already exists." + fi + + print -n "Fetching datamaps..." + if [ ! -d ~/code/python/datamaps ]; then + git clone git@github.com:yulqen/datamaps.git ~/code/python/datamaps 2>&1 > /dev/null + print "ok" + else + print "datamaps directory already exists." + fi + + print -n "Fetching bcompiler-engine..." + if [ ! -d ~/code/python/bcompiler-engine ]; then + git clone git@github.com:yulqen/bcompiler-engine.git ~/code/python/bcompiler-engine 2>&1 > /dev/null + print "ok" + else + print "bcompiler-engine directory already exists." + fi + + print -n "Creating code-related symlinks..." + ln -sf openbsddotfiles/pdbrc .pdbrc + ln -sf openbsddotfiles/pdbrc.py .pdbrc.py + ln -sf openbsddotfiles/flake8 /home/lemon/.config/.flake8 + print "ok" fi -echo -n "Creating symlinks..." + +print -n "Creating regular symlinks..." +cd ~ ln -sf openbsddotfiles/kshrc_vm_provision .kshrc ln -sf openbsddotfiles/ksh_aliases .ksh_aliases ln -sf openbsddotfiles/profile_vm_provisioning .profile ln -sf openbsddotfiles/tmux.conf .tmux.conf -ln -sf openbsddotfiles/vim .vim +ln -shf openbsddotfiles/vim ~/.vim ln -sf openbsddotfiles/gitconfig .gitconfig ln -sf openbsddotfiles/gitignore_global .gitignore_global -ln -sf openbsddotfiles/pdbrc .pdbrc -ln -sf openbsddotfiles/pdbrc.py .pdbrc.py -ln -sf openbsddotfiles/flake8 /home/lemon/.config/.flake8 -echo "ok" +print "ok" |