From patchwork Tue Jul 27 10:07:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 4565 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4GYssp1CNJz3xGv for ; Tue, 27 Jul 2021 10:07:26 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4GYssl13ygz6YM; Tue, 27 Jul 2021 10:07:23 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4GYssk66Fhz2ygf; Tue, 27 Jul 2021 10:07:22 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4GYssj2Y2Yz2y2L for ; Tue, 27 Jul 2021 10:07:21 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4GYssj0vwxz1Tn; Tue, 27 Jul 2021 10:07:21 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1627380441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WNFI/5IcbEqy6RRVWvOOdHheMFgrraFmiyQ08p72+Jg=; b=gHBXbSxhadQSNZ8SpjBwzPv8Bj2l4lhWx8ed776rHLjLqaEQAGJM2N6J3jkCpZd05ctlEE N50qGUeP4PsLMMDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1627380441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WNFI/5IcbEqy6RRVWvOOdHheMFgrraFmiyQ08p72+Jg=; b=jNe5EuysLX3JX3NciO9lSgjJS6CRDBRErDM64/N1EpGy3G1EE+H7h4leJjblcaSZt2J++o yHjxQ8EPv9F4N1SI+CTFoKJB2+5VgikqcG4IxvTstG+dqIWv99t8PS8sbaxg6dm2jOP66x 8tnbt5y5BGZzCR1PkYRBRTqJLmGsp0udewvRVKqQUO14Nj6s2kGaQ6Tt6z0Rn4D7afmdmq pWg42M8dvJdvBxuf8/QPRDDxbxN0TyOv/7jgBBCdcCliNQlb8TDyqFMBt8barOa0j5+eky RVwI5XYMhJ3FblW1CA2M6xRFDxQfFhT1/gzOU8KOEowNztyjAElSI2FyRIOmhw== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 2/4] grub: Add file with cloud helping stuff Date: Tue, 27 Jul 2021 10:07:08 +0000 Message-Id: <20210727100710.5331-2-michael.tremer@ipfire.org> In-Reply-To: <20210727100710.5331-1-michael.tremer@ipfire.org> References: <20210727100710.5331-1-michael.tremer@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This file will detect whether to do certain actions depending on the environment it is running on. Currently this detects whether IPFire is booting up on AWS EC2 and selects the serial console boot entry. Signed-off-by: Michael Tremer --- config/grub2/00_cloud | 26 ++++++++++++++++++++++++++ config/rootfiles/common/aarch64/grub | 1 + config/rootfiles/common/i586/grub | 1 + config/rootfiles/common/x86_64/grub | 1 + lfs/grub | 4 ++++ 5 files changed, 33 insertions(+) create mode 100644 config/grub2/00_cloud diff --git a/config/grub2/00_cloud b/config/grub2/00_cloud new file mode 100644 index 000000000..3f9c5a185 --- /dev/null +++ b/config/grub2/00_cloud @@ -0,0 +1,26 @@ +#!/bin/sh +# This is an IPFire helper script for GRUB to enable the serial console +# on AWS instances at the time of the first boost + +set -e + +# Do nothing if first boot isn't enabled +if [ "${GRUB_FIRST_BOOT}" != "true" ]; then + exit 0 +fi + +. "${pkgdatadir}/grub-mkconfig_lib" + +if [ -z "${boot_device_id}" ]; then + boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" +fi + +cat <