aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xshare/hydractl/provision47
1 files changed, 31 insertions, 16 deletions
diff --git a/share/hydractl/provision b/share/hydractl/provision
index 8d6d686..b781178 100755
--- a/share/hydractl/provision
+++ b/share/hydractl/provision
@@ -20,7 +20,7 @@
source $APP_BASE/lib/hydra/functions || exit 1
hydra_config_load
-# Create a logical volume
+# Create a logical volume.
function hydra_lvcreate {
local volume="$1"
local size="$2"
@@ -45,7 +45,7 @@ function hydra_lvcreate {
fi
}
-# Create a physical volume
+# Create a physical volume.
function hydra_create_volume {
local volume="$1"
@@ -72,21 +72,36 @@ function hydra_create_volume {
fi
}
+# Ask user for install configuration.
+function hydra_provision_askuser {
+ hydra_user_input device /dev/sdb "Destination device"
+ hydra_user_input root_size 20G "Size of root partition"
+ hydra_user_input swap_size 2000 "Swap size (in MB, 0 to not create it)"
+ hydra_user_input home_size 20G "Size of home partition (0 to not create it, -1 for all free space)"
+ hydra_user_input var_size 20G "Size of var partition (0 to not create it, -1 for all free space)"
+ hydra_user_input encrypt y "Encrypt volumes? (y/n)"
+ hydra_user_input garbage y "Pre-fill volumes with garbage? (y/n)"
+ hydra_user_input hostname $HOSTNAME "Hostname"
+ hydra_user_input domain example.com "Domain"
+ hydra_user_input arch amd64 "System arch"
+ hydra_user_input version wheezy "Distro version"
+ hydra_user_input vg vg "Temporary install vg"
+ hydra_user_input grub y "Setup GRUB? (y/n)"
+ hydra_user_input mirror http://http.debian.net/debian/ "Debian mirror"
+}
+
# Setup.
-hydra_user_input device /dev/sdb "Destination device"
-hydra_user_input root_size 20G "Size of root partition"
-hydra_user_input swap_size 2000 "Swap size (in MB, 0 to not create it)"
-hydra_user_input home_size 20G "Size of home partition (0 to not create it, -1 for all free space)"
-hydra_user_input var_size 20G "Size of var partition (0 to not create it, -1 for all free space)"
-hydra_user_input encrypt y "Encrypt volumes? (y/n)"
-hydra_user_input garbage y "Pre-fill volumes with garbage? (y/n)"
-hydra_user_input hostname $HOSTNAME "Hostname"
-hydra_user_input domain example.com "Domain"
-hydra_user_input arch amd64 "System arch"
-hydra_user_input version wheezy "Distro version"
-hydra_user_input vg vg "Temporary install vg"
-hydra_user_input grub y "Setup GRUB? (y/n)"
-hydra_user_input mirror http://http.debian.net/debian/ "Debian mirror"
+if [ ! -z "$1" ]; then
+ if [ -f "$1" ]; then
+ echo "Using configuration from file $1..."
+ source "$1"
+ else
+ echo "File not found: $1"
+ exit 1
+ fi
+else
+ hydra_provision_askuser
+fi
# Check for requirements.
for req in debootstrap cryptsetup grub-pc lvm2 parted; do