diff options
author | KatolaZ <katolaz@freaknet.org> | 2020-01-10 06:57:02 +0000 |
---|---|---|
committer | KatolaZ <katolaz@freaknet.org> | 2020-01-10 06:57:02 +0000 |
commit | 57ed43be9db7243a1f03e689236c143b4967fc0d (patch) | |
tree | e23831c330540260aabebe9f3336a5e26030232d /parse_cgit | |
parent | 10105172df6def5e5a7410119302a701fd9ca7ec (diff) |
allow alternative repo url in parse_cgit
Diffstat (limited to 'parse_cgit')
-rwxr-xr-x | parse_cgit | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -5,7 +5,7 @@ # if [ $# -lt 2 ]; then - printf "Usage: %s <urlbase> <destdir>\n" $0 + printf "Usage: %s <urlbase> <destdir> [<repourl>]\n" $0 exit 1 fi @@ -17,6 +17,14 @@ CURL="torify curl -Ls " TMPFILE="./tmp_$$" READMES="README README.txt README.md readme readme.txt readme.md" + +if [ $# -gt 2 ]; then + REPOURL="$3" +else + REPOURL="$URLBASE" +fi + + ## func cleanup () { rm -f $TMPFILE @@ -67,7 +75,7 @@ get_readmes() { } PROTO=${URLBASE%%:\/\/*} -DIRBASE="$PROTO/${URLBASE##[a-z]*:\/\/}" +DIRBASE="$PROTO/${REPOURL##[a-z]*:\/\/}" echo "proto: $PROTO" echo "dirbase: $DIRBASE" @@ -81,7 +89,7 @@ for r in $repos; do printf "Retrieving repo %s...\n" $repo link=$(echo "$r" | cut -d "|" -f 1 ) name=$(echo "$r" | cut -d "|" -f 2 ) - baselink=$(printf "%s%s" $URLBASE $link) + baselink=$(printf "%s%s" $REPOURL $link) REPODIR="$DEST/$DIRBASE/$link/" mkdir -p $REPODIR get_descr "$link" "$baselink" > ${REPODIR}/DESCR |