summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/installer
diff options
context:
space:
mode:
authorLaurentiu Palcu <laurentiu.palcu@intel.com>2012-09-18 10:34:35 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-09-21 11:10:23 +0100
commitbf94f4d6f9a846482b40434090bf60118a9623e2 (patch)
tree6698a1d1729c790671ab9c84f41c236ced87c7c2 /meta/recipes-devtools/installer
parentbd73a4b615f51d6a2330fcd21a33dcdd863497d2 (diff)
downloadast2050-yocto-poky-bf94f4d6f9a846482b40434090bf60118a9623e2.zip
ast2050-yocto-poky-bf94f4d6f9a846482b40434090bf60118a9623e2.tar.gz
adt-installer: ensure directory exists before copying/removing
If the installation is done in a directory which already contains a valid installation, opkg will not install anything and the moving the contents of /install/dir/opt/poky/1.2 (for example) to /install/dir will throw some errors. However, the install directory will not be affected. This patch will ensure that the /install/dir/opt/poky/1.2 exists. (From OE-Core rev: 1cd01533cbec0e9ed61bbd33ecdf5dc306a32eec) Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/installer')
-rwxr-xr-xmeta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal52
1 files changed, 27 insertions, 25 deletions
diff --git a/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal b/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
index 76acaa7..fbcd2ce 100755
--- a/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
+++ b/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
@@ -158,31 +158,33 @@ fi
# the entire directory structure. We could patch opkg to do that but it's far
# simpler to do that here and achieve the same result.
# This is done in two steps:
-# Step 1: copy ./opt/${DISTRO}/${SDK_VERSION} contents to $NATIVE_INSTALL_DIR.
-# We cannot use move if $NATIVE_INSTALL_DIR is not empty (for example: contains
-# another SDK)
-$SUDO cp -r $NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER/* $NATIVE_INSTALL_DIR
-
-# delete the source directory now
-$SUDO rm -rf $NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER/*
-
-# Step 2: Delete the ./opt/${DISTRO}/${SDK_VERSION} directories too, they should be empty
-dir=$NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER
-while [ "$dir" != "$NATIVE_INSTALL_DIR" ]; do
- # if the user chose / as the install folder, then we should leave /opt in place
- if [ "$dir" = "/opt" ]; then
- break
- fi
-
- # try to delete the directory, only if it's empty
- $SUDO rmdir $dir
- if [ $? -ne 0 ]; then
- break
- fi
-
- # go to the next directory
- dir=$(dirname $dir)
-done
+if [ -d $NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER ]; then
+ # Step 1: copy ./opt/${DISTRO}/${SDK_VERSION} contents to $NATIVE_INSTALL_DIR.
+ # We cannot use move if $NATIVE_INSTALL_DIR is not empty (for example: contains
+ # another SDK)
+ $SUDO cp -r $NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER/* $NATIVE_INSTALL_DIR
+
+ # delete the source directory now
+ $SUDO rm -rf $NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER/*
+
+ # Step 2: Delete the ./opt/${DISTRO}/${SDK_VERSION} directories too, they should be empty
+ dir=$NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER
+ while [ "$dir" != "$NATIVE_INSTALL_DIR" ]; do
+ # if the user chose / as the install folder, then we should leave /opt in place
+ if [ "$dir" = "/opt" ]; then
+ break
+ fi
+
+ # try to delete the directory, only if it's empty
+ $SUDO rmdir $dir
+ if [ $? -ne 0 ]; then
+ break
+ fi
+
+ # go to the next directory
+ dir=$(dirname $dir)
+ done
+fi
# Link the ld.so.cache file into the hosts filesystem
if [ ! -f "$OECORE_NATIVE_SYSROOT/etc/ld.so.cache" ]; then
OpenPOWER on IntegriCloud