On Tue, May 08, 2012 at 02:33:19PM +0200, Daniel Baumann wrote:
> thanks, however, findmnt is not available in squeeze, hence this is
> wontfix for now. feel free to provide an alternative patch without
> using something unavailable on squeeze.

Would You accept this conditional version attached?

-- 
Marcin Szewczyk                       http://wodny.org
mailto:marcin.szewc...@wodny.borg  <- remove b / usuń b
xmpp:wo...@ubuntu.pl                  xmpp:wo...@jabster.pl
>From a8c3e95686a95dd4c1d2831e2e45ff89a3891814 Mon Sep 17 00:00:00 2001
From: Marcin Szewczyk <marcin.szewc...@wodny.org>
Date: Mon, 14 May 2012 12:41:03 +0200
Subject: [PATCH] Conditional findmnt to find extlinux block device

---
 debian/extlinux.postinst |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/debian/extlinux.postinst b/debian/extlinux.postinst
index b09f61b..2f38913 100644
--- a/debian/extlinux.postinst
+++ b/debian/extlinux.postinst
@@ -15,7 +15,20 @@ case "${1}" in
 			true)
 				extlinux-update
 
-				_DEVICE="$(df -P /boot/extlinux | tail -1 | awk '{ print $1 }' | sed -e 's|[0-9]||g')"
+				_FINDMNT=$(which findmnt) || true
+				_PATH=/boot/extlinux
+				_DEVICE=
+
+				if [ -n "${_FINDMNT}" ]; then
+					while true; do
+						_DEVICE="$("${_FINDMNT}" -n --raw -c -o SOURCE "${_PATH}/" | sed -e 's|[0-9]||g')"
+						[ -n "${_DEVICE}" ] && break
+						[ -z "${_PATH}" ] && break
+						_PATH=${_PATH%/*}
+					done
+				else
+					_DEVICE="$(df -P "${_PATH}" | tail -1 | awk '{ print $1 }' | sed -e 's|[0-9]||g')"
+				fi
 
 				extlinux-install "${_DEVICE}"
 				;;
-- 
1.7.10

Reply via email to