summaryrefslogtreecommitdiff
path: root/share/hydractl/provision
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-01-30 19:13:50 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-01-30 19:13:50 -0200
commit63835d37231794527b6999fac1d50321c631044e (patch)
tree2e9e3a1b155260478ecbf962001d5670425f9677 /share/hydractl/provision
parent7d9c8ef2f108381298f83054ad656bd84723e9ea (diff)
downloadhydra-63835d37231794527b6999fac1d50321c631044e.tar.gz
hydra-63835d37231794527b6999fac1d50321c631044e.tar.bz2
Provision: checking and getting user input when config is not set; new config 'disable_zeroing'; function rename
Diffstat (limited to 'share/hydractl/provision')
-rwxr-xr-xshare/hydractl/provision61
1 files changed, 33 insertions, 28 deletions
diff --git a/share/hydractl/provision b/share/hydractl/provision
index b781178..2477fa3 100755
--- a/share/hydractl/provision
+++ b/share/hydractl/provision
@@ -21,7 +21,7 @@ source $APP_BASE/lib/hydra/functions || exit 1
hydra_config_load
# Create a logical volume.
-function hydra_lvcreate {
+function hydra_provision_lvcreate {
local volume="$1"
local size="$2"
local space
@@ -40,13 +40,16 @@ function hydra_lvcreate {
# See http://forums.funtoo.org/viewtopic.php?id=1206
# https://bbs.archlinux.org/viewtopic.php?id=124615
- #hydra_safe_run lvcreate -Z n $space -n $volume $vg
- hydra_safe_run lvcreate $space -n $volume $vg
+ if [ "$disable_zeroing" == "y" ]; then
+ hydra_safe_run lvcreate -Z n $space -n $volume $vg
+ else
+ hydra_safe_run lvcreate $space -n $volume $vg
+ fi
fi
}
# Create a physical volume.
-function hydra_create_volume {
+function hydra_provision_create_volume {
local volume="$1"
if [ -z "$volume" ] || [ ! -b "/dev/mapper/$vg-$volume" ]; then
@@ -72,22 +75,23 @@ 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"
+# Make sure there is provision config.
+function hydra_provision_config {
+ hydra_user_config device /dev/sdb "Destination device"
+ hydra_user_config root_size 20G "Size of root partition"
+ hydra_user_config swap_size 2000 "Swap size (in MB, 0 to not create it)"
+ hydra_user_config home_size 20G "Size of home partition (0 to not create it, -1 for all free space)"
+ hydra_user_config var_size 20G "Size of var partition (0 to not create it, -1 for all free space)"
+ hydra_user_config encrypt y "Encrypt volumes? (y/n)"
+ hydra_user_config garbage y "Pre-fill volumes with garbage? (y/n)"
+ hydra_user_config disable_zeroing n "Disable zeroing of lvm volumes? (y/n)"
+ hydra_user_config hostname $HOSTNAME "Hostname"
+ hydra_user_config domain example.com "Domain"
+ hydra_user_config arch amd64 "System arch"
+ hydra_user_config version wheezy "Distro version"
+ hydra_user_config vg vg "Temporary install vg"
+ hydra_user_config grub y "Setup GRUB? (y/n)"
+ hydra_user_config mirror http://http.debian.net/debian/ "Debian mirror"
}
# Setup.
@@ -99,10 +103,11 @@ if [ ! -z "$1" ]; then
echo "File not found: $1"
exit 1
fi
-else
- hydra_provision_askuser
fi
+# Get parameters
+hydra_provision_config
+
# Check for requirements.
for req in debootstrap cryptsetup grub-pc lvm2 parted; do
hydra_install_package $req
@@ -156,16 +161,16 @@ fi
# Create root partition
hydra_safe_run vgchange -a y $vg
-hydra_lvcreate root $root_size
+hydra_provision_lvcreate root $root_size
# Create home partition
if [ "$home_size" != "0" ]; then
- hydra_lvcreate home $home_size
+ hydra_provision_lvcreate home $home_size
fi
# Create var partition
if [ "$var_size" != "0" ]; then
- hydra_lvcreate var $var_size
+ hydra_provision_lvcreate var $var_size
fi
# Garbage.
@@ -195,16 +200,16 @@ for folder in proc dev home var boot sys; do
done
# Create root fs
-hydra_create_volume root
+hydra_provision_create_volume root
# Create home fs
if [ "$home_size" != "0" ]; then
- hydra_create_volume home
+ hydra_provision_create_volume home
fi
# Create var fs
if [ "$var_size" != "0" ]; then
- hydra_create_volume var
+ hydra_provision_create_volume var
fi
# Mount root volume