1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
From 06b74c082a2d031b31929403081c3bde242d98d8 Mon Sep 17 00:00:00 2001
From: yanzhicong <mryanzhicong@163.com>
Date: Tue, 18 Mar 2025 17:37:13 +0800
Subject: [PATCH] adapt to openEuler
---
cobbler/actions/check.py | 2 +-
cobbler/actions/reposync.py | 2 +-
cobbler/autoinstallgen.py | 2 +-
cobbler/tftpgen.py | 9 +++++----
cobbler/utils.py | 3 +++
config/cobbler/distro_signatures.json | 28 +++++++++++++++++++++++++++
distro_build_configs.sh | 5 ++++-
templates/etc/dhcp.template | 2 +-
8 files changed, 44 insertions(+), 9 deletions(-)
diff --git a/cobbler/actions/check.py b/cobbler/actions/check.py
index b79706a..e35b53b 100644
--- a/cobbler/actions/check.py
+++ b/cobbler/actions/check.py
@@ -147,7 +147,7 @@ class CobblerCheck:
if return_code != 0:
status.append("service %s is not running%s" % (which, notes))
return
- elif self.checked_family in ("redhat", "suse"):
+ elif self.checked_family in ("redhat", "suse", "generic_lower_os"):
if os.path.exists("/etc/rc.d/init.d/%s" % which):
return_code = utils.subprocess_call("/sbin/service %s status > /dev/null 2>/dev/null" % which,
shell=True)
diff --git a/cobbler/actions/reposync.py b/cobbler/actions/reposync.py
index c016335..f4f3d49 100644
--- a/cobbler/actions/reposync.py
+++ b/cobbler/actions/reposync.py
@@ -255,7 +255,7 @@ class RepoSync:
mdoptions.append("-g %s" % os.path.join(origin_path, groupmdfile))
if "prestodelta" in rd:
# need createrepo >= 0.9.7 to add deltas
- if utils.get_family() in ("redhat", "suse"):
+ if utils.get_family() in ("redhat", "suse", "generic_lower_os"):
cmd = "/usr/bin/rpmquery --queryformat=%{VERSION} createrepo"
createrepo_ver = utils.subprocess_get(cmd)
if not createrepo_ver[0:1].isdigit():
diff --git a/cobbler/autoinstallgen.py b/cobbler/autoinstallgen.py
index 28187c5..d60be02 100644
--- a/cobbler/autoinstallgen.py
+++ b/cobbler/autoinstallgen.py
@@ -304,7 +304,7 @@ class AutoInstallationGen:
meta.update(autoinstall_meta)
# add package repositories metadata to autoinstall metavariables
- if distro.breed == "redhat":
+ if distro.breed == "redhat" or distro.breed == "generic_lower_os":
meta["yum_repo_stanza"] = self.generate_repo_stanza(obj, (system is None))
meta["yum_config_stanza"] = self.generate_config_stanza(obj, (system is None))
# FIXME: implement something similar to zypper (SUSE based distros) and apt (Debian based distros)
diff --git a/cobbler/tftpgen.py b/cobbler/tftpgen.py
index d0b0dfc..6911d46 100644
--- a/cobbler/tftpgen.py
+++ b/cobbler/tftpgen.py
@@ -905,7 +905,7 @@ class TFTPGen:
autoinstall_path = "http://%s/cblr/svc/op/autoinstall/profile/%s" \
% (httpserveraddress, profile.name)
- if distro.breed is None or distro.breed == "redhat":
+ if distro.breed is None or distro.breed == "redhat" or distro.breed == "generic_lower_os":
if distro.os_version in ["rhel4", "rhel5", "rhel6", "fedora16"]:
append_line += f" kssendmac ks={autoinstall_path}"
@@ -914,9 +914,10 @@ class TFTPGen:
else:
append_line += f" inst.ks.sendmac inst.ks={autoinstall_path}"
if blended["autoinstall_meta"].get("tree"):
- append_line += (
- f" inst.repo={blended['autoinstall_meta']['tree']}"
- )
+ #append_line += (
+ # f" inst.repo={blended['autoinstall_meta']['tree']}"
+ #)
+ append_line = append_line.replace("repo","inst.repo")
ipxe = blended["enable_ipxe"]
if ipxe:
append_line = append_line.replace('ksdevice=bootif', 'ksdevice=${net0/mac}')
diff --git a/cobbler/utils.py b/cobbler/utils.py
index 8586844..1a6ecbb 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -1097,6 +1097,9 @@ def os_release():
make = "unknown"
return make, float(distro_version)
+ elif family == "generic_lower_os":
+ return "generic_lower_os", float(distro_version)
+
def is_safe_to_hardlink(src: str, dst: str, api) -> bool:
"""
diff --git a/config/cobbler/distro_signatures.json b/config/cobbler/distro_signatures.json
index 2c1ca82..90fd075 100644
--- a/config/cobbler/distro_signatures.json
+++ b/config/cobbler/distro_signatures.json
@@ -1,5 +1,33 @@
{
"breeds": {
+ "generic_lower_os": {
+ "generic_lower_os": {
+ "signatures": [
+ "Packages"
+ ],
+ "version_file": "generic_os-release-(.*).rpm",
+ "version_file_regex": null,
+ "kernel_arch": "kernel-(.*).rpm",
+ "kernel_arch_regex": null,
+ "supported_arches": [
+ "aarch64",
+ "x86_64"
+ ],
+ "supported_repo_breeds": [
+ "rsync",
+ "rhn",
+ "yum"
+ ],
+ "kernel_file": "vmlinuz(.*)",
+ "initrd_file": "initrd(.*)\\.img",
+ "isolinux_ok": true,
+ "default_autoinstall": "sample.ks",
+ "kernel_options": "repo=$tree",
+ "kernel_options_post": "",
+ "boot_files": [],
+ "boot_loaders": {}
+ }
+ },
"redhat": {
"rhel4": {
"signatures": [
diff --git a/distro_build_configs.sh b/distro_build_configs.sh
index 954e0f9..1de6ee0 100644
--- a/distro_build_configs.sh
+++ b/distro_build_configs.sh
@@ -38,6 +38,9 @@ if [ "$DISTRO" = "" ] && [ -r /etc/os-release ];then
ubuntu*|debian*)
DISTRO="UBUNTU"
;;
+ generic_os*)
+ DISTRO=`echo 'generic_os'|tr 'a-z' 'A-Z'`
+ ;;
esac
fi
@@ -59,7 +62,7 @@ elif [ "$DISTRO" = "UBUNTU" ];then
export MEMDISK_FOLDER="/usr/lib/syslinux/"
export SYSLINUX_DIR="/usr/lib/syslinux/modules/bios/"
export GRUB_MOD_FOLDER="/usr/lib/grub"
-elif [ "$DISTRO" = "FEDORA" ];then
+elif [ "$DISTRO" = "FEDORA" ] || [ "$DISTRO" = `echo 'generic_os'|tr 'a-z' 'A-Z'` ];then
export APACHE_USER="apache"
export HTTP_USER=$APACHE_USER # overrule setup.py
export APACHE_GROUP="apache"
diff --git a/templates/etc/dhcp.template b/templates/etc/dhcp.template
index 9089439..698c826 100644
--- a/templates/etc/dhcp.template
+++ b/templates/etc/dhcp.template
@@ -31,7 +31,7 @@ subnet 192.168.1.0 netmask 255.255.255.0 {
# Legacy
if option system-arch = 00:00 {
- filename "grub/grub.0";
+ filename "pxelinux.0";
}
# UEFI-32-1
if option system-arch = 00:06 {
--
2.33.0
|