From patchwork Tue Dec 18 04:19:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 1014977 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JlFj3JCBz9sBZ for ; Tue, 18 Dec 2018 15:21:13 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="vtiMWUks"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="fp+H0M9e"; 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 43JlFj0BT2zDqQB for ; Tue, 18 Dec 2018 15:21:13 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="vtiMWUks"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="fp+H0M9e"; dkim-atps=neutral X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mendozajonas.com (client-ip=66.111.4.25; helo=out1-smtp.messagingengine.com; envelope-from=sam@mendozajonas.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="vtiMWUks"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="fp+H0M9e"; dkim-atps=neutral Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 43JlDX2ZLLzDqWm for ; Tue, 18 Dec 2018 15:20:12 +1100 (AEDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id E4A9C22B97; Mon, 17 Dec 2018 23:20:09 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 17 Dec 2018 23:20:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= mendozajonas.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=fm1; bh=aArxCSxW8ayr4R1BDu3ijnovRKLPMYJYgTCWlT6bF0I=; b=vtiMW UksCLbHSQnG5/67SxQ5k6zLQMF8GjFBc6cK+WzvMEC0YB/vGakHZJRJy+3X7aQoG c3LvguD0IndQpUr2ksRgmNjPzsqI5JYXEuleZgRzvPQj3s9MMB670nJuEMKmCila M6Q8rJQReuQhQywqycuOsQMq00VS1JvW73jC+Bg9HregZmqCWVBQV2520gK2H5O3 Tu7C6AF281Oj2mTyN8a5mgiQbV5vF6vt8jfa1a5jtITmjxIL9h4DEW/0I+0cDhKK yx5ggmuO6tMbH3UoE9Yiq4EwDH9Flmnti2szBhCxhngh5FX1p13R502IDXh/GHfl ZljB8nPnhMC1sVOsg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=aArxCSxW8ayr4R1BDu3ijnovRKLPMYJYgTCWlT6bF0I=; b=fp+H0M9e aa+Si/rnj3wGgvBdoSl2F2970n7lL0rc02ZHNrD+TyZSJjPjibQ42O0pXhAM+h0P Ko4NnimrXQtH8stxhKOwOPMYHaTJ/c1LUfqZ3eijc/WeuqBIyqGEklnBQSoZ6BmQ oV/B3jGDcBzjDcuyVK9Dki3hiG15d7xkdcU8KPwx53DvHpwUDpP+dce5GGHphffj qi3Wudfue6seFdNqhdgbyUTLlt1NCn4ffuL9LEuiMO3f/vlHV1ZUbaX1t0z929wf QgNIdCwE0MfUXDGZnfNLJruJkhP+iTZN0SUu7jEv1khXqBsXvUQltzsyxzQB3jgK H43NVrvNRJp3/Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtkedrudeigedgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpe furghmuhgvlhcuofgvnhguohiirgdqlfhonhgrshcuoehsrghmsehmvghnughoiigrjhho nhgrshdrtghomheqnecukfhppeduvddvrdelledrkedvrddutdenucfrrghrrghmpehmrg hilhhfrhhomhepshgrmhesmhgvnhguohiirghjohhnrghsrdgtohhmnecuvehluhhsthgv rhfuihiivgeptd X-ME-Proxy: Received: from v4.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id 6BC81100E5; Mon, 17 Dec 2018 23:20:08 -0500 (EST) From: Samuel Mendoza-Jonas To: petitboot@lists.ozlabs.org Subject: [RFC PATCH 4/8] utils/pb-exec: Prepend sudo if normal user Date: Tue, 18 Dec 2018 15:19:49 +1100 Message-Id: <20181218041953.8960-5-sam@mendozajonas.com> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181218041953.8960-1-sam@mendozajonas.com> References: <20181218041953.8960-1-sam@mendozajonas.com> MIME-Version: 1.0 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Mendoza-Jonas Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" Signed-off-by: Samuel Mendoza-Jonas --- 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.