From patchwork Wed May 27 07:24:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 22401 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1534227BBE3; Wed, 27 May 2020 08:25:09 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id D998027BBE1 for ; Wed, 27 May 2020 08:25:08 +0100 (BST) Received: from localhost ([::1]:60734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdqR2-0004zT-DP for patchwork@mira.cbaines.net; Wed, 27 May 2020 03:25:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdqQw-0004z6-74 for guix-patches@gnu.org; Wed, 27 May 2020 03:25:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36544) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jdqQv-00019a-UZ for guix-patches@gnu.org; Wed, 27 May 2020 03:25:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jdqQv-0003hd-Q2 for guix-patches@gnu.org; Wed, 27 May 2020 03:25:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41560] [PATCH 2/8] bootloader: grub: Do not run grub-install when creating a disk-image. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 27 May 2020 07:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41560 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41560@debbugs.gnu.org Cc: Mathieu Othacehe Received: via spool by 41560-submit@debbugs.gnu.org id=B41560.159056427814121 (code B ref 41560); Wed, 27 May 2020 07:25:01 +0000 Received: (at 41560) by debbugs.gnu.org; 27 May 2020 07:24:38 +0000 Received: from localhost ([127.0.0.1]:48071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jdqQX-0003ff-Mv for submit@debbugs.gnu.org; Wed, 27 May 2020 03:24:37 -0400 Received: from mail-wr1-f48.google.com ([209.85.221.48]:43544) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jdqQV-0003fC-VQ for 41560@debbugs.gnu.org; Wed, 27 May 2020 03:24:36 -0400 Received: by mail-wr1-f48.google.com with SMTP id l10so173297wrr.10 for <41560@debbugs.gnu.org>; Wed, 27 May 2020 00:24:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BgTj7PTmxxefv/dBu9Fx+q0q6Iir2Cg10K89JY/ujwA=; b=FLGDEtMMh0pAHriIo9xFNavkF9EayV+Kj5pTc6XiDN7Z3TKHFxMbuy4/j9RYSLr7n3 eNhC+25BX1zJCaeU7WCX9Zerue+6QI8f0QqC7wSAwdRBvRJ9ClIXBYn+Zp0REnjR3N8z ZFhusmmCY6X4UHHovFuwf4Tp2yuE8rG+titvqtuRW2CX9vfeRf56fMp4Bpq53Ds2d77m j48Hckqtaqr4Az/ii/O4+jPbVMsEIKQEtNMbYMJ6srqHrt5A23RZxdX52mLrh7eBPhEi T3jeSdKaTDUch8x+IVYC6Kk0c/W5Q2AGC4QkFMLq6q7K6XGvWW88+XwcpTLIITeAko+E BcuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BgTj7PTmxxefv/dBu9Fx+q0q6Iir2Cg10K89JY/ujwA=; b=X14AInjEPReCiHikxCLkNCr+jCfbTMOoalWUUDFyAtDhXZI4LE6oDix9miCdvKfjNH 9GMra1+1U/vOWdCJAWLx20to9jMsGSZDJ4J99XnfQnlSusSZox9qUrHtd1oSHqFEzir7 jHCFa52cbNwMe2YarTTsN/9OoCjv1vq7JcmN0ETLgV7HQhOgjsyBiiWexOZdOgcel4d9 vSxAQDvzalnwSst9xMUEoC3q3n3B89uvphVHB+OQvhMsltX45yejr4L4EycvtnJL2OgV rfOjh6+6s24zpLEjRH/oj/Ga8lO6PcCrIfCrtWLnMSoA59VeZUtXu4ArZS3uum7bU6rD 5qrg== X-Gm-Message-State: AOAM533QqwbwVP2XjjkIgI56E4Q+AumBY84trC6BVJ4L7kYK89iKPKWu qPd889LMyrr6i7NgQDb0h/KgP0CBDsY= X-Google-Smtp-Source: ABdhPJw3dXOkQSbB7J9zb4VdQzt41EUBsPqIj4CVQCrPkV+BR9MzMhTvtD6HeDMP11ECZsYlh5DQLA== X-Received: by 2002:adf:f611:: with SMTP id t17mr12956979wrp.69.1590564270176; Wed, 27 May 2020 00:24:30 -0700 (PDT) Received: from meru.fronius.com ([2a01:e0a:fa:a50:e5a2:3f70:d249:6ce9]) by smtp.gmail.com with ESMTPSA id v28sm2002845wra.77.2020.05.27.00.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 00:24:29 -0700 (PDT) From: Mathieu Othacehe X-Google-Original-From: Mathieu Othacehe Date: Wed, 27 May 2020 09:24:14 +0200 Message-Id: <20200527072420.26140-2-othacehe@gnu.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527072420.26140-1-othacehe@gnu.org> References: <20200527072420.26140-1-othacehe@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/bootloader/grub.scm (install-grub): When creating a disk-image, grub-install will fail because it lacks root permissions. In that case, do not run grub-install and only copy Grub modules to the /boot directory. --- gnu/bootloader/grub.scm | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 74dc00480f..29bec92196 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -423,18 +423,24 @@ fi~%")))) (define install-grub #~(lambda (bootloader device mount-point) - ;; Install GRUB on DEVICE which is mounted at MOUNT-POINT. (let ((grub (string-append bootloader "/sbin/grub-install")) (install-dir (string-append mount-point "/boot"))) - ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or - ;; root partition. - (setenv "GRUB_ENABLE_CRYPTODISK" "y") - - ;; Hide potentially confusing messages from the user, such as - ;; "Installing for i386-pc platform." - (invoke/quiet grub "--no-floppy" "--target=i386-pc" - "--boot-directory" install-dir - device)))) + ;; Install GRUB on DEVICE which is mounted at MOUNT-POINT. If device + ;; is #f we are creating a disk-image. + (if device + (begin + ;; Tell 'grub-install' that there might be a LUKS-encrypted + ;; /boot or root partition. + (setenv "GRUB_ENABLE_CRYPTODISK" "y") + + ;; Hide potentially confusing messages from the user, such as + ;; "Installing for i386-pc platform." + (invoke/quiet grub "--no-floppy" "--target=i386-pc" + "--boot-directory" install-dir + device)) + ;; When creating a disk-image, only install Grub modules. + (copy-recursively (string-append bootloader "/lib/") + install-dir))))) (define install-grub-disk-image #~(lambda (bootloader root-index image)