[RFC PATCH 4/8] utils/pb-exec: Prepend sudo if normal user
Samuel Mendoza-Jonas
sam at mendozajonas.com
Tue Dec 18 15:19:49 AEDT 2018
Signed-off-by: Samuel Mendoza-Jonas <sam at mendozajonas.com>
---
utils/pb-exec | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/utils/pb-exec b/utils/pb-exec
index bfe13f6b..c5cc8d10 100755
--- a/utils/pb-exec
+++ b/utils/pb-exec
@@ -1,7 +1,13 @@
#!/bin/sh
+if [[ "$(id -u)" != "0" ]]; then
+ PREFIX="sudo"
+else
+ PREFIX=""
+fi
+
# Run a program specified by Petitboot.
-$@
+$PREFIX $@
echo "$0 ran '$@'"
# Wait for the user to exit back to Petitboot.
--
2.20.0
More information about the Petitboot
mailing list