add install.sh
This commit is contained in:
parent
97d7f328d1
commit
135c589c3f
1 changed files with 60 additions and 0 deletions
60
install.sh
Executable file
60
install.sh
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
#!/bin/sh
|
||||
# install.sh - deploy openbsd-dots to $HOME
|
||||
# run from the repo root
|
||||
|
||||
set -e
|
||||
|
||||
DOTS="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
die() { echo "error: $1" >&2; exit 1; }
|
||||
confirm() {
|
||||
printf "%s [y/N] " "$1"
|
||||
read ans
|
||||
case "$ans" in y|Y) return 0 ;; *) return 1 ;; esac
|
||||
}
|
||||
|
||||
backup() {
|
||||
[ -f "$1" ] && cp "$1" "$1.bak" && echo "backed up $1 -> $1.bak"
|
||||
}
|
||||
|
||||
echo "openbsd-dots installer"
|
||||
echo "this will overwrite existing dotfiles (backups made)"
|
||||
confirm "continue?" || exit 0
|
||||
|
||||
# shell
|
||||
backup "$HOME/.profile"
|
||||
backup "$HOME/.shrc"
|
||||
cp "$DOTS/profile" "$HOME/.profile"
|
||||
cp "$DOTS/shrc" "$HOME/.shrc"
|
||||
echo "installed .profile .shrc"
|
||||
|
||||
# vim
|
||||
backup "$HOME/.vimrc"
|
||||
cp "$DOTS/vimrc" "$HOME/.vimrc"
|
||||
echo "installed .vimrc"
|
||||
|
||||
# suckless configs - copy to src dirs if they exist
|
||||
for tool in dwm st dmenu; do
|
||||
dir=""
|
||||
case "$tool" in
|
||||
dwm) dir="$HOME/src/dwm" ;;
|
||||
st) dir="$HOME/src/st" ;;
|
||||
dmenu) dir="$HOME/src/dmenu" ;;
|
||||
esac
|
||||
src="$DOTS/${tool}-config.h"
|
||||
if [ -d "$dir" ]; then
|
||||
backup "$dir/config.h"
|
||||
cp "$src" "$dir/config.h"
|
||||
echo "installed $tool config.h -> $dir/config.h"
|
||||
else
|
||||
echo "skip $tool: $dir not found (clone sources first)"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "done. notes:"
|
||||
echo " - rebuild dwm/st/dmenu from src after install"
|
||||
echo " - super+v opens st (no rexima on OpenBSD) -- use sndioctl manually"
|
||||
echo " - volume keys use sndioctl output.level=+/-0.05"
|
||||
echo " - X starts from /dev/ttyC0 (wscons tty1)"
|
||||
echo " - install scientifica font: pkg_add scientifica"
|
||||
Loading…
Reference in a new issue