first commit
This commit is contained in:
commit
5f835c69c0
6 changed files with 116 additions and 0 deletions
32
README.md
Normal file
32
README.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Come fare backup di git repository
|
||||
|
||||
verificare file PATH
|
||||
|
||||
echo $PATH
|
||||
|
||||
si dovrebbe trovare anche il path /usr/local/bin/
|
||||
|
||||
copiare tutti i files
|
||||
|
||||
sudo cp allgit2tar /usr/local/bin/
|
||||
sudo cp git2tar /usr/local/bin/
|
||||
sudo cp targit2dir /usr/local/bin/
|
||||
sudo cp git2tarAuto /usr/local/bin/
|
||||
sudo cp alltargit2dir /usr/local/bin/
|
||||
|
||||
per fare il backup completo digitare
|
||||
|
||||
allgit2tar forgit.patachina.it Fabio
|
||||
|
||||
per fare il backup di un singolo repository es: Photon
|
||||
|
||||
git2tarAuto forgit.patachina.it Fabio Photon
|
||||
|
||||
per convertire in dir es
|
||||
|
||||
targit2dir Photon <opt dir>
|
||||
|
||||
per convertire tutto in directory per es:
|
||||
|
||||
alltargit2dir <opt dir>
|
||||
|
18
allgit2tar
Executable file
18
allgit2tar
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "needed 2 params"
|
||||
echo "1st param: site without https://"
|
||||
echo "2nd param: user of git"
|
||||
echo "i.e.: allgit2tar forgit.patachina.it Fabio"
|
||||
elif [ $1 == "-h" ]; then
|
||||
echo "1st param: site without https://"
|
||||
echo "2nd param: user of git"
|
||||
echo "i.e.: allgit2tar forgit.patachina.it Fabio"
|
||||
elif [ -z "$2" ]; then
|
||||
echo "missing 2nd param: user of git"
|
||||
echo "the 1st shuold be site without https://"
|
||||
else
|
||||
#curl -s https://$1/api/v1/users/$2/repos | jq '.[] | "\(.full_name) \(.default_branch)"' | grep -o '[^"]*' | sed -e "s/^$2\///" | xargs -l git2tar $1 $2
|
||||
curl -s https://$1/api/v1/users/$2/repos | jq '.[] | "\(.name) \(.default_branch)"' | grep -o '[^"]*' | xargs -l git2tar $1 $2
|
||||
fi
|
15
alltargit2dir
Executable file
15
alltargit2dir
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! -z "$1" ] && [ $1 == "-h" ]; then
|
||||
echo "1st param optional: dir of output"
|
||||
echo "i.e.: targit2dir <dir>"
|
||||
elif [ -z "$1" ]; then
|
||||
echo "1st param optional: dir of output"
|
||||
echo "i.e.: targit2dir <dir>"
|
||||
elif [ ! -z "$1" ]; then
|
||||
#echo $1
|
||||
ls *.git.tar.gz | xargs -l tar -C $1 -xvzf
|
||||
else
|
||||
ls *.git.tar.gz | xargs -l tar -xvzf
|
||||
fi
|
||||
|
19
git2tar
Executable file
19
git2tar
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! -z "$1" ] && [ $1 == "-h" ]; then
|
||||
echo "1st param: site without https://"
|
||||
echo "2nd param: git user"
|
||||
echo "3th param: repo name"
|
||||
echo "4th param: branch"
|
||||
echo "i.e.: git2tar forgit.patachina.it Fabio wsdd main"
|
||||
elif [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ]; then
|
||||
echo "missing parameter, they should be 4"
|
||||
echo "1st param: site without https://"
|
||||
echo "2nd param: git user"
|
||||
echo "3th param: repo name"
|
||||
echo "4th param: branch"
|
||||
echo "i.e.: git2tar forgit.patachina.it Fabio wsdd main"
|
||||
else
|
||||
#echo "wget -O $3.git.tar.gz https://$1/$2/$3/archive/$4.tar.gz"
|
||||
wget -O $3.git.tar.gz https://$1/$2/$3/archive/$4.tar.gz
|
||||
fi
|
17
git2tarAuto
Executable file
17
git2tarAuto
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/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
|
15
targit2dir
Executable file
15
targit2dir
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! -z "$1" ] && [ $1 == "-h" ]; then
|
||||
echo "1st param: name of name.git.tar.gz "
|
||||
echo "2nd param optional: dir of output"
|
||||
echo "i.e.: targit2dir Photon"
|
||||
elif [ -z "$1" ]; then
|
||||
echo "1st param: name of name.git.tar.gz "
|
||||
echo "2nd param optional: dir of output"
|
||||
echo "i.e.: targit2dir Photon"
|
||||
elif [ ! -z "$1" ] && [ ! -z "$2" ]; then
|
||||
tar -xvzf $1.git.tar.gz -C $2
|
||||
else
|
||||
tar -xvzf $1.git.tar.gz
|
||||
fi
|
Loading…
Reference in a new issue