Test availability of required commands

This commit is contained in:
Reto Buerki
2013-01-17 16:54:54 +01:00
committed by Tobias Brunner
parent f241f46d88
commit b24d3ed5fc
5 changed files with 18 additions and 0 deletions
+2
View File
@@ -6,6 +6,8 @@ echo "Building base image"
[ `id -u` -eq 0 ] || die "You must be root to run $0"
check_commands debootstrap mkfs.ext3 qemu-img qemu-nbd sfdisk
# additional packages
EXTRAS=build-essential,gperf,libgmp-dev,libldap2-dev,libcurl4-openssl-dev,libxml2-dev,libtspi-dev,libsqlite3-dev,openssh-server,tcpdump,psmisc,openssl,vim,sqlite3,conntrack,gdb,cmake,libxerces-c2-dev,libltdl-dev,liblog4cxx10-dev,libboost-thread-dev,libboost-system-dev,git-core
SERVICES="isc-dhcp-server apache2 slapd"
+2
View File
@@ -6,6 +6,8 @@ echo "Building guest kernel version $KERNELVERSION"
[ -f "$KERNELCONFIG" ] || die "Kernel config $KERNELCONFIG not found"
check_commands bunzip2 bzcat make wget
mkdir -p $BUILDDIR
cd $BUILDDIR
+2
View File
@@ -26,6 +26,8 @@ HOSTSDIR=$PWD/hosts
[ -f $BASE ] || die "Base image $BASE not found"
[ -f $HOSTDIR ] || die "Hosts directory $HOSTSDIR not found"
check_commands qemu-img qemu-nbd
load_qemu_nbd
mkdir -p $BUILDDIR
+2
View File
@@ -22,6 +22,8 @@ echo "Building root image"
[ -f "$ROOTFS" ] || die "Root image $ROOTFS not found"
check_commands qemu-nbd
load_qemu_nbd
mkdir -p $ROOTFSDIR
+10
View File
@@ -148,6 +148,16 @@ load_qemu_nbd()
fi
}
# check if given commands exist in $PATH
# $* - commands to check
check_commands()
{
for i in $*
do
command -v $i >/dev/null || { die "Required command $i not found"; exit 1; }
done
}
#############################################
# search and replace strings throughout a
# whole directory