From 300a8bc2a1b033d56822b13541d1c9f7eeafef27 Mon Sep 17 00:00:00 2001 From: Yurii Rashkovskii Date: Tue, 15 Feb 2011 14:01:09 -0800 Subject: [PATCH] Oneliners now will automatically use sudo if /usr/local is not writeable --- README.md | 6 ------ scripts/oneliner | 7 ++++++- scripts/oneliner.release | 9 ++++++++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3763290..a6f1704 100644 --- a/README.md +++ b/README.md @@ -21,12 +21,6 @@ If you want to install latest release instead of HEAD, use this one: curl https://github.com/agner/agner/raw/master/scripts/oneliner.release | sh -### Configuration - -If your `/usr/local` isn't writeable to your user, either set your -`AGNER_PREFIX` variable to point to some writeable location or use -`sudo sh`. - Motivation ---------- diff --git a/scripts/oneliner b/scripts/oneliner index e6f208e..738b7a7 100755 --- a/scripts/oneliner +++ b/scripts/oneliner @@ -1 +1,6 @@ -DIR=`mktemp -u /tmp/agner.XXXXXX` && git clone https://github.com/agner/agner.git $DIR && cd $DIR && make && ./agner install agner && echo Fetching index... && agner list -d | awk '{printf "."; fflush()}' && echo && rm -rf $DIR \ No newline at end of file +DIR=`mktemp -u /tmp/agner.XXXXXX` && +git clone https://github.com/agner/agner.git $DIR && +cd $DIR && make && +if [ -w /usr/local ]; then ./agner install agner; else sudo ./agner install agner; fi && +echo Fetching index... && +agner list -d | awk '{printf "."; fflush()}' && echo && rm -rf $DIR \ No newline at end of file diff --git a/scripts/oneliner.release b/scripts/oneliner.release index 6e2257f..dc3b341 100755 --- a/scripts/oneliner.release +++ b/scripts/oneliner.release @@ -1 +1,8 @@ -DIR=`mktemp -u /tmp/agner.XXXXXX` && git clone https://github.com/agner/agner.git $DIR && cd $DIR && git checkout -b release origin/release && make && ./agner install agner -v @release && echo Fetching index... && agner list -d | awk '{printf "."; fflush()}' && echo && rm -rf $DIR \ No newline at end of file +DIR=`mktemp -u /tmp/agner.XXXXXX` && +git clone https://github.com/agner/agner.git $DIR && +cd $DIR && +git checkout -b release origin/release && +make && +if [ -w /usr/local ]; then ./agner install agner -v @release; else sudo ./agner install agner -v @release; fi && +echo Fetching index... && +agner list -d | awk '{printf "."; fflush()}' && echo && rm -rf $DIR \ No newline at end of file