Created
December 29, 2013 16:27
-
-
Save ArtiomL/8172038 to your computer and use it in GitHub Desktop.
art-get - Application Repository Tool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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