ADT installer fixes
cover ADT installer fixes
The following changes since commit 4d8ab87d25ea6e59dc88375813ef88ee0ac813d0:
build-appliance: Update SRCREV (2013-09-24 18:09:12 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib lpalcu/b5231_b5259_adt_installer_fixes
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lpalcu/b5231_b5259_adt_installer_fixes
Laurentiu Palcu (2):
adt-installer: check if sudo is needed when installing target sysroot
adt-installer: add warning if MACHINE is not set in
adt-installer.conf
.../installer/adt-installer/adt_installer | 14 ++++- .../installer/adt-installer/adt_installer.conf | 10 ++-- .../adt-installer/scripts/adt_installer_internal | 55 ++++++++++++-------- 3 files changed, 51 insertions(+), 28 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/2 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]
--- .../adt-installer/scripts/adt_installer_internal | 51 ++++++++++++-------- 1 file changed, 31 insertions(+), 20 deletions(-)
meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal +31 -20
@@ -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"
Signature · 1 line
1.7.9.5
PATCH 2/2 adt-installer: add warning if MACHINE is not set in adt-installer.conf
In reply to Laurentiu PalcuSince the MACHINE can now be specified in adt-installer.conf, in order to install the proper toolchain and environment script for the given machine, add a sanity checking at the beginning to make sure MACHINE is set for the wanted architecture.
Also:
* uncomment the x86 target variables, in adt-installer.conf, in order to have qemux86 MACHINE set, by default, and also the sysroot installed (since it doesn't make much sense to install the toolchain without a target sysroot);
* remove 'sudo' when creating relocate_sdk_tmp.py because the file is created in adt-installer directory;
[YOCTO #5259]
--- .../installer/adt-installer/adt_installer | 14 +++++++++++++- .../installer/adt-installer/adt_installer.conf | 10 +++++----- .../adt-installer/scripts/adt_installer_internal | 4 ++-- 3 files changed, 20 insertions(+), 8 deletions(-)
meta/recipes-devtools/installer/adt-installer/adt_installer +13 -1
@@ -67,6 +67,10 @@ validate_config() for selected_arch_type in $YOCTOADT_TARGETS; do found=0 + select_machine_var="\$YOCTOADT_TARGET_MACHINE_$selected_arch_type" + select_machine=`eval echo $select_machine_var` + show_error_banner=0 + for supported_arch_type in $YOCTOADT_SUPPORTED_TARGETS; do if [ "$selected_arch_type" == "$supported_arch_type" ]; then found=1
@@ -75,10 +79,18 @@ validate_config() done if [ $found == 0 ]; then echo_info "[ADT_INST] Error: YOCTADT_TARGETS in adt_installer.conf contains invalid entries: $YOCTOADT_TARGETS. Valid values are: $YOCTOADT_SUPPORTED_TARGETS" + show_error_banner=1 + elif [ -z "$select_machine" ]; then + echo_info "[ADT_INST] Error: No MACHINE was defined for $selected_arch_type architecture! This is needed to install the toolchain and the correct environment settings." + echo_info "[ADT_INST] To do that, in adt-installer.conf, set the following variable: YOCTOADT_TARGET_MACHINE_$selected_arch_type" + show_error_banner=1 + fi + + if [ $show_error_banner == 1 ]; then echo -e "\n#############################################################################" echo -e "# Meet error(s) when installing Yocto ADT! Please check log file for details. " echo -e "#############################################################################\n" - exit -1 + exit -1 fi done
meta/recipes-devtools/installer/adt-installer/adt_installer.conf +5 -5
@@ -51,11 +51,11 @@ YOCTOADT_TARGET_MACHINE_arm="qemuarm" YOCTOADT_TARGET_SYSROOT_LOC_arm="$HOME/test-yocto/$YOCTOADT_TARGET_MACHINE_arm" -#Here's another example for setting up target arch of x86, by uncommenting it will trigger the installer to download and setup 2 sysroot environment for 2 target arches: arm and x86. If you want to add more target arch support, you can append more entries by following these samples -#YOCTOADT_ROOTFS_x86="sato-sdk" -#YOCTOADT_TARGET_SYSROOT_IMAGE_x86="sato-sdk" -#YOCTOADT_TARGET_MACHINE_x86="qemux86" -#YOCTOADT_TARGET_SYSROOT_LOC_x86="$HOME/test-yocto/$YOCTOADT_TARGET_MACHINE_x86" +#Here's a template for setting up target arch of x86 +YOCTOADT_ROOTFS_x86="sato-sdk" +YOCTOADT_TARGET_SYSROOT_IMAGE_x86="sato-sdk" +YOCTOADT_TARGET_MACHINE_x86="qemux86" +YOCTOADT_TARGET_SYSROOT_LOC_x86="$HOME/test-yocto/$YOCTOADT_TARGET_MACHINE_x86" #Here's some template of other arches, which you need to change the value in "" #YOCTOADT_ROOTFS_x86_64="sato-sdk"
meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal +2 -2
@@ -195,8 +195,8 @@ escaped_sdkpath=$(echo $DEFAULT_INSTALL_FOLDER |sed -e "s:[\+\.]:\\\\\\\\\0:g") # We don't change the script in-place since we may want the user to re-run # adt-installer script -$SUDO sh -c "sed -e '"s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:"' scripts/relocate_sdk.py > scripts/relocate_sdk_tmp.py" -$SUDO chmod +x scripts/relocate_sdk_tmp.py +sed -e "s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:" scripts/relocate_sdk.py > scripts/relocate_sdk_tmp.py +chmod +x scripts/relocate_sdk_tmp.py dl_path=$(find $OECORE_NATIVE_SYSROOT/lib -name "ld-linux*") executable_files=$(find $OECORE_NATIVE_SYSROOT -type f -perm /111)
Signature · 1 line
1.7.9.5