More tweaks to kpartx output parsing v0.7
authorGuido Trotter <ultrotter@google.com>
Thu, 19 Feb 2009 13:42:05 +0000 (13:42 +0000)
committerGuido Trotter <ultrotter@google.com>
Thu, 19 Feb 2009 13:42:05 +0000 (13:42 +0000)
commitad6f95d2b6b9c0283aaded610c5e53794782625b
tree2e46ca349f1f16a8348cb399d7db24b12d2cb401
parent8b864881ebd5f722d635b9cb8656cc44d0fae617
More tweaks to kpartx output parsing

Apparently kpartx likes to play with us, and different versions of
kpartx will give the mapped partition different names. Sometimes dashes
in the original name will be doubled, and sometimes a leading directory
in /dev (eg. a volume group name) will be included in the name itself.

In order to avoid that we just look in the output for anything which
includes the string '-1' (which is the first partition, with the
separator '-' which we forced kpartx to use with the -p- option).
Moreover, to be sure we don't pass on wrong information, we check that
our grep had some output, and that the created device actually exists
after running kpartx -a, with the output redirected to /dev/null as
otherwise sometimes it will echo a few lines which will be inserted in
the function result, and thus break the actual result filesystem_dev
variable.

Reviewed-by: iustinp
common.sh.in