Rename functions
This commit is contained in:
parent
db27d6ae14
commit
a74174b354
6
ezsync
6
ezsync
|
@ -92,13 +92,13 @@ eval `keychain --noask --eval id_dsa id_rsa &> /dev/null`
|
||||||
|
|
||||||
# Update local copy of Portage that is being built
|
# Update local copy of Portage that is being built
|
||||||
printInfo "Refreshing local build Portage tree..."
|
printInfo "Refreshing local build Portage tree..."
|
||||||
synchronizeRepository ${PORTAGESDIR}/${PORTAGE_BUILD[0]} ${PORTAGE_BUILD[1]} ${PORTAGE_BUILD[2]} ${PORTAGE_BUILD[3]}
|
pullRepository ${PORTAGESDIR}/${PORTAGE_BUILD[0]} ${PORTAGE_BUILD[1]} ${PORTAGE_BUILD[2]} ${PORTAGE_BUILD[3]}
|
||||||
[ ${?} -ne 0 ] && die "EzBuild was unable to refresh local copy of build Portage tree!" 2
|
[ ${?} -ne 0 ] && die "EzBuild was unable to refresh local copy of build Portage tree!" 2
|
||||||
|
|
||||||
# Update local copy of mainline Portage
|
# Update local copy of mainline Portage
|
||||||
if ! hasElement "mainline" ${EZNOSYNC} && ! hasElement "portage" ${EZNOSYNC}; then
|
if ! hasElement "mainline" ${EZNOSYNC} && ! hasElement "portage" ${EZNOSYNC}; then
|
||||||
printInfo "Synchronizing mainline Portage tree..."
|
printInfo "Synchronizing mainline Portage tree..."
|
||||||
synchronizeRepository ${PORTAGESDIR}/${PORTAGE_MAINLINE[0]} ${PORTAGE_MAINLINE[1]} ${PORTAGE_MAINLINE[2]} ${PORTAGE_MAINLINE[3]}
|
pullRepository ${PORTAGESDIR}/${PORTAGE_MAINLINE[0]} ${PORTAGE_MAINLINE[1]} ${PORTAGE_MAINLINE[2]} ${PORTAGE_MAINLINE[3]}
|
||||||
[ ${?} -ne 0 ] && die "EzBuild was unable to synchronize mainline Portage tree!" 2
|
[ ${?} -ne 0 ] && die "EzBuild was unable to synchronize mainline Portage tree!" 2
|
||||||
[ -e ${PORTAGESDIR}/${PORTAGE_MAINLINE[0]}/metadata/cache ] && rm -rf ${PORTAGESDIR}/${PORTAGE_MAINLINE[0]}/metadata/cache
|
[ -e ${PORTAGESDIR}/${PORTAGE_MAINLINE[0]}/metadata/cache ] && rm -rf ${PORTAGESDIR}/${PORTAGE_MAINLINE[0]}/metadata/cache
|
||||||
echo "distfiles/*" > ${PORTAGESDIR}/${PORTAGE_MAINLINE[0]}/.gitignore
|
echo "distfiles/*" > ${PORTAGESDIR}/${PORTAGE_MAINLINE[0]}/.gitignore
|
||||||
|
@ -117,7 +117,7 @@ for OVERLAY in ${SYNC_OVERLAYS[*]}; do
|
||||||
CURRENT_OVERLAY=(`eval echo ${TEMP}`)
|
CURRENT_OVERLAY=(`eval echo ${TEMP}`)
|
||||||
if ! hasElement "${CURRENT_OVERLAY[0]}" ${EZNOSYNC}; then
|
if ! hasElement "${CURRENT_OVERLAY[0]}" ${EZNOSYNC}; then
|
||||||
printInfo "Synchronizing overlay: ${CURRENT_OVERLAY[0]}..."
|
printInfo "Synchronizing overlay: ${CURRENT_OVERLAY[0]}..."
|
||||||
synchronizeRepository ${OVERLAYSDIR}/${CURRENT_OVERLAY[0]} ${CURRENT_OVERLAY[1]} ${CURRENT_OVERLAY[2]} ${CURRENT_OVERLAY[3]}
|
pullRepository ${OVERLAYSDIR}/${CURRENT_OVERLAY[0]} ${CURRENT_OVERLAY[1]} ${CURRENT_OVERLAY[2]} ${CURRENT_OVERLAY[3]}
|
||||||
[ ${?} -ne 0 ] && fail "EzBuild was unable to synchronize ${CURRENT_OVERLAY[0]}!" 4
|
[ ${?} -ne 0 ] && fail "EzBuild was unable to synchronize ${CURRENT_OVERLAY[0]}!" 4
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -3,11 +3,24 @@
|
||||||
# Distributed under the terms of the GNU General Public License v3
|
# Distributed under the terms of the GNU General Public License v3
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Creates SSH Wrapper for use with unknown hosts (requires key authentication)
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
function makeSshWrapper() {
|
||||||
|
echo "#!/bin/bash" > ${BINDIR}/ssh_wrapper.sh
|
||||||
|
echo "exec ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
|
||||||
|
\"\$@\"" >> ${BINDIR}/ssh_wrapper.sh
|
||||||
|
chmod +x ${BINDIR}/ssh_wrapper.sh || return 1
|
||||||
|
export GIT_SSH="${BINDIR}/ssh_wrapper.sh"
|
||||||
|
export SVN_SSH="${BINDIR}/ssh_wrapper.sh"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Downloads or updates specified GIT repository
|
# Downloads or updates specified GIT repository
|
||||||
# Parameters: %dest_directory% %address% [%branch%]
|
# Parameters: %dest_directory% %address% [%branch%]
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
function checkoutGit() {
|
function pullGit() {
|
||||||
local DIRECTORY="${1}"
|
local DIRECTORY="${1}"
|
||||||
local ADDRESS="${2}"
|
local ADDRESS="${2}"
|
||||||
local BRANCH="${3:-master}"
|
local BRANCH="${3:-master}"
|
||||||
|
@ -26,11 +39,37 @@ function checkoutGit() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Synchronizes specified repository regardless its protocol
|
||||||
|
# Parameters: %dest_directory% %protocol% %address% [%branch%]
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
function pullRepository() {
|
||||||
|
for ((i=0; $i<${FETCHTRIES}; i++)); do
|
||||||
|
case "${2}" in
|
||||||
|
[Gg][Ii][Tt])
|
||||||
|
pullGit ${1} ${3} ${4} && return 0
|
||||||
|
;;
|
||||||
|
[Rr][Ss][Yy][Nn][Cc])
|
||||||
|
pullRsync ${1} ${3} && return 0
|
||||||
|
;;
|
||||||
|
[Ss][Vv][Nn])
|
||||||
|
pullSubversion ${1} ${3} && return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printWarn "Tried to fetch repository using unsupported protocol!"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
sleep ${FETCHTIMEOUT}
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Downloads or updates specified RSYNC repository
|
# Downloads or updates specified RSYNC repository
|
||||||
# Parameters: %dest_directory% %address%
|
# Parameters: %dest_directory% %address%
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
function checkoutRsync() {
|
function pullRsync() {
|
||||||
DIRECTORY="${1}"
|
DIRECTORY="${1}"
|
||||||
ADDRESS="${2}"
|
ADDRESS="${2}"
|
||||||
run "rsync --compress --delete --delete-after --devices --force --links \
|
run "rsync --compress --delete --delete-after --devices --force --links \
|
||||||
|
@ -46,7 +85,7 @@ function checkoutRsync() {
|
||||||
# Downloads or updates specified SVN repository
|
# Downloads or updates specified SVN repository
|
||||||
# Parameters: %dest_directory% %address%
|
# Parameters: %dest_directory% %address%
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
function checkoutSubversion() {
|
function pullSubversion() {
|
||||||
local DIRECTORY="${1}"
|
local DIRECTORY="${1}"
|
||||||
local ADDRESS="${2}"
|
local ADDRESS="${2}"
|
||||||
if [ -d ${DIRECTORY} ]; then
|
if [ -d ${DIRECTORY} ]; then
|
||||||
|
@ -58,42 +97,3 @@ function checkoutSubversion() {
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Creates SSH Wrapper for use with unknown hosts (requires key authentication)
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
function makeSshWrapper() {
|
|
||||||
echo "#!/bin/bash" > ${BINDIR}/ssh_wrapper.sh
|
|
||||||
echo "exec ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
|
|
||||||
\"\$@\"" >> ${BINDIR}/ssh_wrapper.sh
|
|
||||||
chmod +x ${BINDIR}/ssh_wrapper.sh || return 1
|
|
||||||
export GIT_SSH="${BINDIR}/ssh_wrapper.sh"
|
|
||||||
export SVN_SSH="${BINDIR}/ssh_wrapper.sh"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Synchronizes specified repository regardless its protocol
|
|
||||||
# Parameters: %dest_directory% %protocol% %address% [%branch%]
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
function synchronizeRepository() {
|
|
||||||
for ((i=0; $i<${FETCHTRIES}; i++)); do
|
|
||||||
case "${2}" in
|
|
||||||
[Gg][Ii][Tt])
|
|
||||||
checkoutGit ${1} ${3} ${4} && return 0
|
|
||||||
;;
|
|
||||||
[Rr][Ss][Yy][Nn][Cc])
|
|
||||||
checkoutRsync ${1} ${3} && return 0
|
|
||||||
;;
|
|
||||||
[Ss][Vv][Nn])
|
|
||||||
checkoutSubversion ${1} ${3} && return 0
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
printWarn "Tried to fetch repository using unsupported protocol!"
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
sleep ${FETCHTIMEOUT}
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue