From patchwork Fri Jun 23 06:27:00 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: 779804 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 3wv7mQ4dDLz9s7v for ; Fri, 23 Jun 2017 16:27:50 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="u5ovtyxy"; 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 3wv7mQ3NWrzDqjs for ; Fri, 23 Jun 2017 16:27:50 +1000 (AEST) 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="u5ovtyxy"; 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 3wv7m36SxBzDqjN for ; Fri, 23 Jun 2017 16:27:31 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="u5ovtyxy"; dkim-atps=neutral Received: from v4.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 25A631441AA; Fri, 23 Jun 2017 14:27:28 +0800 (SGT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mendozajonas.com; s=mail; t=1498199248; bh=RJIS/k5/BppuJ+65kCX79FsbOb9owTohbRZ30RWqFBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u5ovtyxyQ82YFMCbVc4rHE6i/z+nENBLxcTXYft7J8rVDZEZmuMovcEGdL8W+X0Lv 1g4/nP9oJN0bJSTVwBDjHdrnJk7H72Miy0T9WPQp2YrmuhUML0r7gasDK0ANKSZ7mT 1DgKV92u4loFdicqOFiPC7F6ACsrgx2tQpeLR/Bw= From: Samuel Mendoza-Jonas To: petitboot@lists.ozlabs.org Subject: [PATCH 01/10] utils/pb-plugin: Add non-interactive install Date: Fri, 23 Jun 2017 16:27:00 +1000 Message-Id: <20170623062709.16035-2-sam@mendozajonas.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170623062709.16035-1-sam@mendozajonas.com> References: <20170623062709.16035-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" Allow pb-plugin to install a plugin without user interaction (ie. confirmation), and add it to lib/system so it can be called from within Petitboot. Signed-off-by: Samuel Mendoza-Jonas --- configure.ac | 1 + lib/system/system.c | 1 + lib/system/system.h | 1 + utils/pb-plugin | 30 +++++++++++++++++++----------- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index 8fedbe1..72348d6 100644 --- a/configure.ac +++ b/configure.ac @@ -332,6 +332,7 @@ DEFINE_HOST_PROG(UMOUNT, umount, [/bin/umount]) 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]) AC_ARG_WITH( [tftp], diff --git a/lib/system/system.c b/lib/system/system.c index 917d444..b04ebd4 100644 --- a/lib/system/system.c +++ b/lib/system/system.c @@ -28,6 +28,7 @@ const struct pb_system_apps pb_system_apps = { .wget = HOST_PROG_WGET, .ip = HOST_PROG_IP, .udhcpc = HOST_PROG_UDHCPC, + .pb_plugin = HOST_PROG_PB_PLUGIN, }; #ifndef TFTP_TYPE diff --git a/lib/system/system.h b/lib/system/system.h index ab25101..e50302a 100644 --- a/lib/system/system.h +++ b/lib/system/system.h @@ -13,6 +13,7 @@ struct pb_system_apps { const char *wget; const char *ip; const char *udhcpc; + const char *pb_plugin; }; extern const struct pb_system_apps pb_system_apps; diff --git a/utils/pb-plugin b/utils/pb-plugin index e107f96..1a03f23 100755 --- a/utils/pb-plugin +++ b/utils/pb-plugin @@ -150,7 +150,12 @@ EOF do_install() { - local url name file __dest + local url name file __dest auto + + if [ "$1" == "auto" ]; then + auto=y + shift; + fi url=$1 @@ -186,17 +191,20 @@ do_install() sha256sum "$file" | cut -f1 -d' ' echo - echo "Do you want to install this plugin? (y/N)" - read resp + if [ -z "$auto" ] + then + echo "Do you want to install this plugin? (y/N)" + read resp - case $resp in - [yY]|[yY][eE][sS]) - ;; - *) - echo "Cancelled" - exit 0 - ;; - esac + case $resp in + [yY]|[yY][eE][sS]) + ;; + *) + echo "Cancelled" + exit 0 + ;; + esac + fi __dest=$(mktemp -d) gunzip -c "$file" | ( cd $__dest && cpio -i -d)