From f23babe971f08a347d807f8264471b12f7f1c3ef Mon Sep 17 00:00:00 2001 From: iberezovskiy Date: Tue, 29 Oct 2013 15:36:07 +0400 Subject: [PATCH] Check existence of directory 'lost+found' The command `sudo rmdir $TARGET_ROOT/lost+found` will fail if `$TARGET_ROOT/lost+found` directory doesn't exist, e.g. when you use non-default image. Fixes bug #1245856 Change-Id: I48c8f2f201b29912a726249023ca7d20893cc958 --- elements/fedora/root.d/10-fedora-cloud-image | 4 +++- elements/rhel/root.d/10-rhel-cloud-image | 4 +++- elements/ubuntu/root.d/10-cache-ubuntu-tarball | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/elements/fedora/root.d/10-fedora-cloud-image b/elements/fedora/root.d/10-fedora-cloud-image index 2b3f6b2ff..91617f867 100755 --- a/elements/fedora/root.d/10-fedora-cloud-image +++ b/elements/fedora/root.d/10-fedora-cloud-image @@ -73,4 +73,6 @@ fi # Extract the base image (use --numeric-owner to avoid UID/GID mismatch between # image tarball and host OS e.g. when building Fedora image on an openSUSE host) sudo tar -C $TARGET_ROOT --numeric-owner -xzf $DIB_IMAGE_CACHE/$BASE_IMAGE_TAR -sudo rmdir $TARGET_ROOT/lost+found +if [ -e "$TARGET_ROOT/lost+found" ]; then + sudo rmdir $TARGET_ROOT/lost+found +fi diff --git a/elements/rhel/root.d/10-rhel-cloud-image b/elements/rhel/root.d/10-rhel-cloud-image index 724dd1130..cd7c31b24 100755 --- a/elements/rhel/root.d/10-rhel-cloud-image +++ b/elements/rhel/root.d/10-rhel-cloud-image @@ -54,4 +54,6 @@ fi # Extract the base image (use --numeric-owner to avoid UID/GID mismatch between # image tarball and host OS e.g. when building RHEL image on an openSUSE host) sudo tar -C $TARGET_ROOT --numeric-owner -xzf $DIB_IMAGE_CACHE/$BASE_IMAGE_TAR -sudo rmdir $TARGET_ROOT/lost+found +if [ -e "$TARGET_ROOT/lost+found" ]; then + sudo rmdir $TARGET_ROOT/lost+found +fi diff --git a/elements/ubuntu/root.d/10-cache-ubuntu-tarball b/elements/ubuntu/root.d/10-cache-ubuntu-tarball index 400e57f0a..5da254527 100755 --- a/elements/ubuntu/root.d/10-cache-ubuntu-tarball +++ b/elements/ubuntu/root.d/10-cache-ubuntu-tarball @@ -27,4 +27,6 @@ fi # Extract the base image (use --numeric-owner to avoid UID/GID mismatch between # image tarball and host OS e.g. when building Ubuntu image on an openSUSE host) sudo tar -C $TARGET_ROOT --numeric-owner -xzf $DIB_IMAGE_CACHE/$BASE_IMAGE_FILE -sudo rmdir $TARGET_ROOT/lost+found +if [ -e "$TARGET_ROOT/lost+found" ]; then + sudo rmdir $TARGET_ROOT/lost+found +fi