implement mirrorMercurial()
This commit is contained in:
parent
12df197648
commit
f87b57fc97
|
@ -63,6 +63,31 @@ function download() {
|
||||||
return ${RESULT}
|
return ${RESULT}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Generates a contents file
|
||||||
|
# Parameters: %contentsfile% %archive%
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
function generateContents() {
|
||||||
|
local OUTPUT="${1}"
|
||||||
|
local ARCHIVE="${2}"
|
||||||
|
[ ! -f ${ARCHIVE} ] && return 1
|
||||||
|
case ${ARCHIVE} in
|
||||||
|
*.iso)
|
||||||
|
isoinfo -l -i ${ARCHIVE} > ${OUTPUT} || return 1
|
||||||
|
;;
|
||||||
|
*.tar)
|
||||||
|
tar -tvf ${ARCHIVE} > ${OUTPUT} || return 1
|
||||||
|
;;
|
||||||
|
*.tar.gz|*.tar.xz|*.tar.z)
|
||||||
|
tar -tvzf ${ARCHIVE} > ${OUTPUT} || return 1
|
||||||
|
;;
|
||||||
|
*.tar.bz2)
|
||||||
|
tar -tvjf ${ARCHIVE} > ${OUTPUT} || return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Generates a hash file
|
# Generates a hash file
|
||||||
# Parameters: %digestfile% %filelist%
|
# Parameters: %digestfile% %filelist%
|
||||||
|
|
|
@ -21,6 +21,25 @@ function mirrorGit() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Creates a local mirror of specified HG repository
|
||||||
|
# Parameters: %dest_directory% %address% [%username%]
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
function mirrorMercurial() {
|
||||||
|
local DIRECTORY="${1}"
|
||||||
|
local ADDRESS="${2}"
|
||||||
|
local USER="${3:-root}"
|
||||||
|
if [ -d ${DIRECTORY} ]; then
|
||||||
|
cd ${DIRECTORY}
|
||||||
|
run "su ${USER} -s \"/bin/sh\" -c \"hg pull --update -e \
|
||||||
|
${BINDIR}/ssh_wrapper.sh\"" || return 1
|
||||||
|
else
|
||||||
|
run "su ${USER} -s \"/bin/sh\" -c \"hg clone ${ADDRESS} ${DIRECTORY} \
|
||||||
|
-e ${BINDIR}/ssh_wrapper.sh\"" || return 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Creates a local mirror of specified repository regardless its protocol
|
# Creates a local mirror of specified repository regardless its protocol
|
||||||
# Parameters: %dest_directory% %protocol% %address% [%username%]
|
# Parameters: %dest_directory% %protocol% %address% [%username%]
|
||||||
|
@ -30,6 +49,9 @@ function mirrorRepository() {
|
||||||
[Gg][Ii][Tt])
|
[Gg][Ii][Tt])
|
||||||
mirrorGit "${1}" "${3}" "${4}" && return 0
|
mirrorGit "${1}" "${3}" "${4}" && return 0
|
||||||
;;
|
;;
|
||||||
|
[Hh][Gg])
|
||||||
|
mirrorMercurial "${1}" "${3}" "${4}" && return 0
|
||||||
|
;;
|
||||||
[Rr][Ss][Yy][Nn][Cc])
|
[Rr][Ss][Yy][Nn][Cc])
|
||||||
mirrorRsync "${1}" "${3}" "${4}" && return 0
|
mirrorRsync "${1}" "${3}" "${4}" && return 0
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue