summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/installer
diff options
context:
space:
mode:
authorLaurentiu Palcu <laurentiu.palcu@intel.com>2013-09-25 15:40:28 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-09-26 16:37:56 +0100
commit1ffa203dd5cfc8c1b717ff3c7222eb3f0c21f5d5 (patch)
tree2ca0cb5aaaff5b8806a1d90817a5290e667e62f5 /meta/recipes-devtools/installer
parent2f8ce2c784ddf3f74e8ae68e594f750a47ccc3a9 (diff)
downloadast2050-yocto-poky-1ffa203dd5cfc8c1b717ff3c7222eb3f0c21f5d5.zip
ast2050-yocto-poky-1ffa203dd5cfc8c1b717ff3c7222eb3f0c21f5d5.tar.gz
adt-installer: check if sudo is needed when installing target sysroot
Currently, if SDK is installed in a directory that needs sudo preivileges, the target sysroot is also installed with sudo, even though the location is in users's home directory. This patch reuses the ownership checking code and uses it to check if sudo is needed for target sysroot too. [YOCTO #5259] (From OE-Core rev: 5acfced041477d8c272485196e87ad601a0ce5b4) 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_internal51
1 files changed, 31 insertions, 20 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 abed90d..ebfdf2a 100755
--- a/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
+++ b/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
@@ -42,6 +42,28 @@ parse_config()
esac
}
+get_sudo_app()
+{
+ username=$(id -nu)
+
+ # find the owner of the parent
+ dir=$1
+ while [ 1 ]; do
+ if [ -d $dir ]; then
+ owner=$(stat -c %U $dir)
+ break
+ else
+ dir=$(dirname $dir)
+ fi
+ done
+
+ if [ "$owner" = "$username" ]; then
+ true
+ else
+ echo sudo
+ fi
+}
+
#let us install a qemu-native firstly
#installation step 2
@@ -60,26 +82,11 @@ fi
#Now begin to install native sdk and extract qemu rootfs which needs privilege rights
#depending on the install location
-username=$(id -nu)
-
-# find the owner of the parent
-dir=$NATIVE_INSTALL_DIR
-while [ 1 ]; do
- if [ -d $dir ]; then
- owner=$(stat -c %U $dir)
- break
- else
- dir=$(dirname $dir)
- fi
-done
-
-if [ "$owner" = "$username" ]; then
- SUDO=""
-else
- echo_info "#######################################################################"
- echo_info "Please note from this point on installation requires sudo password ..."
- echo_info "#######################################################################"
- SUDO=sudo
+SUDO=$(get_sudo_app $NATIVE_INSTALL_DIR)
+if [ -n "$SUDO" ]; then
+ echo_info "#######################################################################"
+ echo_info "Please note from this point on installation requires sudo password ..."
+ echo_info "#######################################################################"
fi
#we need to make this directory firstly since opkg need to use it.
@@ -249,6 +256,9 @@ target_machine=`eval echo $target_machine_var`
sysroot_image_name="core-image-$target_sysroot_image-$target_machine.tar.bz2"
#echo_info "Extracting rootfs: $sysroot_image_name, using pseudo..."
+# sudo password might be needed to install the target sysroot
+SUDO=$(get_sudo_app $target_sysroot)
+
$SUDO scripts/extract_rootfs $sysroot_image_name $target_sysroot $OECORE_NATIVE_SYSROOT $user_inst_type
check_result
@@ -260,6 +270,7 @@ else
fi
if [ ! -z "$env_filename" ]; then
+ SUDO=$(get_sudo_app $INSTALL_FOLDER)
$SUDO sed -i -e "s%##SDKTARGETSYSROOT##%$target_sysroot%g" $env_filename
else
echo_info "[ADT_INST] Error: Failed to find environment script for arch: $1"
OpenPOWER on IntegriCloud