summaryrefslogtreecommitdiffstats
path: root/meta/classes/populate_sdk_base.bbclass
diff options
context:
space:
mode:
authorLaurentiu Palcu <laurentiu.palcu@intel.com>2012-12-05 13:00:00 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-12-05 15:26:40 +0000
commit40b4bb068faf38bc3e00be797a7a669bacd10008 (patch)
tree169db09987579ba02c19a3d31dace4e16772416b /meta/classes/populate_sdk_base.bbclass
parent600fde2acd1b889a4edbb2ac4661cbf562072db6 (diff)
downloadast2050-yocto-poky-40b4bb068faf38bc3e00be797a7a669bacd10008.zip
ast2050-yocto-poky-40b4bb068faf38bc3e00be797a7a669bacd10008.tar.gz
populate_sdk_base: fix directory creation as normal user
My previous patch removed the mkdir and added it at the end of the "gaining SUDO rights" block in order to fix directory creation when installing in a location without proper rights. Unfortunately this messed up the directory creation as normal user as it will ask for sudo right in order to create it... Hopefully, this will fix both cases. (From OE-Core rev: 86286287d0134ade73f6a282158dde86bf0159e8) Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/populate_sdk_base.bbclass')
-rw-r--r--meta/classes/populate_sdk_base.bbclass9
1 files changed, 6 insertions, 3 deletions
diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass
index f0b88b3..c15a4d4 100644
--- a/meta/classes/populate_sdk_base.bbclass
+++ b/meta/classes/populate_sdk_base.bbclass
@@ -187,6 +187,9 @@ if [ "$answer" != "Y" -a "$answer" != "y" ]; then
exit 1
fi
+# Try to create the directory (this will not succeed if user doesn't have rights)
+mkdir -p $target_sdk_dir >/dev/null 2>&1
+
# if don't have the right to access dir, gain by sudo
if [ ! -x $target_sdk_dir -o ! -w $target_sdk_dir -o ! -r $target_sdk_dir ]; then
SUDO_EXEC=$(which "sudo")
@@ -198,10 +201,10 @@ if [ ! -x $target_sdk_dir -o ! -w $target_sdk_dir -o ! -r $target_sdk_dir ]; the
# test sudo could gain root right
$SUDO_EXEC pwd >/dev/null 2>&1
[ $? -ne 0 ] && echo "Sorry, you are not allowed to execute as root." && exit 1
-fi
-# create dir and don't care about the result.
-$SUDO_EXEC mkdir -p $target_sdk_dir >/dev/null 2>&1
+ # now that we have sudo rights, create the directory
+ $SUDO_EXEC mkdir -p $target_sdk_dir >/dev/null 2>&1
+fi
payload_offset=$(($(grep -na -m1 "^MARKER:$" $0|cut -d':' -f1) + 1))
OpenPOWER on IntegriCloud