Procházet zdrojové kódy

implement mirrorMercurial()

master
belliash před 8 roky
rodič
revize
f87b57fc97
2 změnil soubory, kde provedl 47 přidání a 0 odebrání
  1. +25
    -0
      libraries/filesystem
  2. +22
    -0
      libraries/repositories

+ 25
- 0
libraries/filesystem Zobrazit soubor

@@ -63,6 +63,31 @@ function download() {
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
# Parameters: %digestfile% %filelist%

+ 22
- 0
libraries/repositories Zobrazit soubor

@@ -21,6 +21,25 @@ function mirrorGit() {
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
# Parameters: %dest_directory% %protocol% %address% [%username%]
@@ -30,6 +49,9 @@ function mirrorRepository() {
[Gg][Ii][Tt])
mirrorGit "${1}" "${3}" "${4}" && return 0
;;
[Hh][Gg])
mirrorMercurial "${1}" "${3}" "${4}" && return 0
;;
[Rr][Ss][Yy][Nn][Cc])
mirrorRsync "${1}" "${3}" "${4}" && return 0
;;

Načítá se…
Zrušit
Uložit