diff options
-rwxr-xr-x | src/infra.gentoo.org/rsync-node/wrap_rsync.sh | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/infra.gentoo.org/rsync-node/wrap_rsync.sh b/src/infra.gentoo.org/rsync-node/wrap_rsync.sh index 5a16036..9505a8d 100755 --- a/src/infra.gentoo.org/rsync-node/wrap_rsync.sh +++ b/src/infra.gentoo.org/rsync-node/wrap_rsync.sh @@ -4,10 +4,18 @@ # Then execute rsyncd; we will start serving once the sync completes. # Then keep syncing in the background every 30m. +# We keep the trees in a TMPFS. +mount -t tmpfs -o size=1300m tmpfs "${DEST_DIR}" +if [[ $? -ne 0 ]]; then + logger -t rsync "Init: Failed to create tmpfs: ${DEST_DIR}" + return 1 +fi + # Maintain 2 'partitions' of the tree. # "serving" - This copy is served to users and is not mutated. # "updating" - This copy is a shadow copy used for updates. # Create the two partitions on startup. + PARTITION1=$(mktemp -d -p "${DEST_DIR}" XXXXXX) PARTITION2=$(mktemp -d -p "${DEST_DIR}" XXXXXX) @@ -42,14 +50,8 @@ function sync() { # Function init does a first sync, to populate the serving partition and # setup symlinks, and begin serving data. -# Also, setup the tmpfs to be big enough. # "${1}" is the serving partition. "${2}" is the update partition function init() { - mount -t tmpfs -o size=1300m tmpfs "${DEST_DIR}" - if [[ $? -ne 0 ]]; then - logger -t rsync "Init: Failed to resize tmpfs: ${DEST_DIR}" - return 1 - fi sync "${1}" "${SOURCE_MIRROR}" # this is synchronous. # We serve out of ${DEST_DIR}/serving |