Commit 5e9ba6fb authored by Michael Shigorin's avatar Michael Shigorin

tar2vm: reworked to use sfdisk

The issue (#28002) resulting in vm image build error reading Syntax error at or above line 5 in file '/etc/lilo-loop.conf' was caused by fdisk-2.22 changing its "-l" option output format to drop the very mention of the long irrelevant crap named "CHS". The problem is, however, that we still need that crap to piggyback a loop device's fake geometry to lilo while installing it there. Reported by icesik@.
parent e179176b
...@@ -15,10 +15,10 @@ BuildRequires: rsync asciidoc-a2x xmlgraphics-fop fonts-ttf-dejavu ...@@ -15,10 +15,10 @@ BuildRequires: rsync asciidoc-a2x xmlgraphics-fop fonts-ttf-dejavu
BuildRequires: /proc BuildRequires: /proc
Requires: rsync git-core Requires: rsync git-core
Requires: time schedutils Requires: time schedutils sfdisk
Requires: mkimage >= 0.2.0 Requires: mkimage >= 0.2.0
# Recommends: graphviz # Recommends: graphviz qemu-img
%define mpdir %_datadir/%name %define mpdir %_datadir/%name
%add_findreq_skiplist %mpdir/*.in/* %add_findreq_skiplist %mpdir/*.in/*
......
...@@ -42,7 +42,7 @@ ROOTFSTYPE="${4:-ext4}" ...@@ -42,7 +42,7 @@ ROOTFSTYPE="${4:-ext4}"
ROOTDEV="/dev/sda1" ROOTDEV="/dev/sda1"
# last preparations... # last preparations...
for i in losetup parted kpartx mkfs."$ROOTFSTYPE"; do for i in losetup sfdisk parted kpartx mkfs."$ROOTFSTYPE"; do
if ! type -t "$i" >&/dev/null; then if ! type -t "$i" >&/dev/null; then
fatal "$i required but not found" fatal "$i required but not found"
fi fi
...@@ -98,8 +98,8 @@ chroot "$ROOTFS" make-initrd -k "$KERNEL" ...@@ -98,8 +98,8 @@ chroot "$ROOTFS" make-initrd -k "$KERNEL"
sed -i "s,$LOOPDEV1,$ROOTDEV," "$ROOTFS/etc/fstab" sed -i "s,$LOOPDEV1,$ROOTDEV," "$ROOTFS/etc/fstab"
# configure and install bootloader # configure and install bootloader
REGEXP='^([0-9]+) heads, ([0-9]+) sectors/track, ([0-9]+) cylinders.*$' REGEXP='^Disk .*: ([0-9]+) cylinders, ([0-9]+) heads, ([0-9]+) sectors/track*$'
set -- $(fdisk -l "$LOOPDEV" | grep -E "$REGEXP" | sed -r "s@$REGEXP@\1 \2 \3@") set -- $(sfdisk -l "$LOOPDEV" | grep -E "$REGEXP" | sed -r "s@$REGEXP@\1 \2 \3@")
LILO_COMMON="lba32 LILO_COMMON="lba32
delay=1 delay=1
...@@ -113,9 +113,9 @@ cat > "$ROOTFS"/etc/lilo-loop.conf << EOF ...@@ -113,9 +113,9 @@ cat > "$ROOTFS"/etc/lilo-loop.conf << EOF
boot=$LOOPDEV boot=$LOOPDEV
disk=$LOOPDEV disk=$LOOPDEV
bios=0x80 bios=0x80
heads=$1 cylinders=$1
sectors=$2 heads=$2
cylinders=$3 sectors=$3
partition=$LOOPDEV1 partition=$LOOPDEV1
start=63 start=63
$LILO_COMMON $LILO_COMMON
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment