Skip to content

Instantly share code, notes, and snippets.

@ArtiomL
Created December 29, 2013 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ArtiomL/8172038 to your computer and use it in GitHub Desktop.
Save ArtiomL/8172038 to your computer and use it in GitHub Desktop.
art-get - Application Repository Tool
#!/bin/bash
# art-get - Application Repository Tool
# (CC0) No Rights Reserved
# Artiom Lichtenstein
# v1.0, 28/12/2013
url_REP="https://gist.github.com/ArtiomL/4722179a52ea327fb2ad/raw/"
tmp_FILE=$(mktemp)
trap "rm -f $tmp_FILE" EXIT
fun_USAGE()
{
echo; echo "Usage: ./art-get {APP_NAME}";
cat $tmp_FILE | cut -d"@" -f1
echo;
exit
}
wget -q -O $tmp_FILE $url_REP
if [ $? -eq 0 ]; then
if [ -z "$1" ]; then
fun_USAGE
fi
str_APP_NAME="$(cat $tmp_FILE | grep " $1 " | cut -d" " -f4)"
str_APP_URL="$(cat $tmp_FILE | grep " $1 " | cut -d"@" -f2)"
str_APP_PATH="$(cat $tmp_FILE | grep " $1 " | cut -d"@" -f3)"
if [ "$str_APP_URL" == "" ]; then
fun_USAGE
fi
cat /dev/null > $tmp_FILE
echo -n "Getting $str_APP_NAME..."
wget -q -O $tmp_FILE $str_APP_URL
if [ $? -eq 0 ]; then
cat $tmp_FILE > $str_APP_PATH
echo " 100% OK"
echo -n "$str_APP_NAME "
cat $tmp_FILE | grep '^# v' | cut -d" " -f2 | sed "s/,/ Installed./"
else
echo " Oops!"; echo "$str_APP_NAME is unavailable."
fi
else
echo "Oops! Application Repository is Unreachable..."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment