From patchwork Mon Mar 13 00:49:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew DeVault X-Patchwork-Id: 64 Return-Path: Delivered-To: patchwork@archlinux.org Received: from nymeria.archlinux.org by nymeria.archlinux.org (Dovecot) with LMTP id 4h7vMaXsxViDZwAAtiB/HQ for ; Mon, 13 Mar 2017 01:49:41 +0100 Received: from nymeria.archlinux.org (localhost.localdomain [127.0.0.1]) by nymeria.archlinux.org (Postfix) with ESMTP id 92B09401F5; Mon, 13 Mar 2017 01:49:40 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on nymeria.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.5 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID shortcircuit=no autolearn=unavailable autolearn_force=no version=3.4.1 Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by nymeria.archlinux.org (Postfix) with ESMTPS; Mon, 13 Mar 2017 01:49:40 +0100 (CET) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 58A092B535; Mon, 13 Mar 2017 00:49:40 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=cmpwn.com header.i=@cmpwn.com header.b=tBBaceLU Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id EECB52B4F5 for ; Mon, 13 Mar 2017 00:49:38 +0000 (UTC) Received: from nymeria.archlinux.org (nymeria.archlinux.org [89.238.67.251]) by luna.archlinux.org (Postfix) with ESMTPS for ; Mon, 13 Mar 2017 00:49:38 +0000 (UTC) Received: from nymeria.archlinux.org (localhost.localdomain [127.0.0.1]) by nymeria.archlinux.org (Postfix) with ESMTP id 8E874401F5 for ; Mon, 13 Mar 2017 01:49:37 +0100 (CET) Received: from mail.cmpwn.com (mail.cmpwn.com [45.56.77.53]) by nymeria.archlinux.org (Postfix) with ESMTP for ; Mon, 13 Mar 2017 01:49:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cmpwn.com; s=cmpwn; t=1489366200; bh=MT4foujytI4S9iJAgoQg2ysqOtHPvkVWqLVyA0/KVcQ=; h=Date:From:To:Subject; b=tBBaceLUzLZIjQkItRvN5TrMNzSqsr/+Tj+DHb3X1Jy5xerHJVsH5SFZYbmTY8yBM 3AaIws79Ztnd2opv/7xf/j2w22s31Cer5XviOWa97gyi44+TP1C3JyWZdgzKuasgoS eZaj0+MHUcdnknAu3iBx7Cy9qTHgGFtMLBVKt1vU= Date: Sun, 12 Mar 2017 20:49:34 -0400 From: Drew DeVault To: pacman-dev@archlinux.org Message-ID: <20170313004934.GA30118@homura> MIME-Version: 1.0 Content-Disposition: inline Subject: [pacman-dev] [PATCH] Add --with-sudo configure option X-BeenThere: pacman-dev@archlinux.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussion list for pacman development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Discussion list for pacman development Errors-To: pacman-dev-bounces@archlinux.org Sender: "pacman-dev" X-UID: 173 Status: X-Keywords: Content-Length: 2845 Allows you to specify an alternate command for running things as root, such as OpenBSD's doas. Signed-off-by: Drew DeVault --- configure.ac | 9 +++++++++ scripts/Makefile.am | 1 + scripts/makepkg.sh.in | 8 ++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 10e4415c..825b29b9 100644 --- a/configure.ac +++ b/configure.ac @@ -114,6 +114,12 @@ AC_ARG_WITH(scriptlet-shell, [set the full path to the shell used to run install scriptlets]), [SCRIPTLET_SHELL=$withval], [SCRIPTLET_SHELL=/bin/sh]) +# Help line for changing sudo command +AC_ARG_WITH(sudo, + AS_HELP_STRING([--with-sudo=sudo], + [set the command used to run pacman as root]), + [SUDOCMD=$withval], [SUDOCMD=sudo]) + # Help line for ldconfig path AC_ARG_WITH(ldconfig, AS_HELP_STRING([--with-ldconfig=path], @@ -509,6 +515,9 @@ AC_DEFINE_UNQUOTED([TEMPLATE_DIR], "$TEMPLATE_DIR", [The template directory used # Set makepkg split debugging symbol package suffix AC_SUBST(DEBUGSUFFIX) AC_DEFINE_UNQUOTED([DEBUGSUFFIX], "$DEBUGSUFFIX", [The suffix for debugging symbol packages used by makepkg]) +# Set sudo command +AC_SUBST(SUDOCMD) +AC_DEFINE_UNQUOTED([SUDOCMD], "$SUDOCMD", [The command used to run pacman as root]) # Set shell used by install scriptlets AC_SUBST(SCRIPTLET_SHELL) AC_DEFINE_UNQUOTED([SCRIPTLET_SHELL], "$SCRIPTLET_SHELL", [The full path of the shell used to run install scriptlets]) diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 4bb08a24..ccfe7384 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -148,6 +148,7 @@ edit = sed \ -e 's|@BUILDSCRIPT[@]|$(BUILDSCRIPT)|g' \ -e 's|@TEMPLATE_DIR[@]|$(TEMPLATE_DIR)|g' \ -e 's|@DEBUGSUFFIX[@]|$(DEBUGSUFFIX)|g' \ + -e 's|@SUDOCMD[@]|$(SUDOCMD)|g' \ -e "s|@INODECMD[@]|$(INODECMD)|g" \ -e "s|@OWNERCMD[@]|$(OWNERCMD)|g" \ -e "s|@MODECMD[@]|$(MODECMD)|g" \ diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 29408929..5128216a 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -212,8 +212,8 @@ run_pacman() { cmd=("$PACMAN_PATH" "$@") fi if [[ $1 != -@(T|Qq|Q) ]]; then - if type -p sudo >/dev/null; then - cmd=(sudo "${cmd[@]}") + if type -p @SUDOCMD@ >/dev/null; then + cmd=(@SUDOCMD@ "${cmd[@]}") else cmd=(su root -c "$(printf '%q ' "${cmd[@]}")") fi @@ -1015,8 +1015,8 @@ check_software() { # check for sudo if we will need it during makepkg execution if (( DEP_BIN || RMDEPS || INSTALL )); then - if ! type -p sudo >/dev/null; then - warning "$(gettext "Cannot find the %s binary. Will use %s to acquire root privileges.")" "sudo" "su" + if ! type -p @SUDOCMD@ >/dev/null; then + warning "$(gettext "Cannot find the %s binary. Will use %s to acquire root privileges.")" "@SUDOCMD@" "su" fi fi