public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Andreas K. Hüttel" <dilfridge@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/targets/
Date: Sun, 13 Oct 2024 20:33:50 +0000 (UTC)	[thread overview]
Message-ID: <1728851452.f23f553a565fbb22d25b52ef6e0bdc867a9323f2.dilfridge@gentoo> (raw)

commit:     f23f553a565fbb22d25b52ef6e0bdc867a9323f2
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 13 14:43:30 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct 13 20:30:52 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=f23f553a

Add diskimage_stage2.py with parameters and sequence different from iso

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/targets/diskimage_stage2.py | 114 +++++++++++++++++++++++++++++++++++
 1 file changed, 114 insertions(+)

diff --git a/catalyst/targets/diskimage_stage2.py b/catalyst/targets/diskimage_stage2.py
new file mode 100644
index 00000000..bcad8b0d
--- /dev/null
+++ b/catalyst/targets/diskimage_stage2.py
@@ -0,0 +1,114 @@
+"""
+Disk image stage2 target, builds upon previous disk image stage1 tarball
+"""
+# NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
+
+from catalyst.support import (normpath, file_locate, CatalystError)
+from catalyst.fileops import clear_dir
+from catalyst.base.stagebase import StageBase
+
+
+class diskimage_stage2(StageBase):
+    """
+    Builder class for a disk image stage2 build.
+    """
+    required_values = frozenset([
+        "boot/kernel",
+    ])
+    valid_values = required_values | frozenset([
+        "diskimage/bootargs",
+        "diskimage/depclean",
+        "diskimage/empty",
+        "diskimage/fsops",
+        "diskimage/fsscript",
+        "diskimage/gk_mainargs",
+        "diskimage/modblacklist",
+        "diskimage/motd",
+        "diskimage/qcow2",
+        "diskimage/qcow2_size",
+        "diskimage/qcow2_efisize",
+        "diskimage/qcow2_roottype",
+        "diskimage/rcadd",
+        "diskimage/rcdel",
+        "diskimage/readme",
+        "diskimage/rm",
+        "diskimage/type",		# generic, cloud-init, ssh, console
+        "diskimage/unmerge",
+        "diskimage/users",
+        "diskimage/verify",
+        "diskimage/volid",
+        "repos",
+    ])
+
+# Types of bootable disk images planned for (diskimage/type):
+# cloud-init - an image that starts cloud-init for configuration and then can be
+#              used out of the box
+# console    - an image that has an empty root password and allows passwordless
+#              login on the console only
+# ssh        - an image that populates /root/.ssh/authorized_keys and starts dhcp
+#              as well as sshd; obviously not fit for public distribution
+# generic    - an image with no means of logging in... needs postprocessing
+#              no services are started
+
+    def __init__(self, spec, addlargs):
+        StageBase.__init__(self, spec, addlargs)
+        if "diskimage/type" not in self.settings:
+            self.settings["diskimage/type"] = "generic"
+
+        file_locate(self.settings, ["controller_file"])
+
+    def set_spec_prefix(self):
+        self.settings["spec_prefix"] = "diskimage"
+
+    def set_target_path(self):
+        '''Set the target path for the finished stage.
+
+        This method runs the StageBase.set_target_path mehtod,
+        and additionally creates a staging directory for assembling
+        the final components needed to produce the iso image.
+        '''
+        super(diskimage_stage2, self).set_target_path()
+        clear_dir(self.settings['target_path'])
+
+    def run_local(self):
+        # what modules do we want to blacklist?
+        if "diskimage/modblacklist" in self.settings:
+            path = normpath(self.settings["chroot_path"] +
+                            "/etc/modprobe.d/blacklist.conf")
+            try:
+                with open(path, "a") as myf:
+                    myf.write("\n#Added by Catalyst:")
+                    # workaround until config.py is using configparser
+                    if isinstance(self.settings["diskimage/modblacklist"], str):
+                        self.settings["diskimage/modblacklist"] = self.settings[
+                            "diskimage/modblacklist"].split()
+                    for x in self.settings["diskimage/modblacklist"]:
+                        myf.write("\nblacklist "+x)
+            except Exception as e:
+                raise CatalystError("Couldn't open " +
+                                    self.settings["chroot_path"] +
+                                    "/etc/modprobe.d/blacklist.conf.",
+                                    print_traceback=True) from e
+
+    def set_action_sequence(self):
+        self.build_sequence.extend([
+            self.run_local,
+            self.build_kernel
+        ])
+        if "fetch" not in self.settings["options"]:
+            self.build_sequence.extend([
+                self.preclean,
+                self.diskimage_update,
+                self.fsscript,
+                self.rcupdate,
+                self.unmerge,
+            ])
+            self.finish_sequence.extend([
+                self.remove,
+                self.empty,
+                self.clean,
+                self.create_qcow2,
+            ])
+        self.set_completion_action_sequences()
+        # our output is the qcow2, not a stage archive
+        self.finish_sequence.remove(self.capture)


             reply	other threads:[~2024-10-13 20:33 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-13 20:33 Andreas K. Hüttel [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-10-13 20:33 [gentoo-commits] proj/catalyst:master commit in: catalyst/targets/ Andreas K. Hüttel
2024-08-03 11:01 Andreas K. Hüttel
2024-08-03  9:06 Andreas K. Hüttel
2024-07-30 15:29 Andreas K. Hüttel
2024-07-30 15:28 Andreas K. Hüttel
2024-07-30 14:54 Andreas K. Hüttel
2024-07-30 14:45 Andreas K. Hüttel
2024-07-30 11:06 Andreas K. Hüttel
2024-07-30 11:06 Andreas K. Hüttel
2022-11-20  0:21 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2022-04-02 23:50 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2021-02-21  2:05 Matt Turner
2021-01-18 19:53 [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-12-27 23:15 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2020-10-29 21:00 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-10-24 22:07 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2020-10-24 22:07 Matt Turner
2020-10-23  4:36 [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-10-24 22:07 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2020-06-05 21:13 Matt Turner
2020-06-05 21:13 Matt Turner
2020-05-20  3:39 [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-05-17 22:54 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2020-05-16  6:43 Matt Turner
2020-05-16  6:43 Matt Turner
2019-10-11 16:02 Ben Kohler
2019-07-01 15:35 Rick Farina
2018-10-01 16:30 Brian Dolbec
2018-07-21 18:54 Brian Dolbec
2018-04-05 18:21 Richard Farina
2018-01-04 19:09 Brian Dolbec
2017-12-18 16:57 Richard Farina
2017-11-29 17:20 Brian Dolbec
2016-03-21  5:09 Mike Frysinger
2015-12-23  4:30 Brian Dolbec
2015-12-15 17:13 Brian Dolbec
2015-12-15 17:13 Brian Dolbec
2015-12-15 17:13 Brian Dolbec
2015-12-15 17:13 Brian Dolbec
2015-12-15 17:13 Brian Dolbec
2015-11-12 16:24 Brian Dolbec
2015-10-11 17:26 Mike Frysinger
2015-10-11 17:26 Mike Frysinger
2015-10-11 17:26 Mike Frysinger
2015-10-11 17:26 Mike Frysinger
2015-10-11 17:26 Mike Frysinger
2015-10-11 17:26 Mike Frysinger
2015-10-09 21:06 Mike Frysinger
2015-10-08 22:09 Mike Frysinger
2015-10-08  3:53 Mike Frysinger
2015-10-06 15:31 Mike Frysinger
2015-09-15 21:48 Richard Farina
2015-09-09 17:42 Brian Dolbec
2015-02-26 20:12 Brian Dolbec
2015-02-26 19:25 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-02-26 20:12 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-01-01  5:59 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-02-26 20:12 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-01-01  5:59 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-02-26  4:12 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2014-05-05 19:17 Brian Dolbec
2014-04-02 20:09 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2014-04-02 20:09 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2014-04-02 20:09 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2014-04-02 20:09 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2014-04-02 20:09 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2014-04-02 20:09 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1728851452.f23f553a565fbb22d25b52ef6e0bdc867a9323f2.dilfridge@gentoo \
    --to=dilfridge@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox