Changeset - 8041e8317259
[Not reviewed]
default
0 4 0
Dennis Fink (metalgamer) - 5 years ago 2015-08-09 21:21:25
dennis.fink@c3l.lu
Fixed download for aur4 and version bump
4 files changed with 62 insertions and 59 deletions:
0 comments (0 inline, 0 general)
README.rst
Show inline comments
...
 
@@ -9,7 +9,7 @@ Yet another AUR helper
 
:Author:         Dennis Fink <the_metalgamer@hackerspace.lu>
 
:Date:           2015-03-05
 
:Copyright:      GPLv3+
 
:Version:        Yaah 0.6.3
 
:Version:        Yaah 0.6.4
 
:Manual section: 8
 
:Manual group:   Yaah Manual
 

	
man/man8/yaah.8.gz
Show inline comments
 
binary diff not shown
yaah
Show inline comments
...
 
@@ -5,7 +5,7 @@
 
#:               yaag [options] [<packages]...
 
#:      Options: -h, --help                              Display help
 
#:               -c, --check                             Check installed, foreign packages if there are updates available
 
#:               -p, --parseable                         Check installed, foreing pacakges if there are updates available and print them in a parsable format
 
#:               -p, --parseable                         Check installed, foreign pacakges if there are updates available and print them in a parsable format
 
#:               -d DIRECTORY, --downloaddir DIRECTORY   Download packages to the specified directory
 
#:               -s KEYWORD, --search KEYWORD            Search for packages containing specified keyword
 
#:               -s MAINTAINER, --maintainer MAINTAINER  Search for packages from specified maintainer
...
 
@@ -13,9 +13,9 @@
 
#:               -q, --quiet                             Be less verbose. Takes precedence over -v and --verbose
 
#:               --version                               Prints version and exits
 
#: Requirements: jshon <http://kmkeen.com/jshon/>, pacman, tar, curl
 
#:      Version: 0.6.3
 
#:      Version: 0.6.4
 
#:      Created: 2013-02-26
 
#:     Revision: 2015-03-05
 
#:     Revision: 2015-08-09
 
#:       Author: Dennis Fink <dennis.fink@c3l.lu>
 

	
 
## Security
...
 
@@ -38,8 +38,8 @@ shopt -s expand_aliases
 
SCRIPTNAME=${0##*/}
 
DESCRIPTION="Yet another AUR helper"
 
DATE_OF_CREATION=2013-02-26
 
DATE_OF_REVISION=2015-03-05
 
VERSION=0.6.3
 
DATE_OF_REVISION=2015-08-09
 
VERSION=0.6.4
 
AUTHOR="Dennis Fink <dennis.fink@c3l.lu>"
 

	
 
readonly SCRIPTNAME DESCRIPTION DATE_OF_CREATION DATE_OF_REVISION VERSION AUTHOR
...
 
@@ -73,7 +73,7 @@ COLS="$(tput cols)"
 

	
 
readonly ALL_OFF BOLD RED GREEN YELLOW BLUE PURPLE CYAN COLS
 

	
 
# Alias commands to save place
 
# Alias commands to save characters
 
alias jshon='jshon -Q'
 
alias curl='curl -s -fL'
 

	
...
 
@@ -180,6 +180,11 @@ error() {
 

	
 
search() {
 

	
 
    if [[ $# -lt 2 ]]; then
 
        error "Not enough parameters supplied"
 
        return 1
 
    fi
 

	
 
    local type=$1
 
    shift
 
    if [[ "$type" == "msearch" ]]; then
...
 
@@ -255,22 +260,21 @@ search() {
 

	
 
check_version () {
 

	
 
    if [[ $# -eq 3 ]]; then
 
    if [[ $# -ne 3 ]]; then
 
        error "Not enough parameters supplied"
 
        return 1
 
    fi
 

	
 
        if [[ "$parseable_flag" ]]; then
 
            if [[ $(vercmp "$2" "$3") -eq -1 ]]; then
 
                printf "%s ${GREEN}%s${ALL_OFF}\n" "$1" "$3"
 
            fi
 
        else
 
            msg "Checking version for '$1'"
 

	
 
            if [[ $(vercmp "$2" "$3") -eq -1 ]]; then
 
                msg2 "New version for '$1': $2 -> $3"
 
            fi
 
    if [[ "$parseable_flag" ]]; then
 
        if [[ $(vercmp "$2" "$3") -eq -1 ]]; then
 
            printf "%s ${GREEN}%s${ALL_OFF}\n" "$1" "$3"
 
        fi
 
    else
 
        error "Not enough parameters supplied"
 
        return 1
 
        msg "Checking version for '$1'"
 

	
 
        if [[ $(vercmp "$2" "$3") -eq -1 ]]; then
 
            msg2 "New version for '$1': $2 -> $3"
 
        fi
 
    fi
 

	
 
}
...
 
@@ -378,27 +382,27 @@ query_local_version () {
 

	
 
extract_and_remove () {
 

	
 
    if [[ $# -eq 1 ]]; then
 
        if [[ -f $1 ]]; then
 

	
 
            msg "Extracting '$1'"
 

	
 
            tar xzf "$1" -C "$downloaddir"
 

	
 
            msg_verbose2 "Setting trap to remove archive and extracted directory"
 
            trap "rm -rf '$1' '$downloaddir/${1%.tar.gz}'" EXIT
 

	
 
            msg_verbose1 "Removing '$1'"
 
            rm "$1"
 
        else
 
            error "'$1' is not a file"
 
            return 2
 
        fi
 
    else
 
    if [[ $# -ne 1 ]]; then
 
        error "Not enough parameters supplied"
 
        return 1
 
    fi
 

	
 
    if [[ -f $1 ]]; then
 

	
 
        msg "Extracting '$1'"
 

	
 
        tar xzf "$1" -C "$downloaddir"
 

	
 
        msg_verbose2 "Setting trap to remove archive and extracted directory"
 
        trap "rm -rf '$1' '$downloaddir/${1%.tar.gz}'" EXIT
 

	
 
        msg_verbose1 "Removing '$1'"
 
        rm "$1"
 
    else
 
        error "'$1' is not a file"
 
        return 2
 
    fi
 

	
 
}
 

	
 
#=== FUNCTION =================================================================
...
 
@@ -409,30 +413,29 @@ extract_and_remove () {
 

	
 
download () {
 

	
 
    if [[ $# -ne 0 ]]; then
 
        until [[ -z "$1" ]]; do
 
            local start=${1::2}
 
            local filename="${1}.tar.gz"
 

	
 
            msg "Downloading '$filename' to '$downloaddir'"
 

	
 
            curl -o "$downloaddir/$filename" "${AURURL}packages/$start/$1/$filename"
 

	
 
            if [[ $? -eq 0 ]]; then
 
                msg_verbose2 "Setting trap to remove downloaded file"
 
                trap "rm -f '$downloaddir/$filename'" EXIT
 
                extract_and_remove "$downloaddir/$filename"
 
            else
 
                error "'$1' could not be found!"
 
                return 2
 
            fi
 
            shift
 
        done
 
    else
 
        error "Not enough parameters supplied!"
 
    if [[ $# -eq 0 ]]; then
 
        error "Not enoug parameters supplied!"
 
        return 1
 
    fi
 

	
 
    until [[ -z "$1" ]]; do
 
        local filename="${1}.tar.gz"
 

	
 
        msg "Downloading '$filename' to '$downloaddir'"
 

	
 
        curl -o "$downloaddir/$filename" "${AURURL}cgit/aur.git/snapshot/$filename"
 

	
 
        if [[ $? -eq 0 ]]; then
 
            msg_verbose2 "Setting trap to remove downloaded file"
 
            trap "rm -f '$downloaddir/$filename'" EXIT
 
            extract_and_remove "$downloaddir/$filename"
 
        else
 
            error "'$1' could not be found!"
 
            return 2
 
        fi
 
        shift
 
    done
 

	
 
}
 

	
 
#=== FUNCTION =================================================================
yaah.rst
Show inline comments
...
 
@@ -9,7 +9,7 @@ Yet another AUR helper
 
:Author:         Dennis Fink <the_metalgamer@hackerspace.lu>
 
:Date:           2015-03-05
 
:Copyright:      GPLv3+
 
:Version:        Yaah 0.6.3
 
:Version:        Yaah 0.6.4
 
:Manual section: 8
 
:Manual group:   Yaah Manual
 

	
0 comments (0 inline, 0 general)