]> gitweb.fluxo.info Git - hydra.git/commitdiff
Checking for dependencies at provision action
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 7 May 2011 02:21:45 +0000 (23:21 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 7 May 2011 02:21:45 +0000 (23:21 -0300)
lib/hydra/misc
share/hydractl/provision

index 2fd55180b983296fffbc4ba2f7361481ada6a1fd..6f74f8a199d1a5efa71d12ceb6465c6100313b2c 100644 (file)
@@ -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
+}
index 2822864bc411d57bcbbd44dc4d0ab1fbaccb577f..fecef58c53d0844d9113ee44cf84bb50599d6b13 100755 (executable)
@@ -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: