From: Silvio Rhatto Date: Sat, 7 May 2011 02:21:45 +0000 (-0300) Subject: Checking for dependencies at provision action X-Git-Tag: 0.1~346 X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=440fd2954773f310597e9508d9fc931afee998dc;p=hydra.git Checking for dependencies at provision action --- diff --git a/lib/hydra/misc b/lib/hydra/misc index 2fd5518..6f74f8a 100644 --- a/lib/hydra/misc +++ b/lib/hydra/misc @@ -24,3 +24,16 @@ function hydra_user_input { export $param=$input fi } + +# Install a package. +function hydra_install_package { + if [ -z "$1" ]; then + return + fi + + dpkg -l $1 &> /dev/null + + if [ "$?" == "1" ]; then + apt-get install $1 + fi +} diff --git a/share/hydractl/provision b/share/hydractl/provision index 2822864..fecef58 100755 --- a/share/hydractl/provision +++ b/share/hydractl/provision @@ -17,6 +17,11 @@ hydra_user_input version lenny "Distro version" hydra_user_input vg vg "Temporary install vg" hydra_user_input grub n "Setup GRUB? (y/n)" +# Check for requirements. +for reqs in debootstrap cryptsetup; do + hydra_install_package $req +done + # Warning. cat <<-EOF Make sure you have chosen the right parameters and that $device has the needed partitions: