From patchwork Thu Jun 3 13:05:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 1487234 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FwmNf2wbRz9s1l; Thu, 3 Jun 2021 23:05:54 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lon2j-0005VY-PF; Thu, 03 Jun 2021 13:05:49 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lon2M-0005Lt-Hk for kernel-team@lists.ubuntu.com; Thu, 03 Jun 2021 13:05:26 +0000 Received: from mail-oo1-f72.google.com ([209.85.161.72]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lon2M-00053F-AE for kernel-team@lists.ubuntu.com; Thu, 03 Jun 2021 13:05:26 +0000 Received: by mail-oo1-f72.google.com with SMTP id r4-20020a4ab5040000b02902446eb55473so3504771ooo.20 for ; Thu, 03 Jun 2021 06:05:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wkpMnIR8yLhJsho/9T7S4kf4zNM1dQ5ACgEy4j+w/Nk=; b=t07eeQQF3WrxAQatr+pOFg81drj/AByLjoh54pcz5dWMXsMBThN05Y+YL+9cbly54J 6TH7LwPRhcD/NSXnA8Dum0Ud94avdqTbevPJTbzy09QZqW1UaiAaXxST70047CuRzCNa MAVCnUPLTrqkDAu88iDLoq9g6+KHJBkaIjHLwOjpEuXO1CYzGZC4xU8ZaFj0/0yyjrrZ 7v4PFWfcWZsVTXhmwJVR8TJEDXHiU+w1lAY5KzVA83/J8p02aXx964lrDTpcmUkwrPaO FRaC2W76lTMeBQYPxKVakmDSyC23QsONhePEHJ0EZEqOIj/5bC/hSNAqxOpUmgmJePvp pVPQ== X-Gm-Message-State: AOAM530FOulMMNCygsEMEDQ5vrBZq3xbmVLG1r4zYuPIAE5UpxKtB1LT CIisvLwBTtHT4DdTuzwXVyNuJaAh8ACZRVfBaZupEXk3cgBgyBPJzhhVxZTEEMmTeX+CC8G06FO KrtWSysRUheRuLi87GJZ6hpgwEIrMu2WEZOEWGdor3w== X-Received: by 2002:a54:458b:: with SMTP id z11mr7441523oib.61.1622725525348; Thu, 03 Jun 2021 06:05:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyP0HxPJbD1CXog6ggiRYFcp7ZU2CTUgPeaU0bvQxU/1gdqUyX4vmkGy2LZMZFaWizwf1uqaA== X-Received: by 2002:a54:458b:: with SMTP id z11mr7441501oib.61.1622725525084; Thu, 03 Jun 2021 06:05:25 -0700 (PDT) Received: from localhost ([2605:a601:ac0f:820:29e1:1d7b:726b:70cd]) by smtp.gmail.com with ESMTPSA id r7sm615794oom.46.2021.06.03.06.05.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 06:05:24 -0700 (PDT) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH 4/6][Unstable] UBUNTU: [Debian] dkms-build -- use fakeroot if not running as root Date: Thu, 3 Jun 2021 08:05:14 -0500 Message-Id: <20210603130516.632208-5-seth.forshee@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210603130516.632208-1-seth.forshee@canonical.com> References: <20210603130516.632208-1-seth.forshee@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1930713 Some dkms builds require running as root, or at least the illusion of doing so. However we need to do dkms builds before deleting the flavour build directory in order to sign the modules, and this may happen without fakeroot. Detect whether or not dkms-build has been invoked as root, and if not use fakeroot to do the dkms build. Signed-off-by: Seth Forshee --- debian/scripts/dkms-build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/scripts/dkms-build b/debian/scripts/dkms-build index c1751ffaa016..9d78fc60e63f 100755 --- a/debian/scripts/dkms-build +++ b/debian/scripts/dkms-build @@ -158,8 +158,10 @@ dkms_version=$( sed -ne 's/PACKAGE_VERSION="\(.*\)"/\1/p' "$dkms_conf" ) # Build the DKMS binaries. echo "II: dkms-build building $package" +fakeroot="" +[[ $EUID -ne 0 ]] && fakeroot="/usr/bin/fakeroot" rc=0 -/usr/sbin/dkms build --no-prepare-kernel --no-clean-kernel \ +$fakeroot /usr/sbin/dkms build --no-prepare-kernel --no-clean-kernel \ -k "$abi_flavour" \ --sourcetree "$dkms_dir/source" \ --dkmstree "$dkms_dir/build" \