depthcharge-tools: customize tool to be able to work with versionless vmlinuz

This commit is contained in:
Ark74 2025-04-14 01:52:00 -06:00
parent 50fabd3635
commit 5b9d6f0d33
2 changed files with 68 additions and 0 deletions

View file

@ -0,0 +1,39 @@
diff --git a/depthcharge_tools/depthchargectl/_build.py b/depthcharge_tools/depthchargectl/_build.py
index a605b83c..746e8a51 100644
--- a/depthcharge_tools/depthchargectl/_build.py
+++ b/depthcharge_tools/depthchargectl/_build.py
@@ -157,11 +157,12 @@ class depthchargectl_build(
@Argument("--kernel-release", nargs=1)
def kernel_release(self, name=None):
"""Release name for the kernel used in image name"""
- if name is None and self.kernel_version is not None:
- if self.kernel == self.kernel_version.kernel:
- name = self.kernel_version.release
-
- return name
+ # Trisquel customization: skip autodetection and honor empty values.
+ if name is not None:
+ return name
+ if self.kernel_version is not None and self.kernel == self.kernel_version.kernel:
+ return self.kernel_version.release
+ return ""
@custom_kernel_options.add
@Argument("--kernel", nargs=1)
diff --git a/depthcharge_tools/depthchargectl/_build.py b/depthcharge_tools/depthchargectl/_build.py
index 746e8a51..45e0c02c 100644
--- a/depthcharge_tools/depthchargectl/_build.py
+++ b/depthcharge_tools/depthchargectl/_build.py
@@ -82,6 +82,12 @@ class depthchargectl_build(
@Argument
def kernel_version(self, kernel_version=None):
"""Installed kernel version to build an image for."""
+
+ # Trisquel customization: If --kernel is set but --kernel-version is
+ # not, skip autodetection and return None early
+ if kernel_version is None and self.kernel is not None:
+ return None
+
if isinstance(kernel_version, KernelEntry):
return kernel_version

View file

@ -0,0 +1,29 @@
#!/bin/sh
#
# Copyright (C) 2025 Luis Guzmán <ark@switnet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
#STAGE-4-UDEBS-DEBIAN-INSTALLER
VERSION=1
NETINST=true
. ./config
apply_patch_changes
changelog "Patch kernel discovery to match version-less vmlinuz in Ecne for debian-installer."
package