diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2022-07-01 20:51:26 +0100 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2022-07-01 20:51:26 +0100 |
commit | 29974f54d17d5b48c1395d4caaf561476cb9541c (patch) | |
tree | e49e6aca04b80c55dbc659626a7d0b149c7bb52d | |
parent | e6e6c57dde473aed82903d61ac90891370d8e436 (diff) | |
parent | 97c1412d7d9986963e986f5dd5769f4cd62f7899 (diff) |
Merge branch 'master' of github.com:yulqen/openbsddotfiles
-rwxr-xr-x | provision_openbsd.ksh | 111 |
1 files changed, 68 insertions, 43 deletions
diff --git a/provision_openbsd.ksh b/provision_openbsd.ksh index a0047ff..5d595cd 100755 --- a/provision_openbsd.ksh +++ b/provision_openbsd.ksh @@ -9,67 +9,92 @@ # 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 fzf 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/ + mkdir -p ~/.fzf/ + 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 + ln -sf $(which fzf) ~/.fzf + 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" |