summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 abed90d241..ebfdf2a69b 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()
42 esac 42 esac
43} 43}
44 44
45get_sudo_app()
46{
47 username=$(id -nu)
48
49 # find the owner of the parent
50 dir=$1
51 while [ 1 ]; do
52 if [ -d $dir ]; then
53 owner=$(stat -c %U $dir)
54 break
55 else
56 dir=$(dirname $dir)
57 fi
58 done
59
60 if [ "$owner" = "$username" ]; then
61 true
62 else
63 echo sudo
64 fi
65}
66
45 67
46#let us install a qemu-native firstly 68#let us install a qemu-native firstly
47#installation step 2 69#installation step 2
@@ -60,26 +82,11 @@ fi
60 82
61#Now begin to install native sdk and extract qemu rootfs which needs privilege rights 83#Now begin to install native sdk and extract qemu rootfs which needs privilege rights
62#depending on the install location 84#depending on the install location
63username=$(id -nu) 85SUDO=$(get_sudo_app $NATIVE_INSTALL_DIR)
64 86if [ -n "$SUDO" ]; then
65# find the owner of the parent 87 echo_info "#######################################################################"
66dir=$NATIVE_INSTALL_DIR 88 echo_info "Please note from this point on installation requires sudo password ..."
67while [ 1 ]; do 89 echo_info "#######################################################################"
68 if [ -d $dir ]; then
69 owner=$(stat -c %U $dir)
70 break
71 else
72 dir=$(dirname $dir)
73 fi
74done
75
76if [ "$owner" = "$username" ]; then
77 SUDO=""
78else
79 echo_info "#######################################################################"
80 echo_info "Please note from this point on installation requires sudo password ..."
81 echo_info "#######################################################################"
82 SUDO=sudo
83fi 90fi
84 91
85#we need to make this directory firstly since opkg need to use it. 92#we need to make this directory firstly since opkg need to use it.
@@ -249,6 +256,9 @@ target_machine=`eval echo $target_machine_var`
249sysroot_image_name="core-image-$target_sysroot_image-$target_machine.tar.bz2" 256sysroot_image_name="core-image-$target_sysroot_image-$target_machine.tar.bz2"
250 #echo_info "Extracting rootfs: $sysroot_image_name, using pseudo..." 257 #echo_info "Extracting rootfs: $sysroot_image_name, using pseudo..."
251 258
259# sudo password might be needed to install the target sysroot
260SUDO=$(get_sudo_app $target_sysroot)
261
252$SUDO scripts/extract_rootfs $sysroot_image_name $target_sysroot $OECORE_NATIVE_SYSROOT $user_inst_type 262$SUDO scripts/extract_rootfs $sysroot_image_name $target_sysroot $OECORE_NATIVE_SYSROOT $user_inst_type
253check_result 263check_result
254 264
@@ -260,6 +270,7 @@ else
260fi 270fi
261 271
262if [ ! -z "$env_filename" ]; then 272if [ ! -z "$env_filename" ]; then
273 SUDO=$(get_sudo_app $INSTALL_FOLDER)
263 $SUDO sed -i -e "s%##SDKTARGETSYSROOT##%$target_sysroot%g" $env_filename 274 $SUDO sed -i -e "s%##SDKTARGETSYSROOT##%$target_sysroot%g" $env_filename
264else 275else
265 echo_info "[ADT_INST] Error: Failed to find environment script for arch: $1" 276 echo_info "[ADT_INST] Error: Failed to find environment script for arch: $1"