diff options
author | Hyung-Kyu Choi <hk0110.choi@samsung.com> | 2017-02-03 11:28:59 +0300 |
---|---|---|
committer | Hyung-Kyu Choi <hk0110.choi@samsung.com> | 2017-02-03 14:49:57 +0300 |
commit | 217f244c2097ea152e202ec3d791a105d12615a2 (patch) | |
tree | 8d0bbecaf889635202763f798ab0f6e3c50afb58 /cross | |
parent | 2b6aea47dfe63146cadacdf9e9d7b14825c366c1 (diff) |
Use same logic to prepare rootfs across dotnet if possible
1. Update logic more safely for unmount and cleaning directory
2. Refactor logic to achieve consistency across dotnet
3. Remove unused variable and fix typo
Signed-off-by: Hyung-Kyu Choi <hk0110.choi@samsung.com>
Diffstat (limited to 'cross')
-rwxr-xr-x | cross/build-rootfs.sh | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/cross/build-rootfs.sh b/cross/build-rootfs.sh index 81788985b1..16828c3c91 100755 --- a/cross/build-rootfs.sh +++ b/cross/build-rootfs.sh @@ -2,15 +2,21 @@ usage() { - echo "Usage: $0 [BuildArch] [LinuxCodeName] [--SkipUnmount]" - echo "BuildArch can be: arm, armel, arm64, x86" - echo "LinuxCodeName - optional, Code name for Ubuntu, can be: trusty(default), vivid, wily, xenial. If BuildArch is armel, jessie(default) or tizen." - echo "[--SkipUnmount] - do not unmount rootfs folders." + echo "Usage: $0 [BuildArch] [LinuxCodeName] [--skipunmount]" + echo "BuildArch can be: arm(default), armel, arm64, x86" + echo "LinuxCodeName - optional, Code name for Linux, can be: trusty(default), vivid, wily, xenial. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen." + echo "--skipunmount - optional, will skip the unmount of rootfs folder." exit 1 } +__LinuxCodeName=trusty __CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) __InitialDir=$PWD +__BuildArch=arm +__UbuntuArch=armhf +__UbuntuRepo="http://ports.ubuntu.com/" +__LLDB_Package="lldb-3.6-dev" +__SkipUnmount=0 # base development support __UbuntuPackages="build-essential" @@ -20,27 +26,16 @@ __UbuntuPackages+=" symlinks" # CoreCLR and CoreFX dependencies __UbuntuPackages+=" gettext" -__UbuntuPackages+=" libcurl4-openssl-dev" +__UbuntuPackages+=" libunwind8-dev" +__UbuntuPackages+=" liblttng-ust-dev" __UbuntuPackages+=" libicu-dev" + +# CoreFX dependencies +__UbuntuPackages+=" libcurl4-openssl-dev" __UbuntuPackages+=" libkrb5-dev" -__UbuntuPackages+=" liblttng-ust-dev" __UbuntuPackages+=" libssl-dev" -__UbuntuPackages+=" libunwind8-dev" __UbuntuPackages+=" zlib1g-dev" -if [ -z "$LLVM_ARM_HOME" ]; then - __LLDB_Package="lldb-3.6-dev" -fi - - - -__BuildArch=arm -__UbuntuArch=armhf -__LinuxCodeName=trusty -__UbuntuRepo="http://ports.ubuntu.com/" -__MachineTriple=arm-linux-gnueabihf -__SkipUnmount=0 - __UnprocessedBuildArgs= for i in "$@" ; do lowerI="$(echo $i | awk '{print tolower($0)}')" @@ -49,31 +44,25 @@ for i in "$@" ; do usage exit 1 ;; - --skipunmount) - __SkipUnmount=1 - ;; arm) __BuildArch=arm __UbuntuArch=armhf - __MachineTriple=arm-linux-gnueabihf ;; arm64) __BuildArch=arm64 __UbuntuArch=arm64 - __MachineTriple=aarch64-linux-gnu - ;; - x86) - __BuildArch=x86 - __UbuntuArch=i386 - __UbuntuRepo="http://archive.ubuntu.com/ubuntu" ;; armel) __BuildArch=armel __UbuntuArch=armel __UbuntuRepo="http://ftp.debian.org/debian/" - __MachineTriple=arm-linux-gnueabi __LinuxCodeName=jessie ;; + x86) + __BuildArch=x86 + __UbuntuArch=i386 + __UbuntuRepo="http://archive.ubuntu.com/ubuntu/" + ;; vivid) if [ "$__LinuxCodeName" != "jessie" ]; then __LinuxCodeName=vivid @@ -95,7 +84,7 @@ for i in "$@" ; do ;; tizen) if [ "$__BuildArch" != "armel" ]; then - echo "Tizen is available only for armel" + echo "Tizen is available only for armel." usage; exit 1; fi @@ -103,6 +92,9 @@ for i in "$@" ; do __UbuntuRepo= __Tizen=tizen ;; + --skipunmount) + __SkipUnmount=1 + ;; *) __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i" ;; @@ -124,11 +116,13 @@ if [[ -n "$ROOTFS_DIR" ]]; then __RootfsDir=$ROOTFS_DIR fi -if [ $__SkipUnmount == 0 ]; then - umount $__RootfsDir/* +if [ -d "$__RootfsDir" ]; then + if [ $__SkipUnmount == 0 ]; then + umount $__RootfsDir/* + fi + rm -rf $__RootfsDir fi -rm -rf $__RootfsDir if [[ -n $__LinuxCodeName ]]; then qemu-debootstrap --arch $__UbuntuArch $__LinuxCodeName $__RootfsDir $__UbuntuRepo @@ -141,7 +135,6 @@ if [[ -n $__LinuxCodeName ]]; then if [ $__SkipUnmount == 0 ]; then umount $__RootfsDir/* fi - elif [ "$__Tizen" == "tizen" ]; then ROOTFS_DIR=$__RootfsDir $__CrossDir/$__BuildArch/tizen-build-rootfs.sh else |