summary refs log tree commit diff
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
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 '')
-rw-r--r--home/.kshrc2
-rwxr-xr-xinstall.sh73
2 files changed, 51 insertions, 24 deletions
diff --git a/home/.kshrc b/home/.kshrc
index fb605acd..113292cf 100644
--- a/home/.kshrc
+++ b/home/.kshrc
@@ -7,7 +7,7 @@ function colonize {
 	print "$*"
 }
 systemPath=$PATH
-PATH=$(colonize {,/usr{/local,/pkg,},$HOME/.local}/{s,}bin /usr/games)
+PATH=$(colonize {,/opt/pkg,/usr{/local,/pkg,},$HOME/.local}/{s,}bin /usr/games)
 CDPATH=:$HOME
 export PWD
 
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)