aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xshare/hydractl/provision31
1 files changed, 17 insertions, 14 deletions
diff --git a/share/hydractl/provision b/share/hydractl/provision
index 0d11a73..125fa81 100755
--- a/share/hydractl/provision
+++ b/share/hydractl/provision
@@ -31,6 +31,9 @@ function hydra_lvcreate {
if ! lvdisplay $vg/$volume &> /dev/null; then
echo "Creating logical volume $volume..."
+ # See http://forums.funtoo.org/viewtopic.php?id=1206
+ # https://bbs.archlinux.org/viewtopic.php?id=124615
+ #hydra_safe_run lvcreate -Z n -L$size -n $volume $vg
hydra_safe_run lvcreate -L$size -n $volume $vg
fi
}
@@ -39,25 +42,25 @@ function hydra_lvcreate {
function hydra_create_volume {
local volume="$1"
- if [ -z "$volume" ] || [ ! -b "/dev/$vg/$volume" ]; then
+ if [ -z "$volume" ] || [ ! -b "/dev/mapper/$vg-$volume" ]; then
return
fi
if [ "$encrypt" == "y" ]; then
echo "Creating encrypted $volume device..."
- hydra_safe_run cryptsetup -h sha256 -c aes-cbc-essiv:sha256 -s 256 luksFormat /dev/$vg/$volume
- hydra_safe_run cryptsetup luksOpen /dev/$vg/$volume $volume
+ hydra_safe_run cryptsetup -h sha256 -c aes-cbc-essiv:sha256 -s 256 luksFormat /dev/mapper/$vg-$volume
+ hydra_safe_run cryptsetup luksOpen /dev/mapper/$vg-$volume $volume
hydra_safe_run mkfs.ext4 /dev/mapper/debootstrap
if [ "$volume" == "root" ]; then
- install_device="/dev/mapper/$volume"
+ install_device="/dev/mapper/root"
fi
else
echo "Creating $volume device..."
- mkfs.ext4 /dev/vg/$volume
+ mkfs.ext4 /dev/mapper/$vg-$volume
if [ "$volume" == "root" ]; then
- install_device="/dev/vg/$volume"
+ install_device="/dev/mapper/$vg-root"
fi
fi
}
@@ -138,14 +141,14 @@ hydra_safe_run vgchange -a y $vg
if [ "$garbage" == "y" ]; then
echo "Filling volumes with garbage..."
- dd if=/dev/urandom of=/dev/$vg/root
+ dd if=/dev/urandom of=/dev/mapper/$vg-root
- if [ -b "/dev/$vg/home" ]; then
- dd if=/dev/urandom of=/dev/$vg/home
+ if [ -b "/dev/mapper/$vg-home" ]; then
+ dd if=/dev/urandom of=/dev/mapper/$vg-home
fi
- if [ -b "/dev/$vg/var" ]; then
- dd if=/dev/urandom of=/dev/$vg/var
+ if [ -b "/dev/mapper/$vg-var" ]; then
+ dd if=/dev/urandom of=/dev/mapper/$vg-var
fi
if [ "$swap" == "y" ]; then
@@ -238,7 +241,7 @@ if [ "$encrypt" == "y" ]; then
EOF
else
cat > /tmp/debootstrap/etc/fstab <<-EOF
-/dev/vg/root / ext4 defaults,errors=remount-ro 0 1
+/dev/mapper/vg-root / ext4 defaults,errors=remount-ro 0 1
EOF
fi
@@ -249,7 +252,7 @@ if [ "$home_size" != "0" ]; then
EOF
else
cat >> /tmp/debootstrap/etc/fstab <<-EOF
-/dev/vg/home /home ext4 defaults,errors=remount-ro 0 2
+/dev/mapper/vg-home /home ext4 defaults,errors=remount-ro 0 2
EOF
fi
fi
@@ -261,7 +264,7 @@ if [ "$var_size" != "0" ]; then
EOF
else
cat >> /tmp/debootstrap/etc/fstab <<-EOF
-/dev/vg/var /var ext4 defaults,errors=remount-ro 0 2
+/dev/mapper/vg-var /var ext4 defaults,errors=remount-ro 0 2
EOF
fi
fi