2012-03-11 12:09:05 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# _ _ _
|
|
|
|
|
# (_|_) (_)
|
|
|
|
|
# __ _ ___ ___ _ _ _ ___
|
|
|
|
|
# / _` / __|/ __| | | | |/ _ \
|
|
|
|
|
# | (_| \__ \ (__| | |_| | (_) |
|
|
|
|
|
# \__,_|___/\___|_|_(_)_|\___/
|
|
|
|
|
#
|
2013-09-24 22:56:39 +02:00
|
|
|
# asciinema recorder installation script
|
2012-03-11 12:09:05 +01:00
|
|
|
|
2013-09-22 13:52:45 +02:00
|
|
|
BIN_NAME="asciinema"
|
|
|
|
|
BIN_URL="https://raw.github.com/sickill/asciinema/master/bin/asciinema"
|
2012-03-11 12:09:05 +01:00
|
|
|
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
|
|
|
|
|
|
2013-08-04 19:33:27 +02:00
|
|
|
if [ ! $(which python2 2>/dev/null) ]; then
|
2013-10-01 18:51:47 -04:00
|
|
|
if [ $(uname) == 'Darwin' ]; then
|
|
|
|
|
$SUDO sed -i '' '1 s/python2/python/' $TARGET
|
|
|
|
|
else
|
|
|
|
|
$SUDO sed -i '1 s/python2/python/' $TARGET
|
|
|
|
|
fi
|
2013-08-04 19:33:27 +02:00
|
|
|
fi
|
|
|
|
|
|
2012-03-11 12:09:05 +01:00
|
|
|
if [[ $? == 0 ]]; then
|
|
|
|
|
$SUDO chmod +x $TARGET
|
2013-09-22 13:52:45 +02:00
|
|
|
echo "Done. Now start recording by typing \"asciinema\"."
|
2012-03-11 12:09:05 +01:00
|
|
|
else
|
|
|
|
|
echo "Oopsie, something unexpected happened."
|
|
|
|
|
fi
|