17 lines
656 B
Bash
Executable file
17 lines
656 B
Bash
Executable file
#!/bin/bash
|
|
|
|
if [ ! -z "$1" ] && [ $1 == "-h" ]; then
|
|
echo "1st param: site without https://"
|
|
echo "2nd param: git user"
|
|
echo "3st param: repo name"
|
|
echo "i.e.: git2tar forgit.patachina.it Fabio wsdd"
|
|
elif [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
|
|
echo "missing parameter, they should be 4"
|
|
echo "1st param: site without https://"
|
|
echo "2nd param: git user"
|
|
echo "3st param: repo name"
|
|
echo "i.e.: git2tar forgit.patachina.it Fabio wsdd"
|
|
else
|
|
a=$(curl -s https://$1/api/v1/users/$2/repos | jq '.[] | select(.name=='\"$3\"') | "\(.default_branch)"' | grep -o '[^"]*' )
|
|
wget -O $3.git.tar.gz https://$1/$2/$3/archive/$a.tar.gz
|
|
fi
|