From a9658383371a4c4a5bab98c4df6807dd0d03762f Mon Sep 17 00:00:00 2001 From: Sowon Na Date: Fri, 1 Dec 2017 14:38:32 +0900 Subject: [PATCH] sysroot: change symlink path from absolute to relative This patch changes symbolic link in sysroot with absolute path into relative path. The absolute path in sysroot is wrong because it indicates host files. This patch fixes it. Change-Id: If942e3fa538838df32ae03887f13df91a67cacc7 Signed-off-by: Sowon Na --- build_ubuntu_sysroot.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/build_ubuntu_sysroot.sh b/build_ubuntu_sysroot.sh index d850ca2..f07e478 100755 --- a/build_ubuntu_sysroot.sh +++ b/build_ubuntu_sysroot.sh @@ -186,6 +186,28 @@ MODEL=${upper_model} __EOF__ } +change_symlink_path() +{ + pushd $TARGET_DIR + symlink_sysroot=$(sudo find rootfs/ -type l -lname '/*') + + for file in $symlink_sysroot + do + link=$(ls -l $file | awk '{print $11}') + tmp=(`echo $file | tr "/" "\n"`) + i=$((${#tmp[@]}-2)) + if [ $i -eq 0 ]; then + link='.'$link + elif [ $i -gt 0 ]; then + link='..'$link + fi + link=$(seq -s "`echo -e ''`" $(($i-1)) | sed 's/./\.\.\//g')$link + sudo rm -rf $file + sudo ln -s $link $file + done + popd +} + trap abnormal_exit INT ERR trap 'error ${LINENO} ${?}' ERR @@ -284,6 +306,8 @@ sudo tar zxf $TARGET_DIR/${UBUNTU_NAME}.tar.gz -C $TARGET_DIR/rootfs sudo mv $TARGET_DIR/artik_sysroot_release $TARGET_DIR/rootfs/ sync +change_symlink_path + sudo tar zcf $TARGET_DIR/${UBUNTU_NAME}.tar.gz -C $TARGET_DIR/rootfs . sudo tar --exclude=usr/lib/python2.7 --exclude=usr/lib/python3.5 -zcf $TARGET_DIR/${UBUNTU_NAME}-IDE.tar.gz -C $TARGET_DIR/rootfs usr/include usr/lib lib