cleaning up 01-copy-manifests-dir

This change adds extra tests to the
elements/manifests/cleanup.d/01-copy-manifests-dir script to prevent it
from exiting with an error due to non-existant files.

The premature exit condition only seems to happen when an image is being
created without including the "base" element.

Changes
* adding file detection tests for dib_arguments and dib_environment
files

Closes-Bug: #1308224
Change-Id: Iaa8bafb6765241408b9f02d4896913d15f2f401d
This commit is contained in:
Michael McCune 2014-04-21 13:27:17 -04:00
parent b588e4af05
commit bcf529ce80

View File

@ -19,8 +19,12 @@ set -eux
if [ -d $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR} ]; then if [ -d $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR} ]; then
# Move the dib_environment and dib_arguments files into the manifests dir # Move the dib_environment and dib_arguments files into the manifests dir
if [ -e $TMP_MOUNT_PATH/etc/dib_arguments ]; then
sudo mv $TMP_MOUNT_PATH/etc/dib_arguments $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR} sudo mv $TMP_MOUNT_PATH/etc/dib_arguments $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR}
fi
if [ -e $TMP_MOUNT_PATH/etc/dib_environment ]; then
sudo mv $TMP_MOUNT_PATH/etc/dib_environment $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR} sudo mv $TMP_MOUNT_PATH/etc/dib_environment $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR}
fi
mkdir -p ${DIB_MANIFEST_SAVE_DIR} mkdir -p ${DIB_MANIFEST_SAVE_DIR}
cp --no-preserve=ownership -rv $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR} \ cp --no-preserve=ownership -rv $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR} \
${DIB_MANIFEST_SAVE_DIR} ${DIB_MANIFEST_SAVE_DIR}