From e9e26c8397ae352ba4fb0ff1bf0f563d0aa27503 Mon Sep 17 00:00:00 2001 From: Adam Boardman Date: Wed, 6 Jan 2021 20:06:50 +0000 Subject: [PATCH] Add parent process id propergation to find desired environment variable --- debian/postinst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/debian/postinst b/debian/postinst index 78925bd..b8481f2 100755 --- a/debian/postinst +++ b/debian/postinst @@ -30,7 +30,12 @@ then fi if [ "$device" == unknown ]; then - device=$TARGET_DEVICE + pid=$$ + while [ "$device" == unknown -a $pid != 1 ]; do + env=`strings /proc/$pid/environ` + device=`echo "$env"|awk -F= '$1 == "TARGET_DEVICE" { print $2; }'` + pid=`ps -oppid -p$pid|tail -1|awk '{print $1}'` + done fi [ -e /lib/udev/rules.d/80-keyboard.rules ] || \