From patchwork Wed Feb 15 04:35:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 728045 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vNRLS6QDpz9s2P for ; Wed, 15 Feb 2017 15:36:00 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="gfaGtdeL"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vNRLS53fLzDqCc for ; Wed, 15 Feb 2017 15:36:00 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="gfaGtdeL"; dkim-atps=neutral X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Received: from mendozajonas.com (mendozajonas.com [188.166.185.233]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3vNRLK0QDPzDqBm for ; Wed, 15 Feb 2017 15:35:53 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="gfaGtdeL"; dkim-atps=neutral Received: from skellige.ozlabs.ibm.com (unknown [122.99.82.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: sam@mendozajonas.com) by mendozajonas.com (Postfix) with ESMTPSA id 5AA46143FE2; Wed, 15 Feb 2017 12:35:50 +0800 (SGT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mendozajonas.com; s=mail; t=1487133350; bh=juPuMBEdqf0hl/Hvl/N33rsqWYbMvK6OiFD7h9mHAiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gfaGtdeLPyq4Z5q+Qe5ZPcuk/xJBKMzslW9jCSj5ntB4p4E32KLRD3Gvzgl2akhj4 oSAv3alTrksl3Yv2LgwJrUBEa6jEwWekco7cy0dRej43q99TyR4tL6VGwUxgDhKbS2 ft6AdK4UI2C9hIulhXCpsB0ka9U6y0ZVOCBkta/c= From: Samuel Mendoza-Jonas To: petitboot@lists.ozlabs.org Subject: [RFC PATCH 4/9] utils: Add pb-exec wrapper Date: Wed, 15 Feb 2017 15:35:36 +1100 Message-Id: <20170215043541.10204-4-sam@mendozajonas.com> X-Mailer: git-send-email 2.11.1 In-Reply-To: <20170215043541.10204-1-sam@mendozajonas.com> References: <20170215043541.10204-1-sam@mendozajonas.com> X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Mendoza-Jonas MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" 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 --- configure.ac | 1 + lib/system/system.c | 1 + lib/system/system.h | 1 + utils/Makefile.am | 2 +- utils/pb-exec | 15 +++++++++++++++ 5 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 utils/pb-exec diff --git a/configure.ac b/configure.ac index 408bd90..dcfdb04 100644 --- a/configure.ac +++ b/configure.ac @@ -333,6 +333,7 @@ DEFINE_HOST_PROG(WGET, wget, [/usr/bin/wget]) DEFINE_HOST_PROG(IP, ip, [/sbin/ip]) DEFINE_HOST_PROG(UDHCPC, udhcpc, [/sbin/udhcpc]) DEFINE_HOST_PROG(PB_PLUGIN, pb-plugin, [/usr/sbin/pb-plugin]) +DEFINE_HOST_PROG(PB_EXEC, pb-exec, [/usr/sbin/pb-exec]) AC_ARG_WITH( [tftp], diff --git a/lib/system/system.c b/lib/system/system.c index b04ebd4..f702bf8 100644 --- a/lib/system/system.c +++ b/lib/system/system.c @@ -29,6 +29,7 @@ const struct pb_system_apps pb_system_apps = { .ip = HOST_PROG_IP, .udhcpc = HOST_PROG_UDHCPC, .pb_plugin = HOST_PROG_PB_PLUGIN, + .pb_exec = HOST_PROG_PB_EXEC, }; #ifndef TFTP_TYPE diff --git a/lib/system/system.h b/lib/system/system.h index e50302a..1143e36 100644 --- a/lib/system/system.h +++ b/lib/system/system.h @@ -14,6 +14,7 @@ struct pb_system_apps { const char *ip; const char *udhcpc; const char *pb_plugin; + const char *pb_exec; }; extern const struct pb_system_apps pb_system_apps; diff --git a/utils/Makefile.am b/utils/Makefile.am index 6c708eb..3ef3fe8 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -12,7 +12,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -dist_sbin_SCRIPTS += utils/pb-udhcpc utils/pb-plugin utils/pb-sos +dist_sbin_SCRIPTS += utils/pb-udhcpc utils/pb-plugin utils/pb-sos utils/pb-exec dist_pkglibexec_SCRIPTS = utils/pb-console sbin_PROGRAMS += utils/pb-event utils/pb-config diff --git a/utils/pb-exec b/utils/pb-exec new file mode 100755 index 0000000..f770afc --- /dev/null +++ b/utils/pb-exec @@ -0,0 +1,15 @@ +#!/bin/sh + +# Run a program specified by Petitboot. Assume for now this is a single program +# with no arguments. +$1 + +# Wait for the user to exit back to Petitboot. +while :; do + read -r -p "Press ENTER to return to Petitboot" key + + if [ "$key" == "" ]; then + echo "Returning to Petitboot.." + exit 0 + fi +done