populate_sdk_base: mkdir was missing $SUDO_EXEC prefix

Submitted by Laurentiu Palcu on Dec. 4, 2012, 12:16 p.m.

Details

Message ID 1354623372-31497-1-git-send-email-laurentiu.palcu@intel.com
State Accepted
Commit 4bec4e78502b1d3fbe3c1f95b737c19f15e3c1c1
Headers show

Commit Message

Laurentiu Palcu Dec. 4, 2012, 12:16 p.m.
mkdir was in the wrong place and missing sudo rights. Hence, the
installation to default location (or any other for which the user didn't
have rights) would fail. Unless the installer itself is run with sudo.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/classes/populate_sdk_base.bbclass |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass
index 691ae45..f0b88b3 100644
--- a/meta/classes/populate_sdk_base.bbclass
+++ b/meta/classes/populate_sdk_base.bbclass
@@ -187,9 +187,6 @@  if [ "$answer" != "Y" -a "$answer" != "y" ]; then
 	exit 1
 fi
 
-# create dir and don't care about the result. 
-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")
@@ -203,6 +200,9 @@  if [ ! -x $target_sdk_dir -o ! -w $target_sdk_dir -o ! -r $target_sdk_dir ]; the
 	[ $? -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
+
 payload_offset=$(($(grep -na -m1 "^MARKER:$" $0|cut -d':' -f1) + 1))
 
 printf "Extracting SDK..."