]> xenbits.xensource.com Git - raisin.git/commitdiff
Move get_distro and get_arch to common-functions.sh
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Wed, 18 Mar 2015 15:44:24 +0000 (15:44 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Wed, 18 Mar 2015 15:44:24 +0000 (15:44 +0000)
Install git from build.sh

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
build.sh
common-functions.sh
grub.sh
libvirt.sh
xen.sh

index 97c33db90151aec7b32acd0ec37bf5755e30add4..48a8bac0ad79bdaca22bad630df37ab642915de3 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -1,6 +1,7 @@
 #!/usr/bin/env bash
 
 source config
+source common-functions.sh
 
 export PWD=`pwd`
 export GIT=${GIT-git}
@@ -16,90 +17,6 @@ source xen.sh
 source grub.sh
 source libvirt.sh
 
-function get_distro() {
-    if test -x "`which lsb_release 2>/dev/null`"
-    then
-        os_VENDOR=`lsb_release -i -s`
-        os_RELEASE=`lsb_release -r -s`
-        os_CODENAME=`lsb_release -c -s`
-        os_UPDATE=""
-    elif test -r /etc/redhat-release
-    then
-        # Red Hat Enterprise Linux Server release 5.5 (Tikanga)
-        # Red Hat Enterprise Linux Server release 7.0 Beta (Maipo)
-        # CentOS release 5.5 (Final)
-        # CentOS Linux release 6.0 (Final)
-        # Fedora release 16 (Verne)
-        # XenServer release 6.2.0-70446c (xenenterprise)
-        os_CODENAME=""
-        for r in "Red Hat" "CentOS" "Fedora" "XenServer"; do
-            os_VENDOR="$r"
-            if test -n "`grep -i \"$r\" /etc/redhat-release`"
-            then
-                ver=`sed -e 's/^.* \([0-9].*\) (\(.*\)).*$/\1\|\2/' /etc/redhat-release`
-                os_CODENAME=${ver#*|}
-                os_RELEASE=${ver%|*}
-                os_UPDATE=${os_RELEASE##*.}
-                os_RELEASE=${os_RELEASE%.*}
-                break
-            fi
-        done
-    elif test -r /etc/SuSE-release
-    then
-        for r in "openSUSE" "SUSE Linux"
-        do
-            os_VENDOR="$r"
-
-            if test -n "`grep -i \"$r\" /etc/SuSE-release`"
-            then
-                os_CODENAME=`grep "CODENAME = " /etc/SuSE-release | \
-                             sed 's:.* = ::g'`
-                os_RELEASE=`grep "VERSION = " /etc/SuSE-release | \
-                            sed 's:.* = ::g'`
-                os_UPDATE=`grep "PATCHLEVEL = " /etc/SuSE-release | \
-                           sed 's:.* = ::g'`
-                break
-            fi
-        done
-    # If lsb_release is not installed, we should be able to detect Debian OS
-    elif test -f /etc/debian_version && [[ `cat /proc/version` =~ "Debian" ]]
-    then
-        os_VENDOR="Debian"
-        os_CODENAME=`awk '/VERSION=/' /etc/os-release | sed 's/VERSION=//' | \
-                     sed -r 's/\"|\(|\)//g' | awk '{print $2}'`
-        os_RELEASE=`awk '/VERSION_ID=/' /etc/os-release | sed 's/VERSION_ID=//' \
-                    | sed 's/\"//g'`
-    fi
-
-    # Simply distro version string
-    case "$os_VENDOR" in
-        "Debian"* | "Ubuntu"* | "LinuxMint"* )
-            DISTRO="Debian"
-            ;;
-        "SUSE"* )
-            DISTRO="SUSE"
-            ;;
-        "OpenSUSE"* | "openSUSE"* )
-            DISTRO="openSUSE"
-            ;;
-        "Red"* | "CentOS"* )
-            DISTRO="CentOS"
-            ;;
-        *)
-            DISTRO=$os_VENDOR
-            ;;
-    esac
-
-    export os_VENDOR os_RELEASE os_UPDATE os_CODENAME
-    export DISTRO
-}
-
-function get_arch() {
-    export ARCH=`uname -m | sed -e s/i.86/x86_32/ -e s/i86pc/x86_32/ -e \
-                s/amd64/x86_64/ -e s/armv7.*/arm32/ -e s/armv8.*/arm64/ \
-                -e s/aarch64/arm64/`
-}
-
 
 # execution
 if test $EUID -eq 0
@@ -115,6 +32,8 @@ fi
 get_distro
 get_arch
 
+install_dependencies git
+
 if test "$XEN_UPSTREAM_REVISION"
 then
     xen_clean
index de7a1a455f228e6fa36012eb57de506c5676eb99..b8d76b240629c915fc36d395c5c6d780b9154ef6 100644 (file)
@@ -1,5 +1,89 @@
 #!/usr/bin/env bash
 
+function get_distro() {
+    if test -x "`which lsb_release 2>/dev/null`"
+    then
+        os_VENDOR=`lsb_release -i -s`
+        os_RELEASE=`lsb_release -r -s`
+        os_CODENAME=`lsb_release -c -s`
+        os_UPDATE=""
+    elif test -r /etc/redhat-release
+    then
+        # Red Hat Enterprise Linux Server release 5.5 (Tikanga)
+        # Red Hat Enterprise Linux Server release 7.0 Beta (Maipo)
+        # CentOS release 5.5 (Final)
+        # CentOS Linux release 6.0 (Final)
+        # Fedora release 16 (Verne)
+        # XenServer release 6.2.0-70446c (xenenterprise)
+        os_CODENAME=""
+        for r in "Red Hat" "CentOS" "Fedora" "XenServer"; do
+            os_VENDOR="$r"
+            if test -n "`grep -i \"$r\" /etc/redhat-release`"
+            then
+                ver=`sed -e 's/^.* \([0-9].*\) (\(.*\)).*$/\1\|\2/' /etc/redhat-release`
+                os_CODENAME=${ver#*|}
+                os_RELEASE=${ver%|*}
+                os_UPDATE=${os_RELEASE##*.}
+                os_RELEASE=${os_RELEASE%.*}
+                break
+            fi
+        done
+    elif test -r /etc/SuSE-release
+    then
+        for r in "openSUSE" "SUSE Linux"
+        do
+            os_VENDOR="$r"
+
+            if test -n "`grep -i \"$r\" /etc/SuSE-release`"
+            then
+                os_CODENAME=`grep "CODENAME = " /etc/SuSE-release | \
+                             sed 's:.* = ::g'`
+                os_RELEASE=`grep "VERSION = " /etc/SuSE-release | \
+                            sed 's:.* = ::g'`
+                os_UPDATE=`grep "PATCHLEVEL = " /etc/SuSE-release | \
+                           sed 's:.* = ::g'`
+                break
+            fi
+        done
+    # If lsb_release is not installed, we should be able to detect Debian OS
+    elif test -f /etc/debian_version && [[ `cat /proc/version` =~ "Debian" ]]
+    then
+        os_VENDOR="Debian"
+        os_CODENAME=`awk '/VERSION=/' /etc/os-release | sed 's/VERSION=//' | \
+                     sed -r 's/\"|\(|\)//g' | awk '{print $2}'`
+        os_RELEASE=`awk '/VERSION_ID=/' /etc/os-release | sed 's/VERSION_ID=//' \
+                    | sed 's/\"//g'`
+    fi
+
+    # Simply distro version string
+    case "$os_VENDOR" in
+        "Debian"* | "Ubuntu"* | "LinuxMint"* )
+            DISTRO="Debian"
+            ;;
+        "SUSE"* )
+            DISTRO="SUSE"
+            ;;
+        "OpenSUSE"* | "openSUSE"* )
+            DISTRO="openSUSE"
+            ;;
+        "Red"* | "CentOS"* )
+            DISTRO="CentOS"
+            ;;
+        *)
+            DISTRO=$os_VENDOR
+            ;;
+    esac
+
+    export os_VENDOR os_RELEASE os_UPDATE os_CODENAME
+    export DISTRO
+}
+
+function get_arch() {
+    export ARCH=`uname -m | sed -e s/i.86/x86_32/ -e s/i86pc/x86_32/ -e \
+                s/amd64/x86_64/ -e s/armv7.*/arm32/ -e s/armv8.*/arm64/ \
+                -e s/aarch64/arm64/`
+}
+
 function install_dependencies() {
     case $DISTRO in
         "Debian" | "Ubuntu" )
diff --git a/grub.sh b/grub.sh
index 40d9c1664a83a1605fd3d1fd0c0e62cdd7e4fc91..4ec9dbbea607911d0f31086d0cce0e6b4dca10c5 100644 (file)
--- a/grub.sh
+++ b/grub.sh
@@ -5,13 +5,13 @@ source common-functions.sh
 
 
 function grub_install_dependencies() {
-    local DEP_Debian_common="git build-essential tar autoconf bison flex"
+    local DEP_Debian_common="build-essential tar autoconf bison flex"
     local DEP_Debian_x86_32="$DEP_Debian_common"
     local DEP_Debian_x86_64="$DEP_Debian_common libc6-dev-i386"
     local DEP_Debian_arm32="$DEP_Debian_common"
     local DEP_Debian_arm64="$DEP_Debian_common"
 
-    local DEP_Fedora_common="git make gcc tar automake autoconf sysconftool bison flex"
+    local DEP_Fedora_common="make gcc tar automake autoconf sysconftool bison flex"
     local DEP_Fedora_x86_32="$DEP_Fedora_common"
     local DEP_Fedora_x86_64="$DEP_Fedora_common glibc-devel.i686"
 
index f63454f6a9c67c1c54e8a6df0691d037961fac7d..96d12455d48a3d91ae9612269aa0da93f5e4a1bd 100644 (file)
@@ -5,7 +5,7 @@ source common-functions.sh
 
 
 function libvirt_install_dependencies() {
-    local DEP_Debian_common="git build-essential libtool autoconf autopoint \
+    local DEP_Debian_common="build-essential libtool autoconf autopoint \
                              xsltproc libxml2-utils pkg-config python-dev   \
                              libxml-xpath-perl libyajl-dev libxml2-dev      \
                              gettext libdevmapper-dev libnl-3-dev           \
@@ -15,7 +15,7 @@ function libvirt_install_dependencies() {
     local DEP_Debian_arm32="$DEP_Debian_common"
     local DEP_Debian_arm64="$DEP_Debian_common"
 
-    local DEP_Fedora_common="git patch make gcc libtool autoconf gettext-devel \
+    local DEP_Fedora_common="patch make gcc libtool autoconf gettext-devel \
                              python-devel libxslt yajl-devel libxml2-devel     \
                              device-mapper-devel libpciaccess-devel            \
                              libuuid-devel"
diff --git a/xen.sh b/xen.sh
index 97ba5792077c9bcae41ad959b7eb3a639d786e7a..7c0a659c8d478b187b1b1f94990f74b319a3cfe3 100644 (file)
--- a/xen.sh
+++ b/xen.sh
@@ -5,7 +5,7 @@ source common-functions.sh
 
 
 function xen_install_dependencies() {
-    local DEP_Debian_common="git build-essential python-dev gettext uuid-dev   \
+    local DEP_Debian_common="build-essential python-dev gettext uuid-dev   \
              libncurses5-dev libyajl-dev libaio-dev pkg-config libglib2.0-dev  \
              libssl-dev libpixman-1-dev"
     local DEP_Debian_x86_32="$DEP_Debian_common bcc iasl bin86 texinfo"
@@ -13,7 +13,7 @@ function xen_install_dependencies() {
     local DEP_Debian_arm32="$DEP_Debian_common libfdt-dev"
     local DEP_Debian_arm64="$DEP_Debian_arm32"
 
-    local DEP_Fedora_common="git make gcc python-devel gettext libuuid-devel   \
+    local DEP_Fedora_common="make gcc python-devel gettext libuuid-devel   \
              ncurses-devel glib2-devel libaio-devel openssl-devel yajl-devel   \
              patch pixman-devel"
     local DEP_Fedora_x86_32="$DEP_Fedora_common dev86 iasl texinfo"