diff options
Diffstat (limited to 'packager/openslx.functions')
-rw-r--r-- | packager/openslx.functions | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/packager/openslx.functions b/packager/openslx.functions index 7fe74e0a..3b5c4394 100644 --- a/packager/openslx.functions +++ b/packager/openslx.functions @@ -353,6 +353,9 @@ clone_stage4() { # run rsync with the exclude/include lists created earlier cat "$INCLUDE" "$EXCLUDE" | \ rsync --verbose \ + --acls \ + --hard-links \ + --xattrs \ --archive \ --delete \ --delete-excluded \ @@ -424,7 +427,7 @@ pack_qcow2() { # which size for the qcow2 container? if [ -z "$DEFAULT_QCOW_SIZE" ]; then - local QCOW_SIZE="10G" + local QCOW_SIZE="25G" else local QCOW_SIZE="$DEFAULT_QCOW_SIZE" fi @@ -446,6 +449,10 @@ pack_qcow2() { perror "qemu-nbd failed with: $?" pinfo "Done." + # expose as a loop device + local NBD_LOOPED_DEV="$(losetup --find)" + losetup "${NBD_LOOPED_DEV}" "${NBD_DEV}" + # which filesystem for the qcow2 container? if [ -z "$DEFAULT_QCOW_FS" ]; then local QCOW_FS="ext4" @@ -457,32 +464,33 @@ pack_qcow2() { fi pinfo "Creating '${QCOW_FS}' filesystem on '${CONTAINER_PATH}'..." _STATE='QCOW_FSING' - mkfs."${QCOW_FS}" "${NBD_DEV}" || perror "mkfs failed with: $?" + mkfs."${QCOW_FS}" "${NBD_LOOPED_DEV}" || perror "mkfs failed with: $?" pinfo "Done." # prepare NBD mount directory and check state to be safe local NBD_MNT="$(mktemp -d)" [ ! -d "${NBD_MNT}" ] && \ - perror "Making temporary dir for mounting '$NBD_DEV' failed." + perror "Making temporary dir for mounting '${NBD_DEV}' failed." is_dir_empty ${NBD_MNT} || \ - perror "'${NBD_MNT}' not empty. Refusing to mount ${NBD_DEV} to it." + perror "'${NBD_MNT}' not empty. Refusing to mount '${NBD_DEV}' to it." pinfo "Mounting '${NBD_DEV}' to '${NBD_MNT}'..." _STATE='QCOW_MOUNTING' - mount "${NBD_DEV}" "${NBD_MNT}" || perror "Mount failed with: $?" + mount "${NBD_LOOPED_DEV}" "${NBD_MNT}" || perror "Mount failed with: $?" pinfo "Done." # copy files from the stage4 directory to the mounted qcow2-container pinfo "Copying '${RSYNC_TARGET}' to '${NBD_MNT}'..." _STATE='QCOW_COPYING' - cp -ra "${RSYNC_TARGET}"/* "${NBD_MNT}" || perror "Copying failed with: $?" + rsync -avAHX "${RSYNC_TARGET}"/ "${NBD_MNT}"/ || perror "Copying failed with: $?" pinfo "Done." pinfo "Cleaning up..." _STATE='QCOW_CLEANING' umount "${NBD_MNT}" || pwarning "Could not unmount '${NBD_MNT}'." rmdir "${NBD_MNT}" || pwarning "Could not remove '${NBD_MNT}'." + losetup -d "${NBD_LOOPED_DEV}" || pwarning "Could not disconnect '${NBD_LOOPED_DEV}'." qemu-nbd -d "${NBD_DEV}" || pwarning "Could not disconnect '${NBD_DEV}'." _STATE='QCOW_DONE' pinfo "Exporting '${RSYNC_TARGET}' to '${CONTAINER_PATH}' completed." |