Test availability of required commands
This commit is contained in:
committed by
Tobias Brunner
parent
f241f46d88
commit
b24d3ed5fc
@@ -6,6 +6,8 @@ echo "Building base image"
|
|||||||
|
|
||||||
[ `id -u` -eq 0 ] || die "You must be root to run $0"
|
[ `id -u` -eq 0 ] || die "You must be root to run $0"
|
||||||
|
|
||||||
|
check_commands debootstrap mkfs.ext3 qemu-img qemu-nbd sfdisk
|
||||||
|
|
||||||
# additional packages
|
# 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
|
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"
|
SERVICES="isc-dhcp-server apache2 slapd"
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ echo "Building guest kernel version $KERNELVERSION"
|
|||||||
|
|
||||||
[ -f "$KERNELCONFIG" ] || die "Kernel config $KERNELCONFIG not found"
|
[ -f "$KERNELCONFIG" ] || die "Kernel config $KERNELCONFIG not found"
|
||||||
|
|
||||||
|
check_commands bunzip2 bzcat make wget
|
||||||
|
|
||||||
mkdir -p $BUILDDIR
|
mkdir -p $BUILDDIR
|
||||||
cd $BUILDDIR
|
cd $BUILDDIR
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ HOSTSDIR=$PWD/hosts
|
|||||||
[ -f $BASE ] || die "Base image $BASE not found"
|
[ -f $BASE ] || die "Base image $BASE not found"
|
||||||
[ -f $HOSTDIR ] || die "Hosts directory $HOSTSDIR not found"
|
[ -f $HOSTDIR ] || die "Hosts directory $HOSTSDIR not found"
|
||||||
|
|
||||||
|
check_commands qemu-img qemu-nbd
|
||||||
|
|
||||||
load_qemu_nbd
|
load_qemu_nbd
|
||||||
|
|
||||||
mkdir -p $BUILDDIR
|
mkdir -p $BUILDDIR
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ echo "Building root image"
|
|||||||
|
|
||||||
[ -f "$ROOTFS" ] || die "Root image $ROOTFS not found"
|
[ -f "$ROOTFS" ] || die "Root image $ROOTFS not found"
|
||||||
|
|
||||||
|
check_commands qemu-nbd
|
||||||
|
|
||||||
load_qemu_nbd
|
load_qemu_nbd
|
||||||
|
|
||||||
mkdir -p $ROOTFSDIR
|
mkdir -p $ROOTFSDIR
|
||||||
|
|||||||
@@ -148,6 +148,16 @@ load_qemu_nbd()
|
|||||||
fi
|
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
|
# search and replace strings throughout a
|
||||||
# whole directory
|
# whole directory
|
||||||
|
|||||||
Reference in New Issue
Block a user