[v2,06/12] utils: Add pb-exec wrapper

Submitted by Sam Mendoza-Jonas on July 25, 2017, 6:49 a.m.

Details

Message ID 20170725064910.31478-7-sam@mendozajonas.com
State Accepted
Headers show

Commit Message

Sam Mendoza-Jonas July 25, 2017, 6:49 a.m.
Add a small wrapper script for the Petitboot UI to call interactable
programs with. The wrapper calls the program and waits for user input
before returning to the Petitboot UI.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
---
 utils/pb-exec | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100755 utils/pb-exec

Patch hide | download patch | download mbox

diff --git a/utils/pb-exec b/utils/pb-exec
new file mode 100755
index 0000000..bfe13f6
--- /dev/null
+++ b/utils/pb-exec
@@ -0,0 +1,16 @@ 
+#!/bin/sh
+
+# Run a program specified by Petitboot.
+$@
+echo "$0 ran '$@'"
+
+# Wait for the user to exit back to Petitboot.
+read -n 1 -r -p "Press ENTER to return to Petitboot or any other key to drop to a shell" key
+
+if [ "$key" == "" ]; then
+	echo "Returning to Petitboot.."
+	exit 0
+fi
+
+printf "\nLaunching shell. Type 'exit' to return\n"
+/bin/sh