Code cleanup
This commit is contained in:
parent
5b39afb11a
commit
f3df9c675a
|
@ -27,8 +27,12 @@
|
||||||
#variables
|
#variables
|
||||||
GIT_MIRROR="/home/defora/git"
|
GIT_MIRROR="/home/defora/git"
|
||||||
GIT_REMOTE="origin"
|
GIT_REMOTE="origin"
|
||||||
|
PROGNAME_GIT_MIRROR="deforaos-git-mirror.sh"
|
||||||
#executables
|
#executables
|
||||||
GIT="/usr/bin/git"
|
GIT="/usr/bin/git"
|
||||||
|
GIT_CLONE="$GIT clone -q"
|
||||||
|
GIT_FETCH="$GIT fetch -q"
|
||||||
|
GIT_RESET="$GIT reset -q"
|
||||||
|
|
||||||
|
|
||||||
#functions
|
#functions
|
||||||
|
@ -40,7 +44,7 @@ _git_mirror()
|
||||||
|
|
||||||
if [ ! -d "$mirror" ]; then
|
if [ ! -d "$mirror" ]; then
|
||||||
#clone the repository
|
#clone the repository
|
||||||
$GIT clone "$HOME/repositories/${repository}.git" "$mirror"
|
$GIT_CLONE "$HOME/repositories/${repository}.git" "$mirror"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "$repository: Could not create mirror" 1>&2
|
echo "$repository: Could not create mirror" 1>&2
|
||||||
continue
|
continue
|
||||||
|
@ -48,8 +52,16 @@ _git_mirror()
|
||||||
fi
|
fi
|
||||||
#mirror the repository
|
#mirror the repository
|
||||||
(cd "$mirror" &&
|
(cd "$mirror" &&
|
||||||
$GIT fetch -q "$GIT_REMOTE" &&
|
$GIT_FETCH "$GIT_REMOTE" &&
|
||||||
$GIT reset -q --hard "$GIT_REMOTE/$branch") || return 2
|
$GIT_RESET --hard "$GIT_REMOTE/$branch") || return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#usage
|
||||||
|
_usage()
|
||||||
|
{
|
||||||
|
echo "Usage: $PROGNAME_GIT_MIRROR repository" 1>&2
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user