summary refs log tree commit diff
path: root/install.sh
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-11-27 21:34:02 -0500
committerJune McEnroe <june@causal.agency>2018-11-27 21:34:02 -0500
commit5560f675c5c28e7ea2efdb44e6f38699a297c106 (patch)
treec1b18f0fe6837be339907b8f870de2517868528c /install.sh
parentFix ports for Linux (diff)
downloadsrc-5560f675c5c28e7ea2efdb44e6f38699a297c106.tar.gz
src-5560f675c5c28e7ea2efdb44e6f38699a297c106.zip
Switch to pkgsrc on Darwin
I've had enough of Homebrew. I want a real package manager that can
remove unneeded dependencies. neovim still isn't in pkgsrc, so download
binaries of that separately for now.

Hopefully I haven't broken any other systems by rewriting install.sh
like this.
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh73
1 files changed, 50 insertions, 23 deletions
diff --git a/install.sh b/install.sh
index 10a49384..f9f7ab29 100755
--- a/install.sh
+++ b/install.sh
@@ -1,32 +1,59 @@
 #!/bin/sh
 set -e -u
 
-any='gnupg htop mksh sl the_silver_searcher tree'
-brew="$any ddate git neovim openssh"
-pkg="$any curl ddate neovim sudo"
-pkgin="$any curl sudo vim"
-pacman="$any base-devel bc ctags gdb neovim openssh"
-
-homebrew='https://raw.githubusercontent.com/Homebrew/install/master/install'
-if [ "$(uname)" = 'Darwin' ]; then
+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
-	[ -f /usr/local/bin/brew ] || ruby -e "$(curl -fsSL "$homebrew")"
-	brew install $brew || true
-	if ! grep -q 'mksh' /etc/shells; then
-		echo '/usr/local/bin/mksh' | sudo tee -a /etc/shells > /dev/null
+	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
-	exit
-fi
+}
 
-[ -f /usr/local/sbin/pkg ] && exec pkg install $pkg
+PKG_PATH="
+ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r)/All
+"
 
-if [ "$(uname)" = 'NetBSD' ]; then
-	export PKG_PATH="ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r)/All"
-	pkg_add pkgin
-	echo "$PKG_PATH" > /usr/pkg/etc/pkgin/repositories.conf
+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 $pkgin
-	exit
-fi
+	pkgin install ${pkgAny} ${pkgNetBSD}
+}
+
+FreeBSD() {
+	pkg install ${pkgAny} ${pkgFreeBSD}
+}
+
+Linux() {
+	pacman -Sy
+	pacman -S --needed ${pkgAny} ${pkgLinux}
+}
 
-[ -f /usr/bin/pacman ] && pacman -Sy && exec pacman -S --needed $pacman
+$(uname)