From patchwork Fri Jun 4 02:47:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 1487549 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 4Fx6cn3h8kz9sRf; Fri, 4 Jun 2021 12:47:37 +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 1lozrx-00036h-8w; Fri, 04 Jun 2021 02:47:33 +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 1lozrr-00033K-36 for kernel-team@lists.ubuntu.com; Fri, 04 Jun 2021 02:47:27 +0000 Received: from mail-ot1-f71.google.com ([209.85.210.71]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lozrq-000621-Pm for kernel-team@lists.ubuntu.com; Fri, 04 Jun 2021 02:47:26 +0000 Received: by mail-ot1-f71.google.com with SMTP id p4-20020a9d45440000b02903cf162bb628so1978871oti.17 for ; Thu, 03 Jun 2021 19:47: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=IYely9y2Iu1oxfNcetlxqdP7eaW0nN6EkZ0ZffJhKvT/SN2CU/wlTyqFxDFZqtZ/9d kforouZ9lN0Q3Rx/5D6zq2E/YU4gNEfDpwZymeosEklx4WN1c+DT9RRg/mU4R8GYMw62 BRdzahZUSD4aDeNRmDucB2GEQLOKWqtUrzC8NyuCq4lFpG4pPOnoXrHQUZfFmRNSrf52 j+WgkDKp07gqJ7fhhSnjkFoMOt1oydzyrJJkIe01LOVKsoRVRMO/tPFhjhFW961J63dT Hp2llKhwd/Z+eOu3nW5iRc2IPHrC3pkLElEUuq/T0g3zRZc7CloRuUa9/ITufmoX+LyQ bicQ== X-Gm-Message-State: AOAM53197aSM2MXTD6+6fH4+O/mEHQqjh8d3YhjykAtC73vlEWpAzhbh H6gKzQ96LlOYkD3O4vPPjyi1RzIRErh545XsZa2druLmQ7BH3nUKwsL7ApSckaaEPTF/Cdodzt7 VUCmm+lLiJcmNlP3dzPYT/JatqXKXCBYMvRMjYFN73g== X-Received: by 2002:a9d:6743:: with SMTP id w3mr1933559otm.82.1622774845796; Thu, 03 Jun 2021 19:47:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHC6Y5Vb0nVrfsku7w6olS9ApKOeamsxTq0cdP6slC3Rzk8ir5n0cOyk9EnR/7LtkgiPQNZw== X-Received: by 2002:a9d:6743:: with SMTP id w3mr1933554otm.82.1622774845558; Thu, 03 Jun 2021 19:47:25 -0700 (PDT) Received: from localhost ([2605:a601:ac0f:820:49de:d1a8:57e3:739e]) by smtp.gmail.com with ESMTPSA id x10sm190709otp.39.2021.06.03.19.47.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 19:47:25 -0700 (PDT) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 4/6][Unstable] UBUNTU: [Debian] dkms-build -- use fakeroot if not running as root Date: Thu, 3 Jun 2021 21:47:17 -0500 Message-Id: <20210604024719.650626-5-seth.forshee@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210604024719.650626-1-seth.forshee@canonical.com> References: <20210604024719.650626-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" \