summary refs log tree commit diff
path: root/install.sh
blob: f9f7ab297eba0ffbdd85ccbbb411d597584342ec (plain) (blame)
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
#!/bin/sh
set -e -u

pkgAny='curl git gnupg htop mksh sl the_silver_searcher tree'
pkgDarwin='git'
pkgFreeBSD='ddate neovim sudo'
pkgNetBSD='sudo vim'
pkgLinux='base-devel bc ctags gdb neovim openssh'

pkgsrcTag='20171103'
neovimTag='v0.3.1'

pkgsrcTar="bootstrap-trunk-x86_64-${pkgsrcTag}.tar.gz"
pkgsrcURL="https://pkgsrc.joyent.com/packages/Darwin/bootstrap/${pkgsrcTar}"
neovimTar='nvim-macos.tar.gz'
neovimURL="
https://github.com/neovim/neovim/releases/download/${neovimTag}/${neovimTar}
"

Darwin() {
	xcode-select --install || true
	if [ ! -d /opt/pkg ]; then
		curl -O ${pkgsrcURL}
		sudo tar -zxpf ${pkgsrcTar} -C /
		rm ${pkgsrcTar}
	fi
	sudo pkgin update
	sudo pkgin install ${pkgAny} ${pkgDarwin}
	if [ ! -f /usr/local/bin/nvim ]; then
		curl -L -O ${neovimURL}
		sudo tar -xf ${neovimTar} --strip-components 1 -C /usr/local
		rm ${neovimTar}
	fi
}

PKG_PATH="
ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r)/All
"

NetBSD() {
	if [ ! -f /usr/pkg/bin/pkgin ]; then
		export PKG_PATH
		pkg_add pkgin
		echo "${PKG_PATH}" > /usr/pkg/etc/pkgin/repositories.conf
	fi
	pkgin update
	pkgin install ${pkgAny} ${pkgNetBSD}
}

FreeBSD() {
	pkg install ${pkgAny} ${pkgFreeBSD}
}

Linux() {
	pacman -Sy
	pacman -S --needed ${pkgAny} ${pkgLinux}
}

$(uname)