installation with curl and bash

This commit is contained in:
spacewander 2015-06-08 00:09:40 +08:00
parent 02d6222031
commit 51fbc16913
3 changed files with 24 additions and 8 deletions

View file

@ -24,5 +24,5 @@ $ [sudo] make install
One-liner:
```bash
$ (cd /tmp && rm -rf git-extras && echo "Setting up 'git-extras'...." && git clone https://github.com/tj/git-extras.git &> /dev/null && cd git-extras && git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) &> /dev/null && sudo make install)
curl -s https://raw.githubusercontent.com/tj/git-extras/master/install.sh | [sudo] bash /dev/stdin
```

View file

@ -1,19 +1,14 @@
#!/usr/bin/env bash
VERSION="3.0.0"
INSTALL_SCRIPT="https://raw.githubusercontent.com/tj/git-extras/master/install.sh"
update() {
local bin=$(which git-extras)
local prefix=${bin%/*/*}
local orig=$PWD
cd /tmp \
&& rm -fr ./git-extras \
&& echo "Setting up 'git-exras'...." \
&& git clone https://github.com/tj/git-extras.git &> /dev/null \
&& cd git-extras \
&& git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) &> /dev/null \
&& PREFIX="$prefix" make install \
curl -s $INSTALL_SCRIPT | PREFIX="$prefix" bash /dev/stdin \
&& cd "$orig" \
&& echo "... updated git-extras $VERSION -> $(git extras --version)"
}

21
install.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
make_install() {
if [ -n "$PREFIX" ]
then
PREFIX="$PREFIX" make install
else
sudo make install
fi
}
cd /tmp \
&& rm -rf ./git-extras \
&& echo "Setting up 'git-exras'...." \
&& git clone https://github.com/tj/git-extras.git &> /dev/null \
&& cd git-extras \
&& git checkout \
$(git describe --tags $(git rev-list --tags --max-count=1)) \
&> /dev/null \
&& make_install