summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-04-10 13:04:23 -0300
committerSilvio Rhatto <rhatto@riseup.net>2012-04-10 13:04:23 -0300
commitd0fe423914448677a85c5558daf31713c6e5e6bd (patch)
treed8bd8fa8277adcc1d903e58e64050e0a519e5c83 /share
parente054497a94a177b746080d8c2af27ffca07fcf81 (diff)
downloadhydra-d0fe423914448677a85c5558daf31713c6e5e6bd.tar.gz
hydra-d0fe423914448677a85c5558daf31713c6e5e6bd.tar.bz2
Using parted for bootless
Diffstat (limited to 'share')
-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