From 86f71f2e213e898c898ae1c173de0b0c78a9f99f Mon Sep 17 00:00:00 2001 From: Hyung-Kyu Choi Date: Fri, 16 Dec 2016 18:13:56 +0900 Subject: [PATCH] Select correct RID for package files when cross-building Use RID of rootfs as RID for package files instead of host RID, when cross building corehost. Signed-off-by: Hyung-Kyu Choi --- src/corehost/build.sh | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/corehost/build.sh b/src/corehost/build.sh index aadab0b820..c814448b33 100755 --- a/src/corehost/build.sh +++ b/src/corehost/build.sh @@ -7,18 +7,35 @@ init_rid_plat() { # Detect Distro - if [ -e /etc/os-release ]; then - source /etc/os-release - - if [[ "$ID" == "rhel" && $VERSION_ID = 7* ]]; then - export __rid_plat="rhel.7" - elif [[ "$ID" == "centos" && "$VERSION_ID" = "7" ]]; then - export __rid_plat="rhel.7" + if [ $__CrossBuild == 1 ]; then + if [ -z $ROOTFS_DIR ]; then + echo "ROOTFS_DIR is not defined." + exit -1 else - export __rid_plat="$ID.$VERSION_ID" + if [ -e $ROOTFS_DIR/etc/os-release ]; then + source $ROOTFS_DIR/etc/os-release + if [ "$__runtime_id" == "$ID.$VERSION_ID-$__build_arch" ]; then + export __rid_plat="$ID.$VERSION_ID" + else + echo "ROOTFS_DIR and Target RID are different. Please use correct rootfs for cross compilation." + exit -1 + fi + fi fi else - export __rid_plat= + if [ -e /etc/os-release ]; then + source /etc/os-release + + if [[ "$ID" == "rhel" && $VERSION_ID = 7* ]]; then + export __rid_plat="rhel.7" + elif [[ "$ID" == "centos" && "$VERSION_ID" = "7" ]]; then + export __rid_plat="rhel.7" + else + export __rid_plat="$ID.$VERSION_ID" + fi + else + export __rid_plat= + fi fi }