Skip to content

Commit

Permalink
sysroot: change symlink path from absolute to relative
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Sowon Na authored and Sooman Jeong committed Dec 5, 2017
1 parent 09ff9b0 commit a965838
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions build_ubuntu_sysroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit a965838

Please sign in to comment.