diff options
Diffstat (limited to '')
-rwxr-xr-x | install.sh | 73 |
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) |