summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/installer
diff options
context:
space:
mode:
authorLaurentiu Palcu <laurentiu.palcu@intel.com>2012-08-17 13:38:11 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-17 13:06:42 +0100
commit3ba29d41e6e00cc6bedfcb2d5157db54b6bcfda0 (patch)
treee2102ddc9147c5a13b6c14c3b7007251297e0f15 /meta/recipes-devtools/installer
parent21049ec9644510a81aba748ad81fb6a73a711f21 (diff)
downloadpoky-3ba29d41e6e00cc6bedfcb2d5157db54b6bcfda0.tar.gz
adt-installer: add support for relocatable SDK
Since we made the SDK relocatable, we have to add this functionality to adt-installer too. (From OE-Core rev: 0fa784c261050c632b7237ba3d43a148ab71b0ca) Signed-off-by: Laurentiu Palcu <laurentiu.palcu@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/adt_installer11
-rwxr-xr-xmeta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal111
-rw-r--r--meta/recipes-devtools/installer/adt-installer_1.0.bb7
3 files changed, 108 insertions, 21 deletions
diff --git a/meta/recipes-devtools/installer/adt-installer/adt_installer b/meta/recipes-devtools/installer/adt-installer/adt_installer
index 1a53eb9c54..2d252b72ad 100755
--- a/meta/recipes-devtools/installer/adt-installer/adt_installer
+++ b/meta/recipes-devtools/installer/adt-installer/adt_installer
@@ -332,6 +332,17 @@ if [ -f "$YOCTOADT_INSTALL_LOG_FILE" ]; then
332 rm $YOCTOADT_INSTALL_LOG_FILE 332 rm $YOCTOADT_INSTALL_LOG_FILE
333fi 333fi
334 334
335echo -n "Please enter the install location (default: $DEFAULT_INSTALL_FOLDER): "
336read INSTALL_FOLDER
337
338if [ "$INSTALL_FOLDER" = "" ]; then
339 INSTALL_FOLDER=$DEFAULT_INSTALL_FOLDER
340fi
341
342eval INSTALL_FOLDER=$INSTALL_FOLDER
343export INSTALL_FOLDER=$(readlink -m $INSTALL_FOLDER)
344
345clear
335 346
336usage 347usage
337 348
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 6201095117..a540c0d8ff 100755
--- a/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
+++ b/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
@@ -50,8 +50,8 @@ install_native_sdk()
50 50
51echo_info "\nStart installing selected native ADT for archs: $YOCTOADT_TARGETS..." 51echo_info "\nStart installing selected native ADT for archs: $YOCTOADT_TARGETS..."
52 52
53# where the packages are installed. Currently only / is supported 53# where the packages are installed.
54NATIVE_INSTALL_DIR="/" 54NATIVE_INSTALL_DIR=$INSTALL_FOLDER
55 55
56if [ -d "$INSTALL_FOLDER" ]; then 56if [ -d "$INSTALL_FOLDER" ]; then
57 echo_info "\nNative ADT installation directory \"$INSTALL_FOLDER\" already exists! Continue installation will override its contents!" 57 echo_info "\nNative ADT installation directory \"$INSTALL_FOLDER\" already exists! Continue installation will override its contents!"
@@ -59,28 +59,51 @@ if [ -d "$INSTALL_FOLDER" ]; then
59fi 59fi
60 60
61#Now begin to install native sdk and extract qemu rootfs which needs privilege rights 61#Now begin to install native sdk and extract qemu rootfs which needs privilege rights
62echo_info "#######################################################################" 62#depending on the install location
63echo_info "Please note from this point on installation requires sudo password ..." 63username=$(id -nu)
64echo_info "#######################################################################" 64
65username='id -nu' 65# find the owner of the parent
66dir=$NATIVE_INSTALL_DIR
67while [ 1 ]; do
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
84
66#we need to make this directory firstly since opkg need to use it. 85#we need to make this directory firstly since opkg need to use it.
67OPKG_LOCK_DIR="$NATIVE_INSTALL_DIR/$OPKG_LIBDIR/opkg" 86OPKG_LOCK_DIR="$NATIVE_INSTALL_DIR/$OPKG_LIBDIR/opkg"
68if [ ! -d "$OPKG_LOCK_DIR" ]; then 87if [ ! -d "$OPKG_LOCK_DIR" ]; then
69 sudo mkdir -p $OPKG_LOCK_DIR 88 $SUDO mkdir -p $OPKG_LOCK_DIR
70 echo_info "Successfully create directory $OPKG_LOCK_DIR. " 89 echo_info "Successfully create directory $OPKG_LOCK_DIR. "
71#if user delete /opt/xxx, while dangling folders there, report error 90#if user delete /opt/xxx, while dangling folders there, report error
72elif [ ! -d "$INSTALL_FOLDER" ]; then 91elif [ ! -d "$INSTALL_FOLDER" ]; then
73 echo_info "\nDangling opkg cache folder $OPKG_LOCK_DIR detected. Continue installation will remove the folder!" 92 echo_info "\nDangling opkg cache folder $OPKG_LOCK_DIR detected. Continue installation will remove the folder!"
74 confirm_install $1 93 confirm_install $1
75 sudo rm -rf $OPKG_LOCK_DIR 94 $SUDO rm -rf $OPKG_LOCK_DIR
76 sudo mkdir -p $OPKG_LOCK_DIR 95 $SUDO mkdir -p $OPKG_LOCK_DIR
77#if user are updating installing, just let him/her go, give her/him prompt 96#if user are updating installing, just let him/her go, give her/him prompt
78else 97else
79 echo_info "ADT has already been installed. Will update its contents..." 98 echo_info "ADT has already been installed. Will update its contents..."
80fi 99fi
81 100
82#first update repository 101#first update repository
83OPKG_CMD="sudo -E $LOCAL_OPKG_LOC/bin/opkg-cl" 102if [ "x$SUDO" = "x" ]; then
103 OPKG_CMD="$LOCAL_OPKG_LOC/bin/opkg-cl"
104else
105 OPKG_CMD="sudo -E $LOCAL_OPKG_LOC/bin/opkg-cl"
106fi
84 107
85echo_info "Updating opkg..." 108echo_info "Updating opkg..."
86$OPKG_CMD -f $OPKG_CONFIG_FILE -o $NATIVE_INSTALL_DIR update &>> $YOCTOADT_INSTALL_LOG_FILE 109$OPKG_CMD -f $OPKG_CONFIG_FILE -o $NATIVE_INSTALL_DIR update &>> $YOCTOADT_INSTALL_LOG_FILE
@@ -117,13 +140,6 @@ for native_target_type in $YOCTOADT_TARGETS; do
117 140
118done 141done
119 142
120# Link the ld.so.cache file into the hosts filesystem
121if [ ! -f "$OECORE_NATIVE_SYSROOT/etc/ld.so.cache" ]; then
122echo_info "Link the ld.so.cache file into the host filesystem"
123sudo ln -s /etc/ld.so.cache $OECORE_NATIVE_SYSROOT/etc/ld.so.cache
124check_result
125fi
126
127if [ "$YOCTOADT_QEMU" == "Y" ] || [ "$YOCTOADT_QEMU" = "y" ]; then 143if [ "$YOCTOADT_QEMU" == "Y" ] || [ "$YOCTOADT_QEMU" = "y" ]; then
128 echo_info "\nInstalling qemu native ..." 144 echo_info "\nInstalling qemu native ..."
129 $OPKG_INSTALL_NATIVE_CMD qemu-nativesdk &>> $YOCTOADT_INSTALL_LOG_FILE 145 $OPKG_INSTALL_NATIVE_CMD qemu-nativesdk &>> $YOCTOADT_INSTALL_LOG_FILE
@@ -138,6 +154,65 @@ if [ "$YOCTOADT_NFS_UTIL" == "Y" ] || [ "$YOCTOADT_NFS_UTIL" == "y" ]; then
138 check_result 154 check_result
139fi 155fi
140 156
157# Lose the ./opt/${DISTRO}/${SDK_VERSION} part, we don't really need to keep
158# the entire directory structure. We could patch opkg to do that but it's far
159# simpler to do that here and achieve the same result.
160# This is done in two steps:
161# Step 1: copy ./opt/${DISTRO}/${SDK_VERSION} contents to $NATIVE_INSTALL_DIR.
162# We cannot use move if $NATIVE_INSTALL_DIR is not empty (for example: contains
163# another SDK)
164$SUDO cp -r $NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER/* $NATIVE_INSTALL_DIR
165
166# delete the source directory now
167$SUDO rm -rf $NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER/*
168
169# Step 2: Delete the ./opt/${DISTRO}/${SDK_VERSION} directories too, they should be empty
170dir=$NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER
171while [ "$dir" != "$NATIVE_INSTALL_DIR" ]; do
172 # if the user chose / as the install folder, then we should leave /opt in place
173 if [ "$dir" = "/opt" ]; then
174 break
175 fi
176
177 # try to delete the directory, only if it's empty
178 $SUDO rmdir $dir
179 if [ $? -ne 0 ]; then
180 break
181 fi
182
183 # go to the next directory
184 dir=$(dirname $dir)
185done
186
187# Link the ld.so.cache file into the hosts filesystem
188if [ ! -f "$OECORE_NATIVE_SYSROOT/etc/ld.so.cache" ]; then
189echo_info "Link the ld.so.cache file into the host filesystem"
190$SUDO ln -s /etc/ld.so.cache $OECORE_NATIVE_SYSROOT/etc/ld.so.cache
191check_result
192fi
193
194# relocate binaries
195echo_info "\nRelocating binaries ..."
196escaped_sdkpath=$(echo $DEFAULT_INSTALL_FOLDER |sed -e "s:[\+\.]:\\\\\\\\\0:g")
197
198# We don't change the script in-place since we may want the user to re-run
199# adt-installer script
200$SUDO sed -e "s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:" scripts/relocate_sdk.py > scripts/relocate_sdk_tmp.py
201$SUDO chmod +x scripts/relocate_sdk_tmp.py
202
203dl_path=$(find $OECORE_NATIVE_SYSROOT/lib -name "ld-linux*")
204executable_files=$(find $OECORE_NATIVE_SYSROOT -type f -perm +111)
205
206$SUDO scripts/relocate_sdk_tmp.py $INSTALL_FOLDER $dl_path $executable_files
207check_result
208
209# replace /opt/${DISTRO}/${SDK_VERSION} with the install folder in all configs
210env_setup_script=$(find $NATIVE_INSTALL_DIR -name "environment-setup-*")
211$SUDO sed -i -e "s:$DEFAULT_INSTALL_FOLDER:$NATIVE_INSTALL_DIR:g" $env_setup_script
212
213find $OECORE_NATIVE_SYSROOT -type f -exec file '{}' \;|grep ":.*ASCII.*text"|cut -d':' -f1|\
214 xargs $SUDO sed -i -e "s:$DEFAULT_INSTALL_FOLDER:$NATIVE_INSTALL_DIR:g"
215
141echo_info "\nSuccessfully installed selected native ADT!" 216echo_info "\nSuccessfully installed selected native ADT!"
142} 217}
143 218
@@ -180,7 +255,7 @@ else
180fi 255fi
181 256
182if [ ! -z "$env_filename" ]; then 257if [ ! -z "$env_filename" ]; then
183 sudo sed -i -e "s%##SDKTARGETSYSROOT##%$target_sysroot%g" $env_filename 258 $SUDO sed -i -e "s%##SDKTARGETSYSROOT##%$target_sysroot%g" $env_filename
184else 259else
185 echo_info "[ADT_INST] Error: Failed to find environment script for arch: $1" 260 echo_info "[ADT_INST] Error: Failed to find environment script for arch: $1"
186 return 1 261 return 1
diff --git a/meta/recipes-devtools/installer/adt-installer_1.0.bb b/meta/recipes-devtools/installer/adt-installer_1.0.bb
index e1edf2f97f..becdef6274 100644
--- a/meta/recipes-devtools/installer/adt-installer_1.0.bb
+++ b/meta/recipes-devtools/installer/adt-installer_1.0.bb
@@ -30,7 +30,7 @@ ALLOW_EMPTY = "1"
30 30
31PACKAGES = "" 31PACKAGES = ""
32 32
33PR = "r9" 33PR = "r10"
34 34
35ADT_DEPLOY = "${TMPDIR}/deploy/sdk/" 35ADT_DEPLOY = "${TMPDIR}/deploy/sdk/"
36ADT_DIR = "${WORKDIR}/adt-installer/" 36ADT_DIR = "${WORKDIR}/adt-installer/"
@@ -69,8 +69,9 @@ fakeroot do_populate_adt () {
69 cp adt_installer ${ADT_DIR} 69 cp adt_installer ${ADT_DIR}
70 cp adt_installer.conf ${ADT_DIR} 70 cp adt_installer.conf ${ADT_DIR}
71 sed -i -e 's#YOCTOADT_VERSION#${SDK_VERSION}#' ${ADT_DIR}/adt_installer.conf 71 sed -i -e 's#YOCTOADT_VERSION#${SDK_VERSION}#' ${ADT_DIR}/adt_installer.conf
72 echo 'SDK_VENDOR=${SDK_VENDOR}' >> ${ADT_DIR}/scripts/data_define 72 echo 'SDK_VENDOR=${SDK_VENDOR}' >> ${ADT_DIR}/scripts/data_define
73 echo 'INSTALL_FOLDER=${SDKPATH}' >> ${ADT_DIR}/scripts/data_define 73 echo 'DEFAULT_INSTALL_FOLDER=${SDKPATH}' >> ${ADT_DIR}/scripts/data_define
74 cp ${COREBASE}/scripts/relocate_sdk.py ${ADT_DIR}/scripts/
74 tar cfj adt_installer.tar.bz2 adt-installer 75 tar cfj adt_installer.tar.bz2 adt-installer
75 cp ${WORKDIR}/adt_installer.tar.bz2 ${ADT_DEPLOY} 76 cp ${WORKDIR}/adt_installer.tar.bz2 ${ADT_DEPLOY}
76} 77}