From 9f15e86afa60f9f29658a3e7f60104a5bc23e86b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Fri, 28 Feb 2014 19:12:47 -0500 Subject: [PATCH] lxc-download: Fix in_userns again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The use of a subshell was causing various failures, re-arrange not to use one. Signed-off-by: Stéphane Graber --- templates/lxc-download.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/templates/lxc-download.in b/templates/lxc-download.in index 6a6bb1857..487383e0a 100644 --- a/templates/lxc-download.in +++ b/templates/lxc-download.in @@ -142,10 +142,11 @@ gpg_validate() { in_userns() { [ -e /proc/self/uid_map ] || { echo no; return; } - awk '{ print $1 " " $2 " " $3 }' /proc/self/uid_map | while read line; do - [ "$line" = "0 0 4294967295" ] && { echo no; return; } || true - echo $line | grep -q " 0 1$" && { echo userns-root; return; } || true - done + while read line; do + fields=$(echo $line | awk '{ print $1 " " $2 " " $3 }') + [ "$fields" = "0 0 4294967295" ] && { echo no; return; } || true + echo $fields | grep -q " 0 1$" && { echo userns-root; return; } || true + done < /proc/self/uid_map [ "$(cat /proc/self/uid_map)" = "$(cat /proc/1/uid_map)" ] && \ { echo userns-root; return; }