summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xshare/hydra/bootless17
-rwxr-xr-xshare/hydractl/provision8
2 files changed, 20 insertions, 5 deletions
diff --git a/share/hydra/bootless b/share/hydra/bootless
index efc4b05..98c6d58 100755
--- a/share/hydra/bootless
+++ b/share/hydra/bootless
@@ -69,6 +69,8 @@ EOF
else
device=$1
fi
+
+ usbdevice=`echo ${device} | sed -e s/[0-9]\$//g`
# Target device consistency check
if [ ! -b ${device} ]; then
@@ -104,6 +106,15 @@ EOF
echo "Error: device \"${device}\" not found."
exit 1
fi
+
+ # Remove old partitions
+ for partition in `parted -s -- ${usbdevice} print | awk '/^ / {print $1}'`; do
+ parted -s -- ${usbdevice} rm $partition
+ done
+
+ # Create a single partition
+ parted -s -- ${usbdevice} mkpart primary ext2 0 -1
+ parted -s -- ${usbdevice} set 1 boot on
# Format and mount
$sudo mke2fs ${device}
@@ -141,7 +152,6 @@ EOF
#quit" | grub --device-map=${devicemap} --batch
# Grub 2
- usbdevice=`echo ${device} | sed -e s/[0-9]\$//`
$sudo grub-install --root-directory=${tmpdir} ${usbdevice} --force
# Finalize
@@ -235,6 +245,11 @@ function hydra_bootless_usage {
exit 1
}
+# Check for requirements.
+for req in parted; do
+ hydra_install_package $req
+done
+
# Parameter verification
if [ -z "$1" ]; then
hydra_bootless_usage
diff --git a/share/hydractl/provision b/share/hydractl/provision
index 26abd8e..3e46134 100755
--- a/share/hydractl/provision
+++ b/share/hydractl/provision
@@ -50,8 +50,8 @@ if [ "$swap" == "y" ]; then
parted -s -- $device unit MB mkpart primary linux-swap 0 2000
parted -s -- $device unit MB mkpart primary ext2 2000 2200
parted -s -- $device unit MB mkpart primary ext2 2200 -1
- parted -s -- set 2 boot on
- parted -s -- set 3 lvm on
+ parted -s -- $device set 2 boot on
+ parted -s -- $device set 3 lvm on
# Change devices to absolute path names.
swap_device="$device"1
@@ -60,8 +60,8 @@ if [ "$swap" == "y" ]; then
else
parted -s -- $device unit MB mkpart primary ext2 0 200
parted -s -- $device unit MB mkpart primary ext2 200 -1
- parted -s -- set 1 boot on
- parted -s -- set 2 lvm on
+ parted -s -- $device set 1 boot on
+ parted -s -- $device set 2 lvm on
# Change devices to absolute path names.
boot_device="$device"1