tar2fs: fixed broken sfdisk use

Yet another age old bug: `sfdisk -l' is mimicking what
a person does by hand but the script is rather interested
in what `sfdisk -g' provides, that is, geometry.

And it's stupid enough to only grok C locale.
This commit is contained in:
Michael Shigorin 2015-05-31 18:08:19 +03:00
parent 1d0d1ceaef
commit 0cdc8a7d77

View File

@ -3,6 +3,7 @@
# tar2fs chroot.tar image.raw [size_in_bytes [fstype]]
. shell-error
export LANG=C
if [ $# -lt 2 ]; then
fatal "error: tar2fs needs at least two arguments"
@ -211,8 +212,8 @@ sed -i "s,$LOOPROOT,$ROOTDEV," "$ROOTFS/etc/fstab"
if [ -x "$ROOTFS"/sbin/lilo ]; then
# configure and install bootloader
REGEXP='^Disk .*: ([0-9]+) cylinders, ([0-9]+) heads, ([0-9]+) sectors/track*$'
set -- $(sfdisk -l "$LOOPDEV" | grep -E "$REGEXP" | sed -r "s@$REGEXP@\1 \2 \3@")
REGEXP='^.*: ([0-9]+) cylinders, ([0-9]+) heads, ([0-9]+) sectors/track*$'
set -- $(sfdisk -g "$LOOPDEV" | grep -E "$REGEXP" | sed -r "s@$REGEXP@\1 \2 \3@")
LILO_COMMON="lba32
delay=1