From 267e96f52c0eb444af689eb7ec79bbbcca61a2e2 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Mon, 4 Aug 2014 05:40:47 -0400 Subject: [PATCH] Centralize handling of /lost+found Just remove globally /lost+found after the root and install phases, so distribution elements don't need to do that by themselves. Change-Id: Ic783e613bd8794aefd3f40c9a7c308d14cd04b8d --- bin/disk-image-create | 6 ++++++ elements/opensuse/post-install.d/99-remove-lost-and-found | 7 ------- elements/redhat-common/bin/extract-image | 3 --- elements/rhel/root.d/10-rhel-cloud-image | 3 --- elements/ubuntu/root.d/10-cache-ubuntu-tarball | 3 --- 5 files changed, 6 insertions(+), 16 deletions(-) delete mode 100755 elements/opensuse/post-install.d/99-remove-lost-and-found diff --git a/bin/disk-image-create b/bin/disk-image-create index 61d5c25f6..b65fb13b5 100755 --- a/bin/disk-image-create +++ b/bin/disk-image-create @@ -145,6 +145,12 @@ do_extra_package_install run_d_in_target install run_d_in_target post-install prepare_first_boot +# ensure we do not have a lost+found directory in the root folder +# that could cause copy to fail (it will be created again later +# when creating the file system, if it needs such directory) +if [ -e "$TMP_BUILD_DIR/mnt/lost+found" ]; then + sudo rm -rf "$TMP_BUILD_DIR/mnt/lost+found" +fi # Free up /mnt unmount_image mv $TMP_BUILD_DIR/mnt $TMP_BUILD_DIR/built diff --git a/elements/opensuse/post-install.d/99-remove-lost-and-found b/elements/opensuse/post-install.d/99-remove-lost-and-found deleted file mode 100755 index 226f74d23..000000000 --- a/elements/opensuse/post-install.d/99-remove-lost-and-found +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# ensure we do not have a lost+found directory in the root folder -# that could cause copy to fail. -set -eu -set -o pipefail - -rm -rf lost+found diff --git a/elements/redhat-common/bin/extract-image b/elements/redhat-common/bin/extract-image index 2f8730d0d..de74915e1 100755 --- a/elements/redhat-common/bin/extract-image +++ b/elements/redhat-common/bin/extract-image @@ -95,6 +95,3 @@ fi # image tarball and host OS e.g. when building Fedora image on an openSUSE host) echo "Extracting base root image from $CACHED_TAR" sudo tar -C $TARGET_ROOT --numeric-owner -xzf $CACHED_TAR -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 226cb35a4..2867e36aa 100755 --- a/elements/rhel/root.d/10-rhel-cloud-image +++ b/elements/rhel/root.d/10-rhel-cloud-image @@ -55,6 +55,3 @@ 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 -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 3c4990b66..3bc9c3ff8 100755 --- a/elements/ubuntu/root.d/10-cache-ubuntu-tarball +++ b/elements/ubuntu/root.d/10-cache-ubuntu-tarball @@ -45,9 +45,6 @@ function get_ubuntu_tarball() { # 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 - if [ -e "$TARGET_ROOT/lost+found" ]; then - sudo rmdir $TARGET_ROOT/lost+found - fi } (