From 3da6cdad0023b553507797ba3e7b656e930134d4 Mon Sep 17 00:00:00 2001 From: tzafrir Date: Thu, 4 Oct 2007 18:06:47 +0000 Subject: * install_prereq is not a build script. Move it to main directory (which is our scripts directory). * Don't run/print install command when there's nothing to install. * Fix install_prereq command in README . Merged revisions 3109-3112 via svnmerge from http://svn.digium.com/svn/zaptel/branches/1.2 git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3113 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- build_tools/install_prereq | 112 --------------------------------------------- 1 file changed, 112 deletions(-) delete mode 100755 build_tools/install_prereq (limited to 'build_tools') diff --git a/build_tools/install_prereq b/build_tools/install_prereq deleted file mode 100755 index 56463b4..0000000 --- a/build_tools/install_prereq +++ /dev/null @@ -1,112 +0,0 @@ -#! /bin/sh - -# install_prereq: a script to install distribution-specific -# prerequirements - -set -e - -usage() { - echo "$0: a script to install distribution-specific prerequirement" - echo 'Revision: $Id$' - echo "" - echo "Usage: $0: Shows this message." - echo "Usage: $0 test Prints commands it is about to run." - echo "Usage: $0 install Really install." -} - -PACKAGES_DEBIAN="build-essential libnewt-dev libusb-dev" -PACKAGES_RH="gcc newt-devel libusb-devel" -KVERS=`uname -r` - -case "$1" in -test) testcmd=echo ;; -install) testcmd='' ;; -'') usage; exit 0 ;; -*) usage; exit 1 ;; -esac - - -# Fixme: should be done by apt and not by dpkg? -check_installed_debs() { - dpkg-query -W --showformat '${Status} ${Package}\n' "$@" 2>/dev/null \ - | awk '/ not-installed/{print $4}' -} - -# parsing the output of yum is close to impossible. -# We'll use rpm and hope for the best: -check_installed_rpms() { - for pack in "$@" - do - if ! rpm -q $pack >/dev/null 2>/dev/null - then echo $pack - fi - done -} - - -has_kernel_source() { - test -r /lib/modules/$KVERS/build/.config -} - -in_test_mode() { - test "$testcmd" != '' -} - -handle_debian() { - # echo "# Distribution is Debian or compatible" - kernel_package='' - extra_packs=`check_installed_debs $PACKAGES_DEBIAN` - if ! has_kernel_source; then - kernel_package="linux-headers-$KVERS" - debian_release=`cat /etc/debian_version` - case "$debian_release" in - 3.1) kernel_package="kernel-headers-$KVERS";; - esac - echo "# Kernel source not found. Installing $kernel_package" - fi - $testcmd apt-get install -y $extra_packs $kernel_package -} - -handle_rh() { - # echo "# Distribution is RedHat or similar." - kernel_package='' - extra_packs=`check_installed_rpms $PACKAGES_RH` - if ! has_kernel_source; then - kern_str='' # extra "kernel version" - case "$KVERS" in - *smp*) kern_str='-smp';; - *PAE*) kern_str='-PAE';; - *xen*) kern_str='-xen';; - esac - kernel_package="kernel$kern_str-devel-$KVERS" - echo "# Kernel source not found. Installing $kernel_package" - - echo "# if you get an error for the following command, consider" - echo "#" - echo "#yum install -y kernel$kern_str kernel$kern_str-devel" - echo "#" - echo "# and then reboot to upgrade to the newly installed kernel." - fi - $testcmd yum install -y $extra_packs $kernel_package -} - -if in_test_mode; then - echo "#############################################" - echo "## $1: test mode." - echo "## Use the commands here to install your system." - echo "#############################################" -fi - -# handle the easy case of Debians first -if [ -r /etc/debian_version ]; then - handle_debian -elif [ -r /etc/redhat-release ]; then - handle_rh -fi - -echo "#############################################" -echo "## $1 completed successfully" -if in_test_mode; then - echo "## (in test mode)" -fi -echo "#############################################" -- cgit v1.2.3