]> xenbits.xensource.com Git - people/gdunlap/raisin.git/.git/commitdiff
Install missing dependencies for Debian and Ubuntu
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Mon, 16 Mar 2015 18:54:13 +0000 (18:54 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Mon, 16 Mar 2015 18:54:13 +0000 (18:54 +0000)
Detect presence of sudo.
Many other cleanups.

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

index 7dafda7c42ca78fc42d866c558ff11d4b5683c5a..26240f07ce8a12057723c9968bbc1e7abf9322fb 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -4,6 +4,7 @@ source config
 
 export PWD=`pwd`
 export GIT=${GIT-git}
+export SUDO=${SUDO-sudo}
 export MAKE=${MAKE-make -j}
 export PREFIX=${PREFIX-/usr}
 export INST_DIR=${DESTDIR-dist}
@@ -51,9 +52,12 @@ function get_distro() {
 
             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'`
+                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
@@ -61,8 +65,10 @@ function get_distro() {
     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'`
+        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
@@ -88,12 +94,29 @@ function get_distro() {
     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
+then
+    export SUDO=""
+elif test ! -f `which sudo`
+then
+    echo "Raixen requires sudo to install build dependencies for you."
+    echo "Please install sudo, then run this script again."
+    exit 1
+fi
+
 rm -rf "$INST_DIR"
 mkdir -p "$INST_DIR"
 
 get_distro
+get_arch
 
 if test "$XEN_UPSTREAM_REVISION"
 then
diff --git a/config b/config
index a69aa65a9787b72ec27a2c9b58b92fa63723cd44..cc9bc8676ad42debbecca815563704a7d8e8ccc6 100644 (file)
--- a/config
+++ b/config
@@ -1,7 +1,6 @@
 # Config variables for raixen
 
-# Build and git config
-#GIT=git
+# Build config
 MAKE="make -j"
 PREFIX="/usr"
 DESTDIR=dist
@@ -14,8 +13,9 @@ XEN_UPSTREAM_URL="git://xenbits.xen.org/xen.git"
 GRUB_UPSTREAM_URL="git://git.savannah.gnu.org/grub.git"
 LIBVIRT_UPSTREAM_URL="git://libvirt.org/libvirt.git"
 
-# Software versions. Leave blank if you want to avoid the build
-# XEN_UPSTREAM_REVISION=
+# Software versions. Leave blank if you want to avoid the build, like
+# this: GRUB_UPSTREAM_REVISION=
+# Keep in mind that both Grub and Libvirt needs Xen to build and run.
 XEN_UPSTREAM_REVISION="RELEASE-4.5.0"
 GRUB_UPSTREAM_REVISION="master"
 LIBVIRT_UPSTREAM_REVISION="v1.2.9.1"
diff --git a/grub.sh b/grub.sh
index cd75003369f6a34cabd7807216d95467ea797f46..e5d7e66e85e2ee33dc52eee1c893b34719839e88 100644 (file)
--- a/grub.sh
+++ b/grub.sh
@@ -8,10 +8,20 @@ function grub_clean() {
 }
 
 function grub_build() {
-    # install dependencies
+    if test $ARCH != "x86_64" && test $ARCH != "x86_32"
+    then
+        echo grub is only supported on x86_32 and x86_64
+        return
+    fi
+    echo installing Grub dependencies
     case $DISTRO in
         "Debian" | "Ubuntu" )
-        apt-get install build-essential
+        # grub also requires xen
+        $SUDO apt-get install -y git build-essential tar autoconf bison flex
+        if test $ARCH = "x86_64"
+        then
+            $SUDO apt-get install -y libc6-dev-i386
+        fi
         ;;
         * )
         echo "I don't know how to install grub dependencies on $DISTRO"
@@ -26,13 +36,18 @@ function grub_build() {
     ## GRUB32
     ./configure --target=i386 --with-platform=xen
     $MAKE
-    ./grub-mkimage -d grub-core -O i386-xen -c ../grub-bootstrap.cfg -m ../memdisk.tar -o grub-i386-xen grub-core/*mod
+    ./grub-mkimage -d grub-core -O i386-xen -c ../grub-bootstrap.cfg \
+      -m ../memdisk.tar -o grub-i386-xen grub-core/*mod
     cp grub-i386-xen "$INST_DIR"/$PREFIX/lib/xen/boot
     ## GRUB64
-    $MAKE clean
-    ./configure --target=amd64 --with-platform=xen
-    $MAKE
-    ./grub-mkimage -d grub-core -O x86_64-xen -c ../grub-bootstrap.cfg -m ../memdisk.tar -o grub-x86_64-xen grub-core/*mod
-    cp grub-x86_64-xen "$INST_DIR"/$PREFIX/lib/xen/boot
+    if test $ARCH = "x86_64"
+    then
+        $MAKE clean
+        ./configure --target=amd64 --with-platform=xen
+        $MAKE
+        ./grub-mkimage -d grub-core -O x86_64-xen -c ../grub-bootstrap.cfg \
+          -m ../memdisk.tar -o grub-x86_64-xen grub-core/*mod
+        cp grub-x86_64-xen "$INST_DIR"/$PREFIX/lib/xen/boot
+    fi
     cd ..
 }
index da390f78fa6fbd10368cbb4349dfb7952606a4ad..9f8a676f3b4379de2ad7beb7a27986bda07add08 100644 (file)
@@ -7,10 +7,14 @@ function libvirt_clean() {
 }
 
 function libvirt_build() {
-    # install dependencies
+    echo installing Libvirt dependencies
     case $DISTRO in
         "Debian" | "Ubuntu" )
-        apt-get install build-essential
+        # libvirt also requires xen
+        $SUDO apt-get install -y git build-essential libtool autoconf \
+                                 autopoint xsltproc libxml2-utils     \
+                                 pkg-config python-dev libxml-xpath-perl \
+                                 libyajl-dev libxml2-dev
         ;;
         * )
         echo "I don't know how to install libvirt dependencies on $DISTRO"
@@ -21,13 +25,13 @@ function libvirt_build() {
     ./git-checkout.sh $LIBVIRT_UPSTREAM_URL $LIBVIRT_UPSTREAM_REVISION libvirt-dir
     cd libvirt-dir
     ./autogen.sh --disable-threads --with-xen --without-qemu --without-uml     \
-       --without-outopenvz --without-vmware --without-libssh2 --without-phyp  \
-       --without-xenapi --with-libxl --without-vbox --without-lxc             \
-       --without-esx --without-hyperv --without-parallels --without-test      \
-       --without-remote --with-libvirtd --without-sasl --with-yajl            \
-       --without-dbus --without-selinux --without-python --without-apparmor   \
-       --without-macvtap --without-avahi --without-openvz --without-dbus      \
-       --prefix=$PREFIX
+        --without-outopenvz --without-vmware --without-libssh2 --without-phyp  \
+        --without-xenapi --with-libxl --without-vbox --without-lxc             \
+        --without-esx --without-hyperv --without-parallels --without-test      \
+        --without-remote --with-libvirtd --without-sasl --with-yajl            \
+        --without-dbus --without-selinux --without-python --without-apparmor   \
+        --without-macvtap --without-avahi --without-openvz --without-dbus      \
+        --prefix=$PREFIX
     $MAKE
     $MAKE --ignore-errors install DESTDIR=$INST_DIR
     cd ..
diff --git a/xen.sh b/xen.sh
index 34ab869b52af6d1005a2bcabc1f37af9d8a46ddb..54cd9aa73e4cefd8ed7d7dadcb3186f68475c4e2 100644 (file)
--- a/xen.sh
+++ b/xen.sh
@@ -7,10 +7,20 @@ function xen_clean() {
 }
 
 function xen_build() {
-    # install dependencies
+    echo installing Xen dependencies
     case $DISTRO in
         "Debian" | "Ubuntu" )
-        apt-get install build-essential
+        $SUDO apt-get install -y git build-essential python-dev gettext \
+          uuid-dev libncurses5-dev libyajl-dev libaio-dev
+        if test $ARCH = "x86_32" || test $ARCH = "x86_64"
+        then
+                $SUDO apt-get install -y bcc iasl bin86 libglib2.0-0 \
+                  libpixman-1-dev
+        fi
+        if test $ARCH = "x86_64"
+        then
+            $SUDO apt-get install -y libc6-dev-i386
+        fi
         ;;
         * )
         echo "I don't know how to install xen dependencies on $DISTRO"