libdevuansdk

common library for devuan's simple distro kits
git clone https://git.parazyd.org/libdevuansdk
Log | Files | Refs | Submodules | README | LICENSE

commit 2ea6563962e9246541a1b902d894b98cd916fd01
parent af6960725d34b4a9a1e37a9955555b69f41eda93
Author: parazyd <parazyd@dyne.org>
Date:   Wed, 12 Oct 2016 14:55:50 +0200

add rsync safety checks (defconfigs change often)

Diffstat:
Mzlibs/imaging | 8++++++--
Mzlibs/rsync | 13+++++++++++--
2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/zlibs/imaging b/zlibs/imaging @@ -133,7 +133,9 @@ image_raw_mount() { ckreq || return 1 mkdir -p $workdir/boot $workdir/root - sudo mount $bootpart $workdir/boot && act "mounted boot partition" || zerr + if [[ $parted_type = dos ]]; then + sudo mount $bootpart $workdir/boot && act "mounted boot partition" || zerr + fi sudo mount $rootpart $workdir/root && act "mounted root partition" || zerr } @@ -142,6 +144,8 @@ image_raw_umount() { req=(workdir bootpart rootpart) ckreq || return 1 - sudo umount $workdir/boot && act "unmounted boot partition" || zerr + if [[ $parted_type = dos ]]; then + sudo umount $workdir/boot && act "unmounted boot partition" || zerr + fi sudo umount $workdir/root && act "unmounted root partition" || zerr } diff --git a/zlibs/rsync b/zlibs/rsync @@ -22,6 +22,7 @@ rsync_to_raw_image() { fn rsync_to_raw_image req=(workdir strapdir bootpart rootpart) + ckreq || return 1 notice "rsyncing strapdir to raw image..." image_raw_mount @@ -29,9 +30,17 @@ rsync_to_raw_image() { silly pushd $strapdir sudo rm -f .done - sudo rsync -HPavz -q --exclude={./boot} ./* $workdir/root + sudo rsync -HPavz -q --exclude={./boot} ./* $workdir/root || { + image_raw_umount + die "not enough space. report a bug please" + zerr + } if [[ $parted_type = dos ]]; then - sudo rsync -HPavz -q ./boot/* $workdir/boot + sudo rsync -HPavz -q ./boot/* $workdir/boot || { + image_raw_umount + die "not enough space. report a bug please" + zerr + } fi popd