Removed obsolette scripts
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
parent
34d381e7f1
commit
9ba0925b8d
|
@ -1,72 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Clone repository from mirror
|
||||
#
|
||||
# Usage:
|
||||
# cclone <main repo url> [ -p <path> ] [ -c <checkout_ref> ]
|
||||
|
||||
# strict mode
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
# include config
|
||||
source $(dirname $(realpath $0))/config
|
||||
source $(dirname $(realpath $0))/gen-mirror-path
|
||||
|
||||
# parse arguments
|
||||
function usage(){
|
||||
echo "Usage: $0 [-p <path>] [-c <checkout_ref>]" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
repo=$1
|
||||
|
||||
if [[ ! "$repo" =~ ^-.* ]]
|
||||
then
|
||||
# check if repo was mirrored
|
||||
if [ ! -d $(getRepoPath $repo) ]
|
||||
then
|
||||
echo "Specified repo wasn't mirrored yes, please do it so!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
# kick args +1
|
||||
shift
|
||||
else
|
||||
usage
|
||||
fi
|
||||
|
||||
# other opts
|
||||
while getopts "c:p:" o; do
|
||||
case "${o}" in
|
||||
c)
|
||||
param_c=${OPTARG}
|
||||
;;
|
||||
p)
|
||||
param_p=${OPTARG}
|
||||
;;
|
||||
\?)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
# Run clone
|
||||
cloneurl=$(getRepoPath $repo)
|
||||
clonepath=${param_p:-}
|
||||
|
||||
echo "Cloning $repo"
|
||||
git clone file://$cloneurl $clonepath
|
||||
|
||||
checkout=${param_c:-}
|
||||
if [ -n "$checkout" ]
|
||||
then
|
||||
chdir=${param_p:-$(getRepoUniq $repo)}
|
||||
echo "Checking out $checkout"
|
||||
oldpwd=$(pwd)
|
||||
cd $chdir
|
||||
# -b just to make git less verbose
|
||||
git checkout $checkout -b _tmp_$checkout
|
||||
cd $oldpwd
|
||||
fi
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Clone repository from mirror - recursively with submodules
|
||||
#
|
||||
# Usage:
|
||||
# sclone <main repo url> [ -p <path> ] [ -c <checkout_ref>
|
||||
|
||||
# strict mode
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
# Scratch - temp
|
||||
tmpdir=$(mktemp -d -t mirror-recursive-XXXXXXX)
|
||||
function finish {
|
||||
rm -rf "$tmpdir"
|
||||
}
|
||||
trap finish EXIT
|
||||
|
||||
# include config
|
||||
source $(dirname $(realpath $0))/config
|
||||
source $(dirname $(realpath $0))/gen-mirror-path
|
||||
|
||||
# parse arguments
|
||||
function usage(){
|
||||
echo "Usage: $0 [-p <path>] [-c <checkout_ref>]" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ $# -eq 0 ] && usage
|
||||
|
||||
repo=$1
|
||||
|
||||
|
||||
# clone the repo
|
||||
cclone $@ || true
|
||||
# skip url
|
||||
shift
|
||||
|
||||
# parse opts
|
||||
while getopts "c:p:" o; do
|
||||
case "${o}" in
|
||||
c)
|
||||
param_c=${OPTARG}
|
||||
;;
|
||||
p)
|
||||
param_p=${OPTARG}
|
||||
;;
|
||||
\?)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# change dir and examine the commit + submodules
|
||||
oldpwd=$(pwd)
|
||||
submodules=$tmpdir/submodules
|
||||
cd ${param_p:-$(getRepoUniq $repo)}
|
||||
submodule-describe . > $submodules
|
||||
|
||||
while read -r line || [[ -n "$line" ]]
|
||||
do
|
||||
# read -r retypes \t to ' ' (space)
|
||||
commit=$(echo $line | cut -f1 -d' ')
|
||||
directory=$(echo $line | cut -f2 -d' ')
|
||||
url=$(echo $line | cut -f3 -d' ')
|
||||
# recursion ++
|
||||
sclone $url -p $directory -c $commit
|
||||
done < $submodules
|
||||
|
||||
|
||||
|
||||
cd $oldpwd
|
||||
|
Loading…
Reference in New Issue
Block a user