From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D147122318 for ; Wed, 8 May 2024 06:50:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715151042; cv=none; b=fYXl/1kspQfRPXCqU7VYsDnveiTyI9vgGisJthMpfV8/Ga0CH5tmVBU8y7pWkueQ9WWIs1F0HIeFltLmLwzjq0mUrALyi3SdcENCzvJYE2WFfALCg3ecmBclxlaxoyBQbjnJn4xB2zw/xrjVJcaemO6wmoEHB4OY/WzHW0BEb1M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715151042; c=relaxed/simple; bh=XM/m7GjpnhNKhm2T6ooLuC+UFifqzYUFkf+9aHMZdso=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EoNhWCvs9GsG7qaMBqhmK4tF8Cn3RcK7lAcrXKrvLIAVCaBLW7WtcgolBkrGjhvBUL6KfL7Vw0A4Ye4UTN00F734on95AcQlh6sUALr0T5LOMXhNZu9wwyfbvLf6mp2OlEmIXpkJ4h7VvQV11fBagqui5mmLaSbvF9ZIwFPf9U8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=e5tT4SJo; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="e5tT4SJo" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=J+PbBgZoSVL4fHu126xU7m5H/lF3y66Gon7+rffTcZs=; b=e5tT4SJo6uxc50ih+BFI9kPMgZ D4TNnqCYnXPXtHxYZZ9B28kKfwlLimFMYeqHSlC5GrDoznK18HncJoj2dv7pJlJvGtic7arFMBhoK bI81zkMf/9Q4ht7h1muGNkVYZ74ONJ77Qv4Mzcvrq4Bjw7N61t+p72sEoMdkSVDsySiPiJs79Vv0A 8JE2W6QYHfnYnE+9x8PU4sABd37W3hIHP+ep1WHcm+aqmw5OkuFjlz9t19WxNTD3lir3T6mOn2uRV RMc6UsWx0BE+dbcge1wiaQfAuKHCDmNOmi0Yi68+PopIveOOm43Llg50CHKT/kpoku289wZGVQg5L B+k3yuFw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4b8S-0000000EIka-1Bbo; Wed, 08 May 2024 06:50:40 +0000 From: Luis Chamberlain To: kdevops@lists.linux.dev Cc: mcgrof@kernel.org Subject: [PATCH 07/10] guestfs: move rhel activation to its own helper Date: Tue, 7 May 2024 23:50:35 -0700 Message-ID: <20240508065039.3408637-8-mcgrof@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240508065039.3408637-1-mcgrof@kernel.org> References: <20240508065039.3408637-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain The cmdfile stuff is an eye-sore, move users of that stuff which depend on its own kconfig to its own function to make the main part of the functionality easier to read. No functional changes. Signed-off-by: Luis Chamberlain --- scripts/bringup_guestfs.sh | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/scripts/bringup_guestfs.sh b/scripts/bringup_guestfs.sh index c410d0cf725d..2102fd81cf31 100755 --- a/scripts/bringup_guestfs.sh +++ b/scripts/bringup_guestfs.sh @@ -156,6 +156,23 @@ build_custom_image() # just build $virt-builder, which is the pristine upstream image. } +handle_rhel_activation() +{ + if [ -n "$CONFIG_RHEL_ORG_ID" -a -n "$CONFIG_RHEL_ACTIVATION_KEY" ]; then + DO_UNREG=1 + cat <<_EOT >>$cmdfile +run-command subscription-manager register --org=${CONFIG_RHEL_ORG_ID} --activationkey=${CONFIG_RHEL_ACTIVATION_KEY} +_EOT + fi +} + +handle_rhel_unreg() +{ + cat <<_EOT >>$cmdfile +sm-unregister +_EOT +} + copy_host_sources() { TARGET_DIR="$(dirname $CONFIG_GUESTFS_DISTRO_SOURCE_AND_DEST_FILE)" @@ -183,12 +200,7 @@ if [ ! -f $BASE_IMAGE ]; then DO_UNREG=0 if echo $OS_VERSION | grep -q '^rhel'; then - if [ -n "$CONFIG_RHEL_ORG_ID" -a -n "$CONFIG_RHEL_ACTIVATION_KEY" ]; then - DO_UNREG=1 - cat <<_EOT >>$cmdfile -run-command subscription-manager register --org=${CONFIG_RHEL_ORG_ID} --activationkey=${CONFIG_RHEL_ACTIVATION_KEY} -_EOT - fi + handle_rhel_activation fi if [ -n "$CONFIG_KDEVOPS_CUSTOM_YUM_REPOFILE" ]; then @@ -212,9 +224,7 @@ root-password password:kdevops _EOT if [ $DO_UNREG -ne 0 ]; then - cat <<_EOT >>$cmdfile -sm-unregister -_EOT + handle_rhel_unreg fi # Ugh, debian has to be told to bring up the network and regenerate ssh keys -- 2.43.0