aboutsummaryrefslogtreecommitdiff
path: root/install.sh
blob: 55086d1c606a07c05e5d7c0d9f8d676b67d18332 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash

#['name']='install location relative to $HOME'
declare -A CONFIGS
CONFIGS=( 	["sway"]=".config"
		["alacritty"]=".config"
		["polybar"]=".config"
		["powerline"]=".config"
		["nvim"]=".config"
		["termite"]=".config"
		["twmn"]=".config"
		["picom"]=".config"
		["i3"]=".config"
		["termux.properties"]=".termux"
		["bspwm"]=".config"
		["sxhkd"]=".config"
		["deadd"]=".config"
		["rofi"]=".config"
		["autoload.cfg"]=".local/share/Steam/steamapps/common/Counter-Strike Global Offensive/csgo/cfg/"
		[".vim"]="."
		[".xinitrc"]="."
		[".bashrc"]="."
		[".Xresources"]="."
		[".radare2rc"]="."
		[".bash_profile"]="."
		[".stack"]="."
		["gpg-agent.conf"]=".gnupg"
	)

declare -A SETS
SETS=(		["base"]=".vim .bashrc .bash_profile"
		["desktop"]="base termite picom i3 deadd polybar .xinitrc .Xresources"
	)

WORKDIR=$(realpath "$(dirname "$0")")
cd "$WORKDIR" || (echo cd failed; exit 1)
echo "Working in $WORKDIR"
echo "Homedir is $HOME"

# === CODE BELOW HERE ===

source "lib/funcs.sh" || exit 1

if [ $# -eq 0 ]; then
	cat << EOF
USAGE: $0 COMMAND [ARGS]
COMMANDS
	install [CONFIG ...]
		install configurations. if none are provided,
		a selection menu is showm.
	hk
		perform housekeeping functions
EOF
	exit 1
fi

CMD=$1
shift

case $CMD in
	install)
		if [ $# -gt 0 ]; then
			selected=( "$@" )
		else
			selected=( $(multiselector "${!CONFIGS[@]}" "${!SETS[@]}" ) )
		fi
		for cnf in "${selected[@]}"; do
			choose_target "$cnf"
		done
		housekeeping;;
	hk)
		housekeeping;;
	*)
		echo Invalid command: "$CMD"
		exit 1
		;;
esac