Control: tags -1 + patch

Hello,

On Sun, Jan 14, 2018 at 08:10:26PM +0100, Helmut Grohne wrote:
> Package: qemu-utils
[...]
> /usr/sbin/qemu-make-debian-root contains mke2fs. According to file it is a 
> POSIX shell script, ASCII text executable
[...]

The qemu-make-debian-root script is not part of upstream but comes from
the debian/ packaging directory.

The script starts with checking for debootstrap existance and erroring
out with a helpful message if not found.

I would suggest extending the debootstrap check with also checking for
other commands used in the script and erroring out if they are missing
in a similar fashion. (eg. losetup, sfdisk, mke2fs, etc.)

If the previous suggestion is implemented, also having qemu-utils
Suggest mount, fdisk, e2fsprogs is likely a good idea.

This should then also fix #872098.

A patch implementing the previous suggestion has been attached for
your convenience. Please test and review it carefully.

Regards,
Andreas Henriksson
diff --git a/debian/changelog b/debian/changelog
index 9f4f14d..b62b701 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+qemu (1:2.11+dfsg-1.1) UNRELEASED; urgency=medium
+
+  * debian/qemu-make-debian-root: verify existance of losetup, mount,
+    sfdisk and mke2fs commands and suggest their respective relevant
+    package might not be installed if command not found.
+    (Closes: #872098, #887207)
+  * Add fdisk, mount, e2fsprogs to what qemu-utils suggests.
+
+ -- Andreas Henriksson <andr...@fatal.se>  Sat, 20 Jan 2018 02:27:47 +0100
+
 qemu (1:2.11+dfsg-1) unstable; urgency=medium
 
   [ Michael Tokarev ]
diff --git a/debian/control b/debian/control
index 5aff925..b8a1041 100644
--- a/debian/control
+++ b/debian/control
@@ -394,7 +394,7 @@ Package: qemu-utils
 Architecture: amd64 arm arm64 armel armhf hppa i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel mips64 mips64el powerpc powerpcspe ppc64 ppc64el s390x sparc sparc64 x32
 Multi-Arch: foreign
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Suggests: debootstrap, qemu-block-extra (= ${binary:Version}),
+Suggests: debootstrap, fdisk, mount, e2fsprogs, qemu-block-extra (= ${binary:Version}),
 Description: QEMU utilities
  QEMU is a fast processor emulator: currently the package supports
  ARM, CRIS, i386, M68k (ColdFire), MicroBlaze, MIPS, PowerPC, SH4,
diff --git a/debian/control-in b/debian/control-in
index 8e0a60f..bcfae15 100644
--- a/debian/control-in
+++ b/debian/control-in
@@ -404,7 +404,7 @@ Package: qemu-utils
 Architecture: amd64 arm arm64 armel armhf hppa i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel mips64 mips64el powerpc powerpcspe ppc64 ppc64el s390x sparc sparc64 x32
 Multi-Arch: foreign
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Suggests: debootstrap, qemu-block-extra (= ${binary:Version}),
+Suggests: debootstrap, fdisk, mount, e2fsprogs, qemu-block-extra (= ${binary:Version}),
 Description: QEMU utilities
  QEMU is a fast processor emulator: currently the package supports
  ARM, CRIS, i386, M68k (ColdFire), MicroBlaze, MIPS, PowerPC, SH4,
diff --git a/debian/qemu-make-debian-root b/debian/qemu-make-debian-root
index a22d1bc..947e93d 100755
--- a/debian/qemu-make-debian-root
+++ b/debian/qemu-make-debian-root
@@ -7,11 +7,22 @@
 
 set -e
 
-which debootstrap >/dev/null || {
-    echo "error: missing debootstrap package" >&2
-    exit 1
+verify_command_installed() {
+    CMD=$1
+    PKG=$2
+    which $CMD >/dev/null || {
+        echo "error: $CMD not found in PATH, possibly missing $PKG package" >&2
+        exit 1
+    }
 }
 
+verify_command_installed debootstrap debootstrap
+for CMD in losetup mount ; do
+    verify_command_installed $CMD mount
+done
+verify_command_installed sfdisk mount
+verify_command_installed mke2fs e2fsprogs
+
 KEEPFS=0
 SPARSE=0
 

Reply via email to