aboutsummaryrefslogtreecommitdiff
path: root/share/hydra/bootless
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/hydra/bootless
parente054497a94a177b746080d8c2af27ffca07fcf81 (diff)
downloadhydra-d0fe423914448677a85c5558daf31713c6e5e6bd.tar.gz
hydra-d0fe423914448677a85c5558daf31713c6e5e6bd.tar.bz2
Using parted for bootless
Diffstat (limited to 'share/hydra/bootless')
-rwxr-xr-xshare/hydra/bootless17
1 files changed, 16 insertions, 1 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