From 2e8f0b7b345de4c8a2a978b8b5f340254b3de3a2 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 27 Nov 2013 14:10:45 +0100 Subject: [export_target] rsync return status handling --- server/export_target | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'server') diff --git a/server/export_target b/server/export_target index e5fbce12..68d8beb7 100755 --- a/server/export_target +++ b/server/export_target @@ -46,11 +46,17 @@ copy_kernel() { sync_remote() { [[ "${#SERVER_BUILD_DIR}" -lt "10" ]] && perror "Safety check failed: SERVER_BUILD_DIR is less than 10 chars. ($SERVER_BUILD_DIR)" - pinfo "Synching '$REMOTE_IP:export/build' to './server/local_builds'..." + pinfo "Synching 'root@$REMOTE_IP:export/build' to '$SERVER_BUILD_DIR'. This might take a while..." #TODO setup link to remote build directory, later this directory will be rsynced or exported to this server... mkdir -p "${SERVER_BUILD_DIR}" || perror "Could not create directory for local copy of remote system ($SERVER_BUILD_DIR)" - rsync -a --numeric-ids --delete -v -e "ssh -oStrictHostKeyChecking=no" "root@$REMOTE_IP:/export/build/*" "$SERVER_BUILD_DIR" || perror "rsync from 'root@$REMOTE_IP:/export/build' to '$SERVER_BUILD_DIR' failed." + rsync -a --numeric-ids --delete -v -e "ssh -oStrictHostKeyChecking=no" "root@$REMOTE_IP:/export/build/*" "$SERVER_BUILD_DIR" + local RET=$? + if [ $RET -eq 0 ]; then + pinfo "Syncing completed." + else + perror "Syncing of 'root@$REMOTE_IP:/export/build' to '$SERVER_BUILD_DIR' failed with error code: $RET" + fi } generate_stage32() { @@ -59,10 +65,6 @@ generate_stage32() { pinfo "Writing '${TARGET}.sqfs' to '${SERVER_BOOT_DIR}/${TARGET}.sqfs'" mksquashfs "${SERVER_BUILD_DIR}/${TARGET}/" "${SERVER_BOOT_DIR}/${TARGET}.sqfs" -comp xz -b 1M -no-recovery >&6 || perror "mksquashfs failed ($?)." pinfo "Created '${SERVER_BOOT_DIR}/${TARGET}.sqfs'." - #pinfo "Wrapping squashFS in initramfs-stage32" - #generate_initramfs "${SERVER_BOOT_DIR}/stage32_sqfs" "./mnt/${TARGET}.sqfs" "${SERVER_BOOT_DIR}/initramfs-${TARGET}" - # cleanup - #[ -d "${SERVER_BOOT_DIR}/stage32_sqfs" ] && rm -rf ${SERVER_BOOT_DIR}/stage32_sqfs } generate_stage31() { -- cgit v1.2.3-55-g7522