#!/usr/bin/env bash
source config
+source common-functions.sh
export PWD=`pwd`
export GIT=${GIT-git}
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
get_distro
get_arch
+install_dependencies git
+
if test "$XEN_UPSTREAM_REVISION"
then
xen_clean
#!/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" )
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"
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 \
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"
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"
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"