From 4d80b749ed1837055cc9c1e17f608b7b3495c1ea Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 11 Mar 2012 12:09:05 +0100 Subject: [PATCH] Installation script --- bin/{rec.py => asciiio.py} | 0 bin/install | 39 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) rename bin/{rec.py => asciiio.py} (100%) create mode 100755 bin/install diff --git a/bin/rec.py b/bin/asciiio.py similarity index 100% rename from bin/rec.py rename to bin/asciiio.py diff --git a/bin/install b/bin/install new file mode 100755 index 0000000..00511e0 --- /dev/null +++ b/bin/install @@ -0,0 +1,39 @@ +#!/bin/bash + +# _ _ _ +# (_|_) (_) +# __ _ ___ ___ _ _ _ ___ +# / _` / __|/ __| | | | |/ _ \ +# | (_| \__ \ (__| | |_| | (_) | +# \__,_|___/\___|_|_(_)_|\___/ +# +# ascii.io recorder installation script + +BIN_NAME="asciiio" +BIN_URL="https://raw.github.com/sickill/ascii.io-cli/master/bin/asciiio.py" +SUDO="" + +if [ -d "$HOME/bin" ] && [[ ":$PATH:" == *":~/bin:"* || ":$PATH:" == *":$HOME/bin:"* ]]; then + TARGET="$HOME/bin/$BIN_NAME" + echo "Installing to $TARGET..." +elif [ -d "/usr/local/bin" ] && [[ ":$PATH:" == *":/usr/local/bin:"* ]]; then + TARGET="/usr/local/bin/$BIN_NAME" + echo "Installing to $TARGET..." + + if [ ! -w /usr/local/bin ]; then + SUDO=sudo + echo "You may be asked for sudo password to save the file in /usr/local/bin directory" + fi +else + TARGET="./$BIN_NAME" + echo "Couldn't find ~/bin or /usr/local/bin in your \$PATH, saving in current dir..." +fi + +$SUDO curl -skL $BIN_URL -o $TARGET + +if [[ $? == 0 ]]; then + $SUDO chmod +x $TARGET + echo "Done. Now start recording by typing \"asciiio\"." +else + echo "Oopsie, something unexpected happened." +fi