Browse Source

create rsync mirror

master
belliash 7 years ago
parent
commit
0345600e53
1 changed files with 17 additions and 0 deletions
  1. 17
    0
      libraries/repositories

+ 17
- 0
libraries/repositories View File

@@ -30,6 +30,9 @@ function mirrorRepository() {
[Gg][Ii][Tt])
mirrorGit "${1}" "${3}" "${4}" && return 0
;;
[Rr][Ss][Yy][Nn][Cc])
mirrorRsync "${1}" "${3}" "${4}" && return 0
;;
*)
printWarn "Tried to mirror data using unsupported protocol (${2})!"
;;
@@ -37,6 +40,20 @@ function mirrorRepository() {
return 1
}

#-------------------------------------------------------------------------------
# Creates a local mirror of specified RSYNC repository
# Parameters: %dest_directory% %address% [%username%]
#-------------------------------------------------------------------------------
function mirrorRsync() {
local DIRECTORY="${1}"
local ADDRESS="${2}"
local USER="${3:-root}"
run "su ${USER} -s \"/bin/sh\" -c \"rsync --compress --devices --delete \
--links --perms --recursive --stats --timeout=${FETCHTIMEOUT} --times \
${ADDRESS} ${DIRECTORY}\""
return ${?}
}

#-------------------------------------------------------------------------------
# Prepares SSH Wrappers for use with unknown hosts (requires key authentication)
#-------------------------------------------------------------------------------

Loading…
Cancel
Save