Changeset - 0a566bffbf08
[Not reviewed]
default
0 1 0
Dennis Fink (metalgamer) - 4 years ago 2015-12-14 18:54:16
dennis.fink@c3l.lu
Added feature to download packages using git
1 file changed with 27 insertions and 7 deletions:
yaah
27
7
0 comments (0 inline, 0 general)
yaah
Show inline comments
...
 
@@ -383,16 +383,30 @@ download () {
 
    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 [[ -z $git_flag ]]; then
 
            local filename="${1}.tar.gz"
 
            msg "Downloading '$filename' to '$downloaddir'"
 
            curl -o "$downloaddir/$filename" "${AURURL}cgit/aur.git/snapshot/$filename"
 
        else
 
            local gitrepo="${1}.git"
 
            msg "Cloning '$1' into '$downloaddir'"
 
            git clone --quiet "${AURURL}/$gitrepo"
 
        fi
 

	
 
        if [[ $? -eq 0 ]]; then
 
            msg_verbose2 "Setting trap to remove downloaded file"
 
            trap "rm -f '$downloaddir/$filename'" EXIT
 
            extract_and_remove "$downloaddir/$filename"
 
            if [[ $git_flag -ne 1 ]]; then
 
                msg_verbose2 "Setting trap to remove downloaded file"
 
                trap "rm -f '$downloaddir/$filename'" EXIT
 
                extract_and_remove "$downloaddir/$filename"
 
            else
 
                msg_verbose2 "Checking if we downloaded an empty repository"
 
                if [[ ! -e "$downloaddir/$1/PKGBUILD" ]]; then
 
                    rm -fr "$downloaddir/$1"
 
                    error "'$1' could not be found!"
 
                    return 2
 
                fi
 
            fi
 
        else
 
            error "'$1' could not be found!"
 
            return 2
...
 
@@ -452,6 +466,7 @@ check_flag=
 
search_flag=
 
maintainer_flag=
 
parseable_flag=
 
git_flag=0
 
verbose=0
 
quiet=0
 
downloaddir="$PWD"
...
 
@@ -508,6 +523,11 @@ while true; do
 
            quiet=1
 
            shift
 
            ;;
 
        -g|--git)
 
            git_flag=1
 
            hash git 2>/dev/null || { error "git is not installed"; exit 3; }
 
            shift
 
            ;;
 
        --version)
 
            version
 
            exit 0
0 comments (0 inline, 0 general)