aboutsummaryrefslogtreecommitdiff
path: root/setup.sh
blob: 4d1249aedcc4646deb671f3f8cc199c979feae1b (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
#!/bin/sh

# ==== DELETE THIS LINES =====
echo "NOTHING HAPPENED!"
echo "FIRST READ THE SCRIPT!"
exit
# ============================

set -e

prog="${0##*/}"

config() {
	mkdir -p ~/.config
	mkdir -p ~/.local/bin
	
	cp -ir config/* ~/.config
	cp -i bin/* ~/.local/bin
	cp -i zprofile ~/.zprofile
	if [ -n "$ZSH_VERSION" ]; then
		echo "You are not using Zsh, set your default shell:"
		echo "$ chsh --shell /usr/bin/zsh"
	fi
}

install() {
	source /etc/os-release
	distro="${NAME:-${DISTRIB_ID}}"
	distro_install=""
	pkglist=""
	case $distro in
		"Arch Linux")
			distro_install="pacman -S --needed"
			pkglist="arch-pkglist.txt"
			;;
		*) echo "Distro not supported"; exit ;;
	esac

	sudo $distro_install $(cat $pkglist)

	[[ "$?" -ne 0 ]] && exit

	echo "=================================="
	echo "  Packages successfully installed "
	echo "=================================="
}

usage() {
	cat <<-_EOF
	$prog OPTION

	Options:
        config	- copy configs and scripts to their location
        install	- install required packages
	_EOF
	exit
}

case "$1" in
	config) config ;;
	install) install ;;
	*) usage ;;
esac