summaryrefslogtreecommitdiff
path: root/build_tools
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-08-17 18:10:23 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-08-17 18:10:23 +0000
commit7bdd6a58b4ada80df2892c63f6b573cd3f717a1d (patch)
tree34d2c723416e0e39083e7911773e32ce8b7a020d /build_tools
parent2efdfd8aa9281f7179801e79b504b6df9ee379d6 (diff)
install_prereq: Don't install packages twice.
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@2880 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'build_tools')
-rwxr-xr-xbuild_tools/install_prereq27
1 files changed, 23 insertions, 4 deletions
diff --git a/build_tools/install_prereq b/build_tools/install_prereq
index 0fb7f47..56463b4 100755
--- a/build_tools/install_prereq
+++ b/build_tools/install_prereq
@@ -26,6 +26,23 @@ install) testcmd='' ;;
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
@@ -38,6 +55,7 @@ in_test_mode() {
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`
@@ -46,15 +64,16 @@ handle_debian() {
esac
echo "# Kernel source not found. Installing $kernel_package"
fi
- $testcmd apt-get install -y $PACKAGES_DEBIAN $kernel_package
+ $testcmd apt-get install -y $extra_packs $kernel_package
}
handle_rh() {
- # echo "# Distribution is Debian or compatible"
+ # 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
+ case "$KVERS" in
*smp*) kern_str='-smp';;
*PAE*) kern_str='-PAE';;
*xen*) kern_str='-xen';;
@@ -68,7 +87,7 @@ handle_rh() {
echo "#"
echo "# and then reboot to upgrade to the newly installed kernel."
fi
- $testcmd yum install -y $PACKAGES_RH $kernel_package
+ $testcmd yum install -y $extra_packs $kernel_package
}
if in_test_mode; then