From 5d125637ee1bd67589a03064b57cdf383c80702b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Fri, 16 Oct 2026 23:52:52 -0300 Subject: [PATCH 01/22] fix(genesis): retain the selected journal entry across history rollover A paused journal view restores a row number after refreshing its history. When older records leave the window, that row selects a different entry. Match the selected entry by its journal cursor and retain its wrapped-line position. If the entry has left the window, select the oldest retained row without resuming follow mode. --- .../files/xcat-genesis-console/src/newt_ui.c | 124 +++++++++++------- 1 file changed, 78 insertions(+), 46 deletions(-) diff --git a/xCAT-genesis-base/oe/meta-xcat-genesis/recipes-core/xcat-genesis-console/files/xcat-genesis-console/src/newt_ui.c b/xCAT-genesis-base/oe/meta-xcat-genesis/recipes-core/xcat-genesis-console/files/xcat-genesis-console/src/newt_ui.c index 11bc092822..b753e6bd8b 100644 --- a/xCAT-genesis-base/oe/meta-xcat-genesis/recipes-core/xcat-genesis-console/files/xcat-genesis-console/src/newt_ui.c +++ b/xCAT-genesis-base/oe/meta-xcat-genesis/recipes-core/xcat-genesis-console/files/xcat-genesis-console/src/newt_ui.c @@ -266,19 +266,36 @@ static bool genesis_journal_entry(sd_journal *journal, char *source, size_t sour return true; } -static void format_logs(char *text, size_t size) { +struct log_record { + char text[LOG_LINE_SIZE]; + char *cursor; + unsigned int first_row; + unsigned int row_count; + bool selected; +}; + +struct log_view { + struct log_record records[LOG_LINE_COUNT]; + unsigned int count; + unsigned int start; +}; + +static void free_log_view(struct log_view *view) { + for (unsigned int index = 0; index < LOG_LINE_COUNT; index++) + free(view->records[index].cursor); +} + +static void load_logs(struct log_view *view, const char *selected_cursor) { sd_journal *journal = NULL; - char lines[LOG_LINE_COUNT][LOG_LINE_SIZE] = {{0}}; unsigned int count = 0; unsigned int next = 0; int result; - if (size == 0) - return; - text[0] = '\0'; result = sd_journal_open(&journal, SD_JOURNAL_LOCAL_ONLY | SD_JOURNAL_SYSTEM); if (result < 0) { - xcat_set_text(text, size, "Genesis journal is unavailable: %s", strerror(-result)); + xcat_set_text(view->records[0].text, LOG_LINE_SIZE, "Genesis journal is unavailable: %s", + strerror(-result)); + view->count = 1; return; } @@ -289,6 +306,7 @@ static void format_logs(char *text, size_t size) { char source[96] = ""; char timestamp[16] = "--:--:--"; uint64_t realtime; + struct log_record *record = &view->records[next]; if (!genesis_journal_entry(journal, source, sizeof(source)) || !journal_value(journal, "MESSAGE", message, sizeof(message))) @@ -300,32 +318,25 @@ static void format_logs(char *text, size_t size) { if (localtime_r(&seconds, &local_time) != NULL) strftime(timestamp, sizeof(timestamp), "%H:%M:%S", &local_time); } - snprintf(lines[next], sizeof(lines[next]), "%s %-24.24s %s", timestamp, source, message); + free(record->cursor); + record->cursor = NULL; + sd_journal_get_cursor(journal, &record->cursor); + record->selected = + selected_cursor != NULL && sd_journal_test_cursor(journal, selected_cursor) > 0; + snprintf(record->text, sizeof(record->text), "%s %-24.24s %s", timestamp, source, message); next = (next + 1) % LOG_LINE_COUNT; count++; } sd_journal_close(journal); if (count == 0) { - xcat_set_text(text, size, "No Genesis journal entries are available."); + xcat_set_text(view->records[0].text, LOG_LINE_SIZE, + "No Genesis journal entries are available."); + view->count = 1; return; } - { - unsigned int available = count < LOG_LINE_COUNT ? count : LOG_LINE_COUNT; - unsigned int start = count < LOG_LINE_COUNT ? 0 : next; - unsigned int index; - size_t used = 0; - - for (index = 0; index < available && used + 1 < size; index++) { - unsigned int line = (start + index) % LOG_LINE_COUNT; - int written = - snprintf(text + used, size - used, "%s%s", index > 0 ? "\n" : "", lines[line]); - - if (written < 0 || (size_t)written >= size - used) - break; - used += (size_t)written; - } - } + view->count = count < LOG_LINE_COUNT ? count : LOG_LINE_COUNT; + view->start = count < LOG_LINE_COUNT ? 0 : next; } static unsigned int append_wrapped_log_record(newtComponent list_box, const char *record, @@ -365,30 +376,48 @@ static unsigned int append_wrapped_log_record(newtComponent list_box, const char return count; } -static unsigned int populate_log_listbox(newtComponent list_box, const char *text) { - const char *record = text; +static unsigned int populate_log_listbox(newtComponent list_box, struct log_view *view) { unsigned int count = 0; - while (*record != '\0') { - const char *end = strchr(record, '\n'); - size_t length = end != NULL ? (size_t)(end - record) : strlen(record); + for (unsigned int index = 0; index < view->count; index++) { + struct log_record *record = &view->records[(view->start + index) % LOG_LINE_COUNT]; - count = append_wrapped_log_record(list_box, record, length, count); - if (end == NULL) - break; - record = end + 1; + record->first_row = count + 1; + count = append_wrapped_log_record(list_box, record->text, strlen(record->text), count); + record->row_count = count + 1 - record->first_row; } - if (count == 0) - count = append_wrapped_log_record(list_box, "", 0, count); return count; } +static const struct log_record *selected_log_record(const struct log_view *view, + unsigned int selected) { + for (unsigned int index = 0; index < view->count; index++) { + const struct log_record *record = &view->records[(view->start + index) % LOG_LINE_COUNT]; + + if (selected >= record->first_row && selected - record->first_row < record->row_count) + return record; + } + return NULL; +} + +static unsigned int retained_log_row(const struct log_view *view, unsigned int offset) { + for (unsigned int index = 0; index < view->count; index++) { + const struct log_record *record = &view->records[(view->start + index) % LOG_LINE_COUNT]; + + if (record->selected) { + if (offset >= record->row_count) + offset = record->row_count - 1; + return record->first_row + offset; + } + } + return 1; +} + static void show_logs(void) { struct newtExitStruct event; newtComponent form; newtComponent list_box; - char text[LOG_LINE_COUNT * LOG_LINE_SIZE]; - char previous[LOG_LINE_COUNT * LOG_LINE_SIZE] = ""; + struct log_view previous = {0}; unsigned int item_count = 0; unsigned int selected = 0; bool follow = true; @@ -410,15 +439,17 @@ static void show_logs(void) { newtPushHelpLine(" F3 Back Esc Back Up/Down Scroll End Follow"); while (!xcat_console_stop_requested) { - format_logs(text, sizeof(text)); - if (previous[0] == '\0' || strcmp(previous, text) != 0) { - newtListboxClear(list_box); - item_count = populate_log_listbox(list_box, text); - if (follow || selected == 0 || selected > item_count) - selected = item_count; - newtListboxSetCurrentByKey(list_box, (void *)(uintptr_t)selected); - xcat_copy_printable(previous, sizeof(previous), text); - } + struct log_view current = {0}; + const struct log_record *record = selected_log_record(&previous, selected); + unsigned int offset = record != NULL ? selected - record->first_row : 0; + + load_logs(¤t, !follow && record != NULL ? record->cursor : NULL); + newtListboxClear(list_box); + item_count = populate_log_listbox(list_box, ¤t); + selected = follow ? item_count : retained_log_row(¤t, offset); + newtListboxSetCurrentByKey(list_box, (void *)(uintptr_t)selected); + free_log_view(&previous); + previous = current; newtRefresh(); newtFormRun(form, &event); if (event.reason == NEWT_EXIT_ERROR || @@ -452,6 +483,7 @@ static void show_logs(void) { newtListboxSetCurrentByKey(list_box, (void *)(uintptr_t)selected); } + free_log_view(&previous); newtFormDestroy(form); newtPopHelpLine(); newtPopWindow(); From 53a2b75d4906df6f3485bfdeab263bafdaaa8205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Fri, 16 Oct 2026 23:55:07 -0300 Subject: [PATCH 02/22] test(genesis): cover paused journal selection during rollover --- xCAT-test/native/genesis_console_dialogs.py | 139 ++++++++++++++++++-- 1 file changed, 129 insertions(+), 10 deletions(-) diff --git a/xCAT-test/native/genesis_console_dialogs.py b/xCAT-test/native/genesis_console_dialogs.py index f79ffcddd8..1108c39a24 100644 --- a/xCAT-test/native/genesis_console_dialogs.py +++ b/xCAT-test/native/genesis_console_dialogs.py @@ -38,7 +38,9 @@ class ConsoleTerminal(unittest.TestCase): self.addCleanup(temporary.cleanup) root = Path(temporary.name) self.root = root - environment = {"PATH": os.environ["PATH"], "LC_ALL": "C.UTF-8", "TERM": "xterm"} + environment = {"PATH": os.environ["PATH"], "LC_ALL": "C.UTF-8", "TERM": "xterm", + "NEWT_COLORS": "listbox=black,white\nactlistbox=black,white\n" + "sellistbox=white,red\nactsellistbox=white,red"} for name in ("CMDLINE_FILE", "UPTIME_FILE", "OS_RELEASE", "STATUS_DIR", "STATE_FILE", "DESTINY_FILE", "RESPONSE_FILE", "SYS_ROOT", "PROC_ROOT", "EXTENSION_DIR", "PROVIDER_DIR"): environment["XCAT_" + name] = str(root / name.lower()) @@ -75,13 +77,16 @@ class ConsoleTerminal(unittest.TestCase): return "\n".join(self.screen.display) def wait_text(self, text): + return self.wait_screen(lambda display: text in display, repr(text)) + + def wait_screen(self, predicate, description): deadline = time.monotonic() + 5 while time.monotonic() < deadline: display = self.read_screen(0.1) - if text in display: + if predicate(display): return display self.assertIsNone(self.process.poll(), display) - self.fail(f"Terminal did not show {text!r}:\n{display}") + self.fail(f"Terminal did not show {description}:\n{display}") def key(self, sequence): os.write(self.master, sequence) @@ -117,7 +122,8 @@ class ConsoleJournal(ConsoleTerminal): """Read real journal files in a private machine and journal namespace. Requires bubblewrap, systemd-journal-remote, journalctl and user namespaces. - The host filesystem is read-only; /run and /var/log are private mounts. + The host filesystem is read-only except for the fixture directory. + /run and /var/log are private tmpfs mounts with the journal bound read-only. No journal service is started and no host journal is read or changed. """ @@ -128,11 +134,13 @@ class ConsoleJournal(ConsoleTerminal): journal_directory = journal_root / self.machine_id journal_directory.mkdir(parents=True) self.journal = journal_directory / "system.journal" + self.entries = [] machine_id_file = self.root / "machine-id" machine_id_file.write_text(self.machine_id + "\n") sandbox = [ "bwrap", "--unshare-all", "--die-with-parent", "--ro-bind", "/", "/", "--dev", "/dev", "--proc", "/proc", "--tmpfs", "/run", "--tmpfs", "/var/log", + "--bind", str(self.root), str(self.root), "--ro-bind", str(machine_id_file), "/etc/machine-id", "--ro-bind", str(journal_root), "/var/log/journal", ] @@ -140,34 +148,145 @@ class ConsoleJournal(ConsoleTerminal): capture_output=True, timeout=10) self.assertEqual(result.returncode, 0, "Journal tests require working Bubblewrap namespaces: " + result.stderr) + self.sandbox = sandbox return sandbox + [str(self.binary)] - def write_journal(self, entries): + def write_journal(self, entries, interval=1000000): records = [] - for sequence, (message, unit, identifier) in enumerate(entries, 1): + for sequence, (message, unit, identifier) in enumerate(entries, len(self.entries) + 1): records.append( - f"__REALTIME_TIMESTAMP={1700000000000000 + sequence * 1000000}\n" - f"__MONOTONIC_TIMESTAMP={sequence * 1000000}\n" + f"__REALTIME_TIMESTAMP={1700000000000000 + sequence * interval}\n" + f"__MONOTONIC_TIMESTAMP={sequence * interval}\n" f"_MACHINE_ID={self.machine_id}\n_BOOT_ID={self.boot_id}\n" f"_SYSTEMD_UNIT={unit}\nSYSLOG_IDENTIFIER={identifier}\n" f"MESSAGE={message}\n\n") result = subprocess.run( - ["/usr/lib/systemd/systemd-journal-remote", "--split-mode=none", + self.sandbox + ["/usr/lib/systemd/systemd-journal-remote", "--split-mode=none", "--output=" + str(self.journal), "-"], input="".join(records), text=True, capture_output=True, timeout=10) self.assertEqual(result.returncode, 0, result.stderr) + self.entries.extend(entries) exported = subprocess.check_output( ["journalctl", "--file=" + str(self.journal), "--output=json", "--no-pager"], text=True, timeout=10) actual = [json.loads(line) for line in exported.splitlines()] self.assertEqual([(entry["MESSAGE"], entry["_SYSTEMD_UNIT"], entry["SYSLOG_IDENTIFIER"]) - for entry in actual], entries) + for entry in actual], self.entries) def open_logs(self): self.key(b"\x1bOR") self.wait_text("Genesis logs") self.wait_text("F3 Back") + def selected_text(self): + return "\n".join("".join(self.screen.buffer[row][column].data + for column in range(self.screen.columns) + if self.screen.buffer[row][column].bg == "red").strip() + for row in range(self.screen.lines)).strip() + + def wait_selected(self, text): + return self.wait_screen(lambda display: self.selected_text().endswith(text), + f"selected log entry {text!r}") + + def assert_selection_stays(self, text): + deadline = time.monotonic() + 3 + while time.monotonic() < deadline: + self.read_screen(0.1) + self.assertEqual(self.selected_text(), text) + self.assertIsNone(self.process.poll()) + + def test_paused_entry_survives_history_rollover(self): + self.write_journal([(f"RECORD-{number:04d}", "other.service", "xcat-genesis-register") + for number in range(1, 130)]) + self.open_logs() + self.wait_selected("RECORD-0129") + self.key(b"\x1b[H") + self.wait_selected("RECORD-0002") + self.key(b"\x1b[B" * 60) + self.wait_selected("RECORD-0062") + selected = self.selected_text() + for number in (130, 131): + self.write_journal([(f"RECORD-{number:04d}", "other.service", "xcat-genesis-register")]) + self.assert_selection_stays(selected) + self.key(b"\x1b[F") + self.wait_selected("RECORD-0131") + self.write_journal([("FOLLOWED", "other.service", "xcat-genesis-register")]) + self.wait_selected("FOLLOWED") + + def test_expired_selection_stays_paused_at_oldest_entry(self): + self.write_journal([(f"RECORD-{number:04d}", "other.service", "xcat-genesis-register") + for number in range(1, 130)]) + self.open_logs() + self.wait_selected("RECORD-0129") + self.key(b"\x1b[H") + self.wait_selected("RECORD-0002") + for first, last, oldest in ((130, 140, 12), (140, 270, 142)): + self.write_journal([(f"RECORD-{number:04d}", "other.service", "xcat-genesis-register") + for number in range(first, last)]) + self.wait_selected(f"RECORD-{oldest:04d}") + self.assert_selection_stays(self.selected_text()) + if first == 130: + self.key(b"\x1b[B" * 50) + self.wait_selected("RECORD-0062") + self.write_journal([("STILL-PAUSED", "other.service", "xcat-genesis-register")]) + self.wait_selected("RECORD-0143") + self.key(b"\x1b[F") + self.wait_selected("STILL-PAUSED") + + def test_duplicate_text_keeps_the_selected_record(self): + self.write_journal([("DUPLICATE" if number in (60, 62, 63) else f"RECORD-{number:04d}", + "other.service", "xcat-genesis-register") + for number in range(1, 130)], interval=1) + self.open_logs() + self.wait_selected("RECORD-0129") + self.key(b"\x1b[H") + self.wait_selected("RECORD-0002") + self.key(b"\x1b[B" * 58) + self.wait_selected("DUPLICATE") + duplicate = self.selected_text() + self.key(b"\x1b[B") + self.wait_selected("RECORD-0061") + self.key(b"\x1b[B") + self.wait_selected("DUPLICATE") + self.assertEqual(self.selected_text(), duplicate) + self.write_journal([("APPENDED", "other.service", "xcat-genesis-register")], interval=1) + self.assert_selection_stays(duplicate) + self.key(b"\x1b[A") + self.wait_selected("RECORD-0061") + self.key(b"\x1b[H") + self.wait_selected("RECORD-0003") + + def test_wrapped_selection_survives_history_rollover(self): + self.write_journal([ + (" ".join(f"OLD-{number:02d}" for number in range(20)), + "other.service", "xcat-genesis-register"), + (" ".join(f"CONTEXT-{number:02d}" for number in range(16)) + " SELECTED-TAIL", + "other.service", "xcat-genesis-register"), + ] + [(f"RECORD-{number:04d}", "other.service", "xcat-genesis-register") + for number in range(3, 129)]) + self.open_logs() + self.wait_selected("RECORD-0128") + self.key(b"\x1b[H") + self.wait_screen(lambda display: "OLD-00" in self.selected_text(), "oldest wrapped entry") + for _ in range(12): + if self.selected_text().endswith("CONTEXT-08"): + break + previous = self.selected_text() + self.key(b"\x1b[B") + self.wait_screen(lambda display: self.selected_text() != previous, "next wrapped row") + self.assertTrue(self.selected_text().endswith("CONTEXT-08"), self.selected_text()) + selected = self.selected_text() + self.assertIn("OLD-00", self.read_screen(0)) + self.write_journal([("APPENDED", "other.service", "xcat-genesis-register")]) + self.wait_screen(lambda display: "OLD-00" not in display, "expired wrapped entry removed") + self.assert_selection_stays(selected) + self.key(b"\x1b[B") + self.wait_selected("CONTEXT-14") + self.key(b"\x1b[B") + self.wait_selected("SELECTED-TAIL") + self.key(b"\x1b[B") + self.wait_selected("RECORD-0003") + def test_empty_journal(self): self.open_logs() self.wait_text("No Genesis journal entries are available.") From f9024b9fd29bf68c486fff4ee1ac40d31878105f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Fri, 16 Oct 2026 23:55:07 -0300 Subject: [PATCH 03/22] docs(test): describe journal selection rollover coverage --- xCAT-test/native/README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xCAT-test/native/README.md b/xCAT-test/native/README.md index 58a4587134..4af5c8d7e3 100644 --- a/xCAT-test/native/README.md +++ b/xCAT-test/native/README.md @@ -278,14 +278,17 @@ dependencies plus the `pyte` Python package, bubblewrap, systemd-journal-remote and journalctl. It runs the linked console in a pseudo-terminal and checks help and diagnostics navigation, scrolling, return to the main screen, and F3 journal filtering, order and history limits. +Rollover cases check paused selection, expired entries, duplicate messages, +wrapped lines and returning to follow mode. It checks termination from the main screen, not from inside a dialog. The journal cases need working Linux user and mount namespaces. On Ubuntu 24.04, the CI job enables them with `sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0`. -They import private journal files and verify their contents with journalctl -before opening F3. They do not start a journal service or read the host -journal. Missing tools or namespace support fail the tests; they do not skip. +They import private journal files, including appends while F3 is open, and +verify each import with journalctl. They do not start a journal service or +read the host journal. Missing tools or namespace support fail the tests; +they do not skip. The Genesis runtime BATS cases need Bash, Perl, OpenSSL, coreutils, diffutils and bubblewrap. The credential-file cases use a private `/etc` in a Linux From db6cec2b8043a85aeec983629781f3164b5191df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Sun, 11 Oct 2026 12:43:42 -0300 Subject: [PATCH 04/22] refactor(pkglist): share package-list line filtering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Share line normalization and directive filtering across the legacy text reader, its include reader and the record reader. Keep leading whitespace in legacy includes and leave each parser expansion policy unchanged. Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com> --- xCAT-server/lib/perl/xCAT/Postage.pm | 48 +++++++++++++--------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index d069a6b677..68938cfdbb 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -1819,6 +1819,21 @@ sub get_envlist return ($envlist, $pkgtext); } +sub _pkglist_line +{ + my ($line, $trim_leading) = @_; + chomp($line); + $line =~ s/\s+$//; + $line =~ s/^\s*// if $trim_leading; + return if $line =~ /^\s*$/; + return + if ($line =~ /^\s*#/ + && $line !~ /^\s*#INCLUDE:[^#^\n]+#/ + && $line !~ /^\s*#NEW_INSTALL_LIST#/ + && $line !~ /^\s*#ENV:[^#^\n]+#/); + return $line; +} + #---------------------------------------------------------------------------- =head3 get_pkglist_text @@ -1846,15 +1861,8 @@ sub get_pkglist_tex { while (readline(FILE1)) { - chomp($_); #remove newline - s/\s+$//; #remove trailing spaces - s/^\s*//; #remove leading blanks - next if /^\s*$/; #-- skip empty lines - next - if (/^\s*#/ - && !/^\s*#INCLUDE:[^#^\n]+#/ - && !/^\s*#NEW_INSTALL_LIST#/ - && !/^\s*#ENV:[^#^\n]+#/); #-- skip comments + $_ = _pkglist_line($_, 1); + next unless defined $_; if (/^@(.*)/) { #for groups that has space in name my $save = $1; @@ -1925,15 +1933,8 @@ sub pkglist_file_records open(my $fh, '<', $file) or return ("#INCLUDEBAD:cannot open pkglist file $file#"); while (my $line = <$fh>) { - chomp($line); - $line =~ s/\s+$//; - $line =~ s/^\s*//; - next if $line eq ''; - next - if ($line =~ /^#/ - && $line !~ /^#INCLUDE:[^#^\n]+#/ - && $line !~ /^#NEW_INSTALL_LIST#/ - && $line !~ /^#ENV:[^#^\n]+#/); + $line = _pkglist_line($line, 1); + next unless defined $line; if ($line =~ /^#INCLUDE:([^#^\n]+)#(.*)$/ && $depth < 20) { my ($name, $note) = ($1, $2); @@ -1974,14 +1975,9 @@ sub includefile while () { - chomp($_); #remove newline - s/\s+$//; #remove trailing spaces - next if /^\s*$/; #-- skip empty lines - next - if (/^\s*#/ - && !/^\s*#INCLUDE:[^#^\n]+#/ - && !/^\s*#NEW_INSTALL_LIST#/ - && !/^\s*#ENV:[^#^\n]+#/); #-- skip comments + # Legacy includes preserve leading whitespace, unlike root package lists. + $_ = _pkglist_line($_, 0); + next unless defined $_; if (/^@(.*)/) { #for groups that has space in name my $save = $1; From 6931621d65a0f64502b85f6ccda734259743d51d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Sun, 11 Oct 2026 12:44:35 -0300 Subject: [PATCH 05/22] test(pkglist): cover shared line filtering through both readers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com> --- xCAT-test/unit/postage_pkglist_lines.t | 118 +++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 xCAT-test/unit/postage_pkglist_lines.t diff --git a/xCAT-test/unit/postage_pkglist_lines.t b/xCAT-test/unit/postage_pkglist_lines.t new file mode 100644 index 0000000000..2511868f37 --- /dev/null +++ b/xCAT-test/unit/postage_pkglist_lines.t @@ -0,0 +1,118 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use FindBin; +use lib "$FindBin::Bin/../lib"; +use File::Slurper qw(write_text); +use File::Temp qw(tempdir); +use Test::More; +use XCAT::Test::File qw(repo_path); + +my $dir = tempdir(CLEANUP => 1); +$ENV{XCATROOT} = repo_path('xCAT-server'); +$ENV{XCATCFG} = "$dir/config"; +mkdir $ENV{XCATCFG} or die "mkdir $ENV{XCATCFG}: $!"; +require lib; +lib->import(repo_path('perl-xCAT'), repo_path('xCAT-server/lib/perl')); +require xCAT::Postage; + +my @lines = ( + '', ' ', '# comment', ' # indented comment', + ' 0 ', ' openssh-server ', ' @Group With Space ', + ' d-i tasksel/first multiselect standard,ssh-server ', + ' #NEW_INSTALL_LIST# ', ' #ENV:SETTING=value# ', + ' curl # inline note ', ' -snmpd ', '#INCLUDE:', '#ENV:', + '#NEW_INSTALL_LIST_EXTRA#', ' gawk', +); +write_text("$dir/lines.pkglist", join("\n", @lines)); +my @records = ( + '0', 'openssh-server', '@Group With Space', + 'd-i tasksel/first multiselect standard,ssh-server', + '#NEW_INSTALL_LIST#', '#ENV:SETTING=value#', + 'curl # inline note', '-snmpd', 'gawk', +); +is_deeply([xCAT::Postage->get_pkglist_records("$dir/lines.pkglist")], + \@records, 'record reader filters comments and preserves package-list directives'); +is(xCAT::Postage->get_pkglist_tex("$dir/lines.pkglist"), join(',', @records), + 'legacy root reader applies the same line policy before joining records'); +is(xCAT::Postage::get_pkglist_tex("$dir/lines.pkglist"), join(',', @records), + 'legacy function calls use the same policy as method calls'); +is_deeply([xCAT::Postage::get_pkglist_records("$dir/lines.pkglist")], + \@records, 'record function calls use the same policy as method calls'); +write_text("$dir/included-lines.pkglist", "#INCLUDE:lines.pkglist#\n"); +is(xCAT::Postage->get_pkglist_tex("$dir/included-lines.pkglist"), + ' 0, openssh-server, @Group With Space, d-i tasksel/first multiselect standard,ssh-server, #NEW_INSTALL_LIST#, #ENV:SETTING=value#, curl # inline note, -snmpd, gawk', + 'legacy includes retain leading whitespace but remove trailing whitespace'); + +write_text("$dir/crlf.pkglist", " bc\r\n\t# comment\r\n0\r\nlast"); +is_deeply([xCAT::Postage->get_pkglist_records("$dir/crlf.pkglist")], + [qw(bc 0 last)], 'record reader accepts CRLF and an unterminated last line'); +is(xCAT::Postage->get_pkglist_tex("$dir/crlf.pkglist"), 'bc,0,last', + 'legacy reader accepts CRLF and an unterminated last line'); + +mkdir "$dir/sub" or die "mkdir $dir/sub: $!"; +write_text("$dir/root.pkglist", "before\n#INCLUDE:sub/middle.pkglist# # tail note\nafter\n"); +write_text("$dir/sub/middle.pkglist", " #INCLUDE:leaf.pkglist#\n bc \n"); +write_text("$dir/leaf.pkglist", "curl\n"); +write_text("$dir/sub/leaf.pkglist", "wrong-directory\n"); +is_deeply([xCAT::Postage->get_pkglist_records("$dir/root.pkglist")], + ['before', 'curl', 'bc # tail note', 'after'], + 'record includes retain root-relative lookup, order and a trailing note'); +is(xCAT::Postage->get_pkglist_tex("$dir/root.pkglist"), + 'before, curl, bc # tail note,after', + 'legacy nested includes preserve whitespace and append the note after expansion'); + +local $ENV{XCAT_PKGLIST_TEST_INCLUDE} = "$dir/leaf.pkglist"; +write_text("$dir/env.pkglist", '#INCLUDE:${XCAT_PKGLIST_TEST_INCLUDE}#' . "\n"); +is_deeply([xCAT::Postage->get_pkglist_records("$dir/env.pkglist")], ['curl'], + 'record includes expand an environment variable to an absolute filename'); +is(xCAT::Postage->get_pkglist_tex("$dir/env.pkglist"), 'curl', + 'legacy includes expand an environment variable to an absolute filename'); + +write_text("$dir/empty.pkglist", "\n# comment only\n"); +is_deeply([xCAT::Postage->get_pkglist_records("$dir/empty.pkglist")], [], + 'a comment-only file has no records'); +is(xCAT::Postage->get_pkglist_tex("$dir/empty.pkglist"), '', + 'a comment-only file has empty legacy text'); +write_text("$dir/empty-include.pkglist", "before\n#INCLUDE:empty.pkglist# # note\nafter\n"); +is_deeply([xCAT::Postage->get_pkglist_records("$dir/empty-include.pkglist")], + [qw(before after)], 'record reader omits a note on an empty include'); +is(xCAT::Postage->get_pkglist_tex("$dir/empty-include.pkglist"), + 'before, # note,after', 'legacy reader keeps a note after an empty include'); + +my $missing = "$dir/missing.pkglist"; +my $missing_record = "#INCLUDEBAD:cannot open pkglist file $missing#"; +is_deeply([xCAT::Postage->get_pkglist_records($missing)], [$missing_record], + 'a missing root file yields a record error'); +is(xCAT::Postage->get_pkglist_tex($missing), '', + 'a missing root file yields empty legacy text'); +write_text("$dir/missing-include.pkglist", "before\n#INCLUDE:missing.pkglist#\nafter\n"); +is_deeply([xCAT::Postage->get_pkglist_records("$dir/missing-include.pkglist")], + ['before', $missing_record, 'after'], 'record reader continues after a missing include'); +is(xCAT::Postage->get_pkglist_tex("$dir/missing-include.pkglist"), + "before,$missing_record,after", 'legacy reader continues after a missing include'); + +my $files = "$dir/leaf.pkglist,$missing,$dir/leaf.pkglist"; +is_deeply([xCAT::Postage->get_pkglist_records($files)], + ['curl', $missing_record, 'curl'], 'record reader preserves file order and repeated packages'); +is(xCAT::Postage->get_pkglist_tex($files), 'curl,,curl', + 'legacy reader retains the empty slot for a missing middle file'); + +write_text("$dir/inline.pkglist", "first #INCLUDE:leaf.pkglist# last\n"); +is_deeply([xCAT::Postage->get_pkglist_records("$dir/inline.pkglist")], + ['first #INCLUDE:leaf.pkglist# last'], 'record reader leaves a non-leading include unchanged'); +is(xCAT::Postage->get_pkglist_tex("$dir/inline.pkglist"), 'first curl last', + 'legacy reader expands a non-leading include'); + +for my $depth (0 .. 20) { + my $next = $depth + 1; + write_text("$dir/depth$depth.pkglist", "#INCLUDE:depth$next.pkglist#\n"); +} +write_text("$dir/depth21.pkglist", "curl\n"); +is_deeply([xCAT::Postage->get_pkglist_records("$dir/depth0.pkglist")], + ['#INCLUDE:depth21.pkglist#'], 'record reader retains its include-depth limit'); +is(xCAT::Postage->get_pkglist_tex("$dir/depth0.pkglist"), 'curl', + 'legacy reader continues beyond the record reader depth limit'); + +done_testing(); From 2a5b55da4733e9c35fdfe3051d0c5b3957d31da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Tue, 13 Oct 2026 01:59:30 -0300 Subject: [PATCH 06/22] refactor(ubuntu): share architecture-specific APT mirror defaults --- perl-xCAT/xCAT/Utils.pm | 8 ++++++++ xCAT-server/lib/perl/xCAT/Template.pm | 12 +----------- xCAT-server/share/xcat/netboot/ubuntu/genimage | 6 +----- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 069cade9dc..5599cddd00 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -5006,6 +5006,14 @@ sub splitkcmdline { } +sub ubuntu_default_mirror { + my $arch = shift; + $arch = shift if defined($arch) && $arch eq 'xCAT::Utils'; + return defined($arch) && $arch =~ /^(?:amd64|i386|x86|x86_64)$/ + ? 'http://archive.ubuntu.com/ubuntu' + : 'http://ports.ubuntu.com/ubuntu-ports'; +} + ################################################################################### #subroutine debian_arch #Usage: give the Debian architecture name for an xCAT architecture. The media, the diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index a0aef54fa3..cf2bfef8ad 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -1831,17 +1831,7 @@ sub ubuntu_subiquity_apt_mirror { my ($osarch) = @_; - # Apt mirror for Subiquity installs. site.ubuntu_apt_mirror overrides; otherwise default to the - # public archive. The minimal live-server install media is not a complete package source, so a - # real mirror is always required -- set site.ubuntu_apt_mirror to a local full mirror for - # airgapped clusters (or to a geo/ports mirror as needed). - # - # archive.ubuntu.com publishes amd64 and i386 only. Every other architecture, ppc64el and - # riscv64 included, is on the ports archive. The osimage's architecture decides it, because - # pkgdir is whatever path the administrator configured. - my $default = (!$osarch || $osarch =~ /^(?:amd64|i386|x86|x86_64)$/) - ? 'http://archive.ubuntu.com/ubuntu' - : 'http://ports.ubuntu.com/ubuntu-ports'; + my $default = xCAT::Utils->ubuntu_default_mirror($osarch || 'amd64'); my $site_tab = xCAT::Table->new('site'); return $default unless $site_tab; diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 34f681ac3e..39cdd17369 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -259,11 +259,7 @@ unless ($onlyinitrd) { # site.ubuntu_apt_mirror overrides; otherwise default to the public archive. A live-server # ISO is never a complete debootstrap source, so a real mirror is always required here. my @aptmirror = xCAT::TableUtils->get_site_attribute("ubuntu_apt_mirror"); - # archive.ubuntu.com publishes amd64 and i386 only. Every other architecture, ppc64el - # and riscv64 included, is on the ports archive. - my $default = ($uarch =~ /^(?:amd64|i386)$/) - ? 'http://archive.ubuntu.com/ubuntu' - : 'http://ports.ubuntu.com/ubuntu-ports'; + my $default = xCAT::Utils->ubuntu_default_mirror($uarch); my $mirror = (defined $aptmirror[0] && length $aptmirror[0]) ? $aptmirror[0] : $default; (my $codename = $osver) =~ s/^ubuntu//; From a13ecfe9c6107b49885e626ec8fbc0c1b3235798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Tue, 13 Oct 2026 01:59:58 -0300 Subject: [PATCH 07/22] test(ubuntu): cover shared mirror defaults through provisioning callers --- xCAT-test/native/ubuntu_genimage_apt_mirror.t | 4 + xCAT-test/unit/ubuntu_subiquity_apt_mirror.t | 106 ++++++++++-------- 2 files changed, 63 insertions(+), 47 deletions(-) diff --git a/xCAT-test/native/ubuntu_genimage_apt_mirror.t b/xCAT-test/native/ubuntu_genimage_apt_mirror.t index 9f887e6ff4..407fd49f25 100644 --- a/xCAT-test/native/ubuntu_genimage_apt_mirror.t +++ b/xCAT-test/native/ubuntu_genimage_apt_mirror.t @@ -18,12 +18,16 @@ my $explicit = 'https://image.example.invalid/ubuntu'; for my $case ( ['amd64 default', {arch => 'x86_64'}, 'amd64', $archive, 'noble'], ['i386 default', {arch => 'x86'}, 'i386', $archive, 'noble'], + ['Debian amd64 spelling', {arch => 'amd64'}, 'amd64', $archive, 'noble'], + ['Debian i386 spelling', {arch => 'i386'}, 'i386', $archive, 'noble'], ['POWER default', {arch => 'ppc64el'}, 'ppc64el', $ports, 'noble'], + ['POWER alternate spelling', {arch => 'ppc64le'}, 'ppc64le', $ports, 'noble'], ['RISC-V default', {arch => 'riscv64'}, 'riscv64', $ports, 'noble'], ['s390x default', {arch => 's390x'}, 's390x', $ports, 'noble'], ['site overrides archive', {mirror => $site}, 'amd64', $site, 'noble'], ['site overrides ports', {arch => 'riscv64', mirror => $site}, 'riscv64', $site, 'noble'], ['cleared site keeps default', {arch => 'riscv64', mirror => ''}, 'riscv64', $ports, 'noble'], + ['cleared site keeps archive', {mirror => ''}, 'amd64', $archive, 'noble'], ['pkgdir overrides site', {mirror => $site, pkgdir => "/work/packages,$explicit jammy main"}, 'amd64', $explicit, 'jammy'], ['first pkgdir mirror wins', {pkgdir => diff --git a/xCAT-test/unit/ubuntu_subiquity_apt_mirror.t b/xCAT-test/unit/ubuntu_subiquity_apt_mirror.t index 59e3977469..a7d6c3109a 100644 --- a/xCAT-test/unit/ubuntu_subiquity_apt_mirror.t +++ b/xCAT-test/unit/ubuntu_subiquity_apt_mirror.t @@ -3,59 +3,71 @@ use strict; use warnings; use FindBin; +use lib "$FindBin::Bin/../lib"; +use File::Temp qw(tempdir); use Test::More; +use YAML::PP; +use XCAT::Test::File qw(repo_path); -# archive.ubuntu.com publishes amd64 and i386 only, so a ppc64el or riscv64 stateful install -# is handed a mirror that carries no package for it. The architecture being installed is the -# last component of the media directory. +my $dir = tempdir(CLEANUP => 1); +$ENV{XCATROOT} = repo_path('xCAT-server'); +$ENV{XCATCFG} = "SQLite:$dir"; +require lib; +lib->import(repo_path('perl-xCAT'), repo_path('xCAT-server/lib/perl')); +require xCAT::Template; -BEGIN { - package xCAT::Table; - our $value; - sub new { return bless {}, shift } - sub getAttribs { return defined $value ? { value => $value } : undef } - $INC{'xCAT/Table.pm'} = __FILE__; +my $archive = 'http://archive.ubuntu.com/ubuntu'; +my $ports = 'http://ports.ubuntu.com/ubuntu-ports'; +my $override = 'https://mirror.example.invalid/ubuntu'; +my $yaml = YAML::PP->new(); +my $site = xCAT::Table->new('site', -create => 1); +die 'Cannot create the site table' unless $site; + +for my $setting ('missing', 'override', 'cleared') { + $site->setAttribs({key => 'ubuntu_apt_mirror'}, {value => $override}) + if $setting eq 'override'; + $site->setAttribs({key => 'ubuntu_apt_mirror'}, {value => ''}) + if $setting eq 'cleared'; + for my $case ( + ['x86_64', $archive], ['amd64', $archive], + ['x86', $archive], ['i386', $archive], + ['ppc64el', $ports], ['ppc64le', $ports], + ['riscv64', $ports], ['s390x', $ports], + [undef, $archive], ['', $archive], + ) { + my ($arch, $default) = @$case; + my $mirror = $setting eq 'override' ? $override : $default; + my $name = defined($arch) ? "'$arch'" : 'undefined'; + is(xCAT::Template::ubuntu_subiquity_apt_mirror($arch), $mirror, + "$setting site, $name architecture: selected mirror"); + for my $release (qw(ubuntu22.04 ubuntu24.04)) { + my $rendered = xCAT::Template::ubuntu_subiquity_apt_config($release, $arch); + my $apt = $yaml->load_string($rendered)->{apt}; + is_deeply($apt->{'mirror-selection'}->{primary}, [{uri => $mirror}], + "$setting site, $name architecture, $release: primary mirror in YAML"); + if ($release eq 'ubuntu22.04') { + is($apt->{sources}->{'xcat-ubuntu-archive.list'}->{source}, + "deb $mirror \$RELEASE main restricted universe multiverse", + "$setting site, $name architecture: classic archive source"); + is($apt->{sources}->{'xcat-ubuntu-updates.list'}->{source}, + "deb $mirror \$RELEASE-updates main restricted universe multiverse", + "$setting site, $name architecture: classic updates source"); + } else { + ok(!exists $apt->{sources}, + "$setting site, $name architecture: no duplicate Deb822 sources"); + } + } + } } +$site->close(); -use lib "$FindBin::Bin/../../perl-xCAT"; -use lib "$FindBin::Bin/../../xCAT-server/lib/perl"; -my $module = "$FindBin::Bin/../../xCAT-server/lib/perl/xCAT/Template.pm"; -plan skip_all => 'Template.pm not found' unless -r $module; -eval { require $module; 1 } or plan skip_all => "could not load Template.pm: $@"; - -my $mirror = \&xCAT::Template::ubuntu_subiquity_apt_mirror; - -# The osimage's architecture decides the mirror. pkgdir cannot: it is whatever path the -# administrator configured, so an amd64 image under /srv/custom-media would be read as a -# non-x86 architecture and sent to the ports archive. -is( $mirror->('riscv64'), 'http://ports.ubuntu.com/ubuntu-ports', - 'a riscv64 image takes the ports archive' ); -is( $mirror->('ppc64el'), 'http://ports.ubuntu.com/ubuntu-ports', - 'a ppc64el image takes the ports archive' ); -is( $mirror->('ppc64le'), 'http://ports.ubuntu.com/ubuntu-ports', - 'the other spelling of ppc64 takes the ports archive' ); - -for my $x86 (qw(x86_64 amd64 x86 i386)) { - is( $mirror->($x86), 'http://archive.ubuntu.com/ubuntu', - "an $x86 image keeps the main archive" ); -} - -# With no architecture there is nothing to key on, so the previous default stands. -is( $mirror->(undef), 'http://archive.ubuntu.com/ubuntu', - 'an unknown architecture keeps the previous default' ); - -# site.ubuntu_apt_mirror still wins, which is how an airgapped cluster points at its own. { - local $xCAT::Table::value = 'http://mirror.example.invalid/ubuntu'; - is( $mirror->('riscv64'), 'http://mirror.example.invalid/ubuntu', - 'site.ubuntu_apt_mirror overrides the ports archive' ); - is( $mirror->('x86_64'), 'http://mirror.example.invalid/ubuntu', - 'site.ubuntu_apt_mirror overrides the main archive' ); -} -{ - local $xCAT::Table::value = ''; - is( $mirror->('riscv64'), 'http://ports.ubuntu.com/ubuntu-ports', - 'an empty site.ubuntu_apt_mirror does not blank the mirror' ); + no warnings qw(redefine once); + local *xCAT::Table::new = sub { return }; + is(xCAT::Template::ubuntu_subiquity_apt_mirror('riscv64'), $ports, + 'unavailable site table keeps the architecture default'); + is(xCAT::Template::ubuntu_subiquity_apt_mirror(undef), $archive, + 'unavailable site table and architecture keep the main archive'); } done_testing(); From adaff490cf050fab627ea5a6be49afb644f324d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Mon, 19 Oct 2026 11:39:49 -0300 Subject: [PATCH 08/22] refactor(profiles): share identical EL10 RISC-V assets Use relative aliases for identical shipped profiles. Keep their public names, resolved contents and executable modes. Custom copies remain independent. --- .../service.rhels10.riscv64.otherpkgs.pkglist | 3 +- .../install/rh/service.rhels10.riscv64.tmpl | 80 +------------------ .../rocky/compute.rocky10.riscv64.pkglist | 17 +--- .../rocky/compute.rocky10.riscv64.tmpl | 80 +------------------ .../service.rocky10.riscv64.otherpkgs.pkglist | 3 +- .../netboot/rh/compute.rhels10.riscv64.exlist | 34 +------- .../rh/compute.rhels10.riscv64.pkglist | 31 +------ .../rh/compute.rhels10.riscv64.postinstall | 63 +-------------- .../netboot/rh/service.rhels10.riscv64.exlist | 34 +------- .../service.rhels10.riscv64.otherpkgs.pkglist | 3 +- .../rh/service.rhels10.riscv64.pkglist | 31 +------ .../rh/service.rhels10.riscv64.postinstall | 63 +-------------- .../rocky/service.rocky10.riscv64.exlist | 34 +------- .../rocky/service.rocky10.riscv64.postinstall | 63 +-------------- 14 files changed, 14 insertions(+), 525 deletions(-) mode change 100644 => 120000 xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.otherpkgs.pkglist mode change 100644 => 120000 xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.tmpl mode change 100644 => 120000 xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.pkglist mode change 100644 => 120000 xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.tmpl mode change 100644 => 120000 xCAT-server/share/xcat/install/rocky/service.rocky10.riscv64.otherpkgs.pkglist mode change 100644 => 120000 xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.exlist mode change 100644 => 120000 xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.pkglist mode change 100755 => 120000 xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.postinstall mode change 100644 => 120000 xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.exlist mode change 100644 => 120000 xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.otherpkgs.pkglist mode change 100644 => 120000 xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.pkglist mode change 100755 => 120000 xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.postinstall mode change 100644 => 120000 xCAT-server/share/xcat/netboot/rocky/service.rocky10.riscv64.exlist mode change 100755 => 120000 xCAT-server/share/xcat/netboot/rocky/service.rocky10.riscv64.postinstall diff --git a/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.otherpkgs.pkglist deleted file mode 100644 index cfcb8349f7..0000000000 --- a/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.otherpkgs.pkglist +++ /dev/null @@ -1,2 +0,0 @@ -xcat/xcat-core/xCATsn -xcat/xcat-dep/rh10/riscv64/goconserver diff --git a/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.otherpkgs.pkglist new file mode 120000 index 0000000000..e434c04403 --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.otherpkgs.pkglist @@ -0,0 +1 @@ +../../netboot/rocky/service.rocky10.riscv64.otherpkgs.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.tmpl b/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.tmpl deleted file mode 100644 index dbf34f13c7..0000000000 --- a/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.tmpl +++ /dev/null @@ -1,79 +0,0 @@ -# Use text install -text -# Use network installation -%include /tmp/repos -# Keyboard layouts -keyboard --vckeymap=us --xlayouts='us' -# System language -lang en_US.UTF-8 - -# Network information -#KICKSTARTNET# -# Root password -rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password# -# Not run the Setup Agent on first boot -firstboot --disable -# Do not configure the X Window System -skipx -# System services -#services --enabled="chronyd" -# System timezone -timezone #TABLE:site:key=timezone:value# --utc -# Partition clearing information -zerombr -clearpart --all --initlabel -#XCAT_PARTITION_START# -%include /tmp/partitionfile -#XCAT_PARTITION_END# - -# Do not configure any iptables rules -firewall --disable -selinux --disable -reboot - -# riscv64: EL10 has no default crash kernel reservation for this architecture -# (kdumpctl get-default-crashkernel is empty), so the installer's kdump add-on -# would write the literal "crashkernel=auto", which the kernel ignores: nothing -# is reserved and kdump.service fails on every node. Leave kdump off here; a -# node that should take crash dumps gets a real reservation through -# linuximage.addkcmdline or bootparams.addkcmdline (crashkernel=). -%addon com_redhat_kdump --disable -%end - -# riscv64: the EL10 anaconda has no RISC-V EFI platform and always asks for the -# x86 UEFI boot loader packages (grub2-efi-x64, shim-x64), which do not exist -# for riscv64; tolerate that. The riscv64 package list pulls grub2-efi-riscv64 -# and efibootmgr in explicitly. -%packages --ignoremissing -#INCLUDE_DEFAULT_PKGLIST# - -%end - -%pre -{ -echo "Running Kickstart Pre-installation script..." -#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rhels10# -} &>>/tmp/pre-install.log -%end -%post --interpreter=/bin/bash -mkdir -p /var/log/xcat/ -cat /tmp/pre-install.log >>/var/log/xcat/xcat.log -{ -echo "Running Kickstart Post-installation script..." -#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat.rhels10# -#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10.riscv64# -#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10# -} &>>/var/log/xcat/xcat.log -%end - -# --ignoremissing above also hides a missing grub2-efi-riscv64, which would leave the -# node with no boot loader at all. Fail the installation instead of rebooting into -# firmware that has nothing to load. -%post --erroronfail --interpreter=/bin/bash -if [ ! -f /boot/efi/EFI/BOOT/BOOTRISCV64.EFI ] && - ! ls /boot/efi/EFI/*/grubriscv64.efi >/dev/null 2>&1; then - echo "riscv64: no grub2 UEFI boot loader on the ESP; grub2-efi-riscv64 is missing" \ - >>/var/log/xcat/xcat.log - exit 1 -fi -%end diff --git a/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.tmpl b/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.tmpl new file mode 120000 index 0000000000..a105f935a4 --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.tmpl @@ -0,0 +1 @@ +compute.rhels10.riscv64.tmpl \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.pkglist b/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.pkglist deleted file mode 100644 index 437df1d02f..0000000000 --- a/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.pkglist +++ /dev/null @@ -1,16 +0,0 @@ -@Minimal Install -kernel -chrony -net-tools -nfs-utils -openssh-server -openssl -rsync -util-linux -wget -python3 -tar -bzip2 -perl-interpreter -grub2-efi-riscv64 -efibootmgr diff --git a/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.pkglist b/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.pkglist new file mode 120000 index 0000000000..9e60343b81 --- /dev/null +++ b/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.pkglist @@ -0,0 +1 @@ +../rh/compute.rhels10.riscv64.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.tmpl b/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.tmpl deleted file mode 100644 index dbf34f13c7..0000000000 --- a/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.tmpl +++ /dev/null @@ -1,79 +0,0 @@ -# Use text install -text -# Use network installation -%include /tmp/repos -# Keyboard layouts -keyboard --vckeymap=us --xlayouts='us' -# System language -lang en_US.UTF-8 - -# Network information -#KICKSTARTNET# -# Root password -rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password# -# Not run the Setup Agent on first boot -firstboot --disable -# Do not configure the X Window System -skipx -# System services -#services --enabled="chronyd" -# System timezone -timezone #TABLE:site:key=timezone:value# --utc -# Partition clearing information -zerombr -clearpart --all --initlabel -#XCAT_PARTITION_START# -%include /tmp/partitionfile -#XCAT_PARTITION_END# - -# Do not configure any iptables rules -firewall --disable -selinux --disable -reboot - -# riscv64: EL10 has no default crash kernel reservation for this architecture -# (kdumpctl get-default-crashkernel is empty), so the installer's kdump add-on -# would write the literal "crashkernel=auto", which the kernel ignores: nothing -# is reserved and kdump.service fails on every node. Leave kdump off here; a -# node that should take crash dumps gets a real reservation through -# linuximage.addkcmdline or bootparams.addkcmdline (crashkernel=). -%addon com_redhat_kdump --disable -%end - -# riscv64: the EL10 anaconda has no RISC-V EFI platform and always asks for the -# x86 UEFI boot loader packages (grub2-efi-x64, shim-x64), which do not exist -# for riscv64; tolerate that. The riscv64 package list pulls grub2-efi-riscv64 -# and efibootmgr in explicitly. -%packages --ignoremissing -#INCLUDE_DEFAULT_PKGLIST# - -%end - -%pre -{ -echo "Running Kickstart Pre-installation script..." -#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rhels10# -} &>>/tmp/pre-install.log -%end -%post --interpreter=/bin/bash -mkdir -p /var/log/xcat/ -cat /tmp/pre-install.log >>/var/log/xcat/xcat.log -{ -echo "Running Kickstart Post-installation script..." -#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat.rhels10# -#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10.riscv64# -#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10# -} &>>/var/log/xcat/xcat.log -%end - -# --ignoremissing above also hides a missing grub2-efi-riscv64, which would leave the -# node with no boot loader at all. Fail the installation instead of rebooting into -# firmware that has nothing to load. -%post --erroronfail --interpreter=/bin/bash -if [ ! -f /boot/efi/EFI/BOOT/BOOTRISCV64.EFI ] && - ! ls /boot/efi/EFI/*/grubriscv64.efi >/dev/null 2>&1; then - echo "riscv64: no grub2 UEFI boot loader on the ESP; grub2-efi-riscv64 is missing" \ - >>/var/log/xcat/xcat.log - exit 1 -fi -%end diff --git a/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.tmpl b/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.tmpl new file mode 120000 index 0000000000..5b27b1a6d4 --- /dev/null +++ b/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.tmpl @@ -0,0 +1 @@ +../rh/compute.rhels10.riscv64.tmpl \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/rocky/service.rocky10.riscv64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rocky/service.rocky10.riscv64.otherpkgs.pkglist deleted file mode 100644 index cfcb8349f7..0000000000 --- a/xCAT-server/share/xcat/install/rocky/service.rocky10.riscv64.otherpkgs.pkglist +++ /dev/null @@ -1,2 +0,0 @@ -xcat/xcat-core/xCATsn -xcat/xcat-dep/rh10/riscv64/goconserver diff --git a/xCAT-server/share/xcat/install/rocky/service.rocky10.riscv64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rocky/service.rocky10.riscv64.otherpkgs.pkglist new file mode 120000 index 0000000000..e434c04403 --- /dev/null +++ b/xCAT-server/share/xcat/install/rocky/service.rocky10.riscv64.otherpkgs.pkglist @@ -0,0 +1 @@ +../../netboot/rocky/service.rocky10.riscv64.otherpkgs.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.exlist b/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.exlist deleted file mode 100644 index 07436e39f8..0000000000 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.exlist +++ /dev/null @@ -1,33 +0,0 @@ -./boot* -./usr/include* -./usr/lib/locale* -./usr/lib64/perl5/Encode/CN* -./usr/lib64/perl5/Encode/JP* -./usr/lib64/perl5/Encode/TW* -./usr/lib64/perl5/Encode/KR* -./lib/kbd/keymaps/i386* -./lib/kbd/keymaps/mac* -./lib/kbd/keymaps/include* -./usr/local/include* -./usr/local/share/man* -./usr/share/man* -./usr/share/cracklib* -./usr/share/doc* -./usr/share/gnome* -./usr/share/i18n* -+./usr/share/i18n/en_US* -./usr/share/info* -./usr/share/locale/* -+./usr/share/locale/en_US* -+./usr/share/locale/C* -+./usr/share/locale/locale.alias -+./usr/lib/locale/locale-archive -+./usr/lib/locale/en* -+./usr/lib/locale/C* -./usr/share/omf* -./usr/share/vim/site/doc* -./usr/share/vim/vim74/doc* -./usr/share/zoneinfo* -./var/cache/man* -./var/lib/yum* -./tmp* diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.exlist b/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.exlist new file mode 120000 index 0000000000..554bf4f228 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.exlist @@ -0,0 +1 @@ +../rocky/compute.rocky10.riscv64.exlist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.pkglist deleted file mode 100644 index ccc8bfd798..0000000000 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.pkglist +++ /dev/null @@ -1,30 +0,0 @@ -@minimal-environment -initscripts -chrony -kernel -net-tools -nfs-utils -openssh-server -rsync -tar -util-linux -wget -python3 -tar -bzip2 -bc -dracut -dracut-network -NetworkManager -rsyslog -hostname -e2fsprogs -ethtool -parted -openssl -openssh-clients -bash -vim-minimal -rpm -iputils -perl-interpreter diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.pkglist new file mode 120000 index 0000000000..5aba674c90 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.pkglist @@ -0,0 +1 @@ +../rocky/compute.rocky10.riscv64.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.postinstall deleted file mode 100755 index 015cfec0f9..0000000000 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.postinstall +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh -#-- Do not remove following line if you want to make use of CVS version tracking -#-- $Id: compute.postinstall,v 1.21 2008/09/04 12:05:45 sikorsky Exp $ -#-- jurij.sikorsky@t-systems.cz -#-- -#-- this script is run after all packages from $profile.pkglist are installed -#-- -#-- it gets these arguments: -#-- -#-- $1 = install root (chroot directory for profile) -#-- $2 = OS version -#-- $3 = architecture -#-- $4 = profile name -#-- $5 = work dir (where genimage is located) -#-- -#-- -installroot=$1 -osver=$2 -arch=$3 -profile=$4 -workdir=$5 - -#-- Example how /etc/fstab can be automatically generated during image generation: -cat <$installroot/etc/fstab -proc /proc proc rw 0 0 -sysfs /sys sysfs rw 0 0 -devpts /dev/pts devpts rw,gid=5,mode=620 0 0 -END - -#-- Uncomment the line contains "cons" in /etc/inittab -#cons:12345:respawn:/sbin/smart_agetty -L 38400 console -#echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab - - -#-- Disable SELinux in the rootimg -#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default -#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" -if [ -f "$installroot/etc/selinux/config" ] -then - sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config -fi -#--for redhat 8 and 8.1 -#-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys -FIREWALLD="$installroot/etc/systemd/system/multi-user.target.wants/firewalld.service" -if [[ -f "$FIREWALLD" || -L "$FIREWALLD" ]] -then - rm -f $FIREWALLD -fi -FIREWALLD1="$installroot/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service" -if [[ -f "$FIREWALLD1" || -L "$FIREWALLD1" ]] -then - rm -f $FIREWALLD1 -fi - - -#-- Example of booted image versioning -#-- We want to know, with what configuration (version of the image) each node was booted. -#-- Hence, we keep image definition files and postscripts in CVS. During image generation we create file /etc/IMGVERSION and fill it with CVS "$Id$" of files with image definition (.pkglist, .exlist, .repolist, .postinstall). Then, during boot, each "CVS enabled" postscript (see /install/postscripts/cvs_template.sh and /install/postscripts/cvs_template.pl) adds one line to /etc/IMGVERSION. Then you can determine in any time what image you are running and what postscipts in which versions were run. -#cat /dev/null > $installroot/etc/IMGVERSION -#for ext in pkglist exlist postinstall repolist; do -# [ -r $workdir/$profile.$ext ] && cat $workdir/$profile.$ext | grep -E '^[[:space:]]*#.*[[:space:]]\$Id' >> $installroot/etc/IMGVERSION -#done diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.postinstall new file mode 120000 index 0000000000..57d725a641 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels10.riscv64.postinstall @@ -0,0 +1 @@ +../rocky/compute.rocky10.riscv64.postinstall \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.exlist b/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.exlist deleted file mode 100644 index 07436e39f8..0000000000 --- a/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.exlist +++ /dev/null @@ -1,33 +0,0 @@ -./boot* -./usr/include* -./usr/lib/locale* -./usr/lib64/perl5/Encode/CN* -./usr/lib64/perl5/Encode/JP* -./usr/lib64/perl5/Encode/TW* -./usr/lib64/perl5/Encode/KR* -./lib/kbd/keymaps/i386* -./lib/kbd/keymaps/mac* -./lib/kbd/keymaps/include* -./usr/local/include* -./usr/local/share/man* -./usr/share/man* -./usr/share/cracklib* -./usr/share/doc* -./usr/share/gnome* -./usr/share/i18n* -+./usr/share/i18n/en_US* -./usr/share/info* -./usr/share/locale/* -+./usr/share/locale/en_US* -+./usr/share/locale/C* -+./usr/share/locale/locale.alias -+./usr/lib/locale/locale-archive -+./usr/lib/locale/en* -+./usr/lib/locale/C* -./usr/share/omf* -./usr/share/vim/site/doc* -./usr/share/vim/vim74/doc* -./usr/share/zoneinfo* -./var/cache/man* -./var/lib/yum* -./tmp* diff --git a/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.exlist b/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.exlist new file mode 120000 index 0000000000..554bf4f228 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.exlist @@ -0,0 +1 @@ +../rocky/compute.rocky10.riscv64.exlist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.otherpkgs.pkglist b/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.otherpkgs.pkglist deleted file mode 100644 index cfcb8349f7..0000000000 --- a/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.otherpkgs.pkglist +++ /dev/null @@ -1,2 +0,0 @@ -xcat/xcat-core/xCATsn -xcat/xcat-dep/rh10/riscv64/goconserver diff --git a/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.otherpkgs.pkglist b/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.otherpkgs.pkglist new file mode 120000 index 0000000000..1515dad45b --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.otherpkgs.pkglist @@ -0,0 +1 @@ +../rocky/service.rocky10.riscv64.otherpkgs.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.pkglist b/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.pkglist deleted file mode 100644 index ac608b1483..0000000000 --- a/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.pkglist +++ /dev/null @@ -1,30 +0,0 @@ -@minimal-environment -chrony -kernel -net-tools -nfs-utils -openssh-server -rsync -tar -util-linux -wget -perl-DBD-MySQL -perl-DBD-Pg -perl-lib -python3 -tar -bzip2 -bc -dracut -dracut-network -rsyslog -hostname -e2fsprogs -ethtool -parted -openssl -openssh-clients -bash -vim-minimal -rpm -iputils diff --git a/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.pkglist b/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.pkglist new file mode 120000 index 0000000000..66a5bbf148 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.pkglist @@ -0,0 +1 @@ +../rocky/service.rocky10.riscv64.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.postinstall b/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.postinstall deleted file mode 100755 index 015cfec0f9..0000000000 --- a/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.postinstall +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh -#-- Do not remove following line if you want to make use of CVS version tracking -#-- $Id: compute.postinstall,v 1.21 2008/09/04 12:05:45 sikorsky Exp $ -#-- jurij.sikorsky@t-systems.cz -#-- -#-- this script is run after all packages from $profile.pkglist are installed -#-- -#-- it gets these arguments: -#-- -#-- $1 = install root (chroot directory for profile) -#-- $2 = OS version -#-- $3 = architecture -#-- $4 = profile name -#-- $5 = work dir (where genimage is located) -#-- -#-- -installroot=$1 -osver=$2 -arch=$3 -profile=$4 -workdir=$5 - -#-- Example how /etc/fstab can be automatically generated during image generation: -cat <$installroot/etc/fstab -proc /proc proc rw 0 0 -sysfs /sys sysfs rw 0 0 -devpts /dev/pts devpts rw,gid=5,mode=620 0 0 -END - -#-- Uncomment the line contains "cons" in /etc/inittab -#cons:12345:respawn:/sbin/smart_agetty -L 38400 console -#echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab - - -#-- Disable SELinux in the rootimg -#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default -#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" -if [ -f "$installroot/etc/selinux/config" ] -then - sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config -fi -#--for redhat 8 and 8.1 -#-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys -FIREWALLD="$installroot/etc/systemd/system/multi-user.target.wants/firewalld.service" -if [[ -f "$FIREWALLD" || -L "$FIREWALLD" ]] -then - rm -f $FIREWALLD -fi -FIREWALLD1="$installroot/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service" -if [[ -f "$FIREWALLD1" || -L "$FIREWALLD1" ]] -then - rm -f $FIREWALLD1 -fi - - -#-- Example of booted image versioning -#-- We want to know, with what configuration (version of the image) each node was booted. -#-- Hence, we keep image definition files and postscripts in CVS. During image generation we create file /etc/IMGVERSION and fill it with CVS "$Id$" of files with image definition (.pkglist, .exlist, .repolist, .postinstall). Then, during boot, each "CVS enabled" postscript (see /install/postscripts/cvs_template.sh and /install/postscripts/cvs_template.pl) adds one line to /etc/IMGVERSION. Then you can determine in any time what image you are running and what postscipts in which versions were run. -#cat /dev/null > $installroot/etc/IMGVERSION -#for ext in pkglist exlist postinstall repolist; do -# [ -r $workdir/$profile.$ext ] && cat $workdir/$profile.$ext | grep -E '^[[:space:]]*#.*[[:space:]]\$Id' >> $installroot/etc/IMGVERSION -#done diff --git a/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.postinstall b/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.postinstall new file mode 120000 index 0000000000..57d725a641 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/service.rhels10.riscv64.postinstall @@ -0,0 +1 @@ +../rocky/compute.rocky10.riscv64.postinstall \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/rocky/service.rocky10.riscv64.exlist b/xCAT-server/share/xcat/netboot/rocky/service.rocky10.riscv64.exlist deleted file mode 100644 index 07436e39f8..0000000000 --- a/xCAT-server/share/xcat/netboot/rocky/service.rocky10.riscv64.exlist +++ /dev/null @@ -1,33 +0,0 @@ -./boot* -./usr/include* -./usr/lib/locale* -./usr/lib64/perl5/Encode/CN* -./usr/lib64/perl5/Encode/JP* -./usr/lib64/perl5/Encode/TW* -./usr/lib64/perl5/Encode/KR* -./lib/kbd/keymaps/i386* -./lib/kbd/keymaps/mac* -./lib/kbd/keymaps/include* -./usr/local/include* -./usr/local/share/man* -./usr/share/man* -./usr/share/cracklib* -./usr/share/doc* -./usr/share/gnome* -./usr/share/i18n* -+./usr/share/i18n/en_US* -./usr/share/info* -./usr/share/locale/* -+./usr/share/locale/en_US* -+./usr/share/locale/C* -+./usr/share/locale/locale.alias -+./usr/lib/locale/locale-archive -+./usr/lib/locale/en* -+./usr/lib/locale/C* -./usr/share/omf* -./usr/share/vim/site/doc* -./usr/share/vim/vim74/doc* -./usr/share/zoneinfo* -./var/cache/man* -./var/lib/yum* -./tmp* diff --git a/xCAT-server/share/xcat/netboot/rocky/service.rocky10.riscv64.exlist b/xCAT-server/share/xcat/netboot/rocky/service.rocky10.riscv64.exlist new file mode 120000 index 0000000000..751e4cd2df --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rocky/service.rocky10.riscv64.exlist @@ -0,0 +1 @@ +compute.rocky10.riscv64.exlist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/rocky/service.rocky10.riscv64.postinstall b/xCAT-server/share/xcat/netboot/rocky/service.rocky10.riscv64.postinstall deleted file mode 100755 index 015cfec0f9..0000000000 --- a/xCAT-server/share/xcat/netboot/rocky/service.rocky10.riscv64.postinstall +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh -#-- Do not remove following line if you want to make use of CVS version tracking -#-- $Id: compute.postinstall,v 1.21 2008/09/04 12:05:45 sikorsky Exp $ -#-- jurij.sikorsky@t-systems.cz -#-- -#-- this script is run after all packages from $profile.pkglist are installed -#-- -#-- it gets these arguments: -#-- -#-- $1 = install root (chroot directory for profile) -#-- $2 = OS version -#-- $3 = architecture -#-- $4 = profile name -#-- $5 = work dir (where genimage is located) -#-- -#-- -installroot=$1 -osver=$2 -arch=$3 -profile=$4 -workdir=$5 - -#-- Example how /etc/fstab can be automatically generated during image generation: -cat <$installroot/etc/fstab -proc /proc proc rw 0 0 -sysfs /sys sysfs rw 0 0 -devpts /dev/pts devpts rw,gid=5,mode=620 0 0 -END - -#-- Uncomment the line contains "cons" in /etc/inittab -#cons:12345:respawn:/sbin/smart_agetty -L 38400 console -#echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab - - -#-- Disable SELinux in the rootimg -#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default -#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" -if [ -f "$installroot/etc/selinux/config" ] -then - sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config -fi -#--for redhat 8 and 8.1 -#-- Need to disable firewalld, otherwise, the remoteshell script will not able to get all the SSH keys -FIREWALLD="$installroot/etc/systemd/system/multi-user.target.wants/firewalld.service" -if [[ -f "$FIREWALLD" || -L "$FIREWALLD" ]] -then - rm -f $FIREWALLD -fi -FIREWALLD1="$installroot/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service" -if [[ -f "$FIREWALLD1" || -L "$FIREWALLD1" ]] -then - rm -f $FIREWALLD1 -fi - - -#-- Example of booted image versioning -#-- We want to know, with what configuration (version of the image) each node was booted. -#-- Hence, we keep image definition files and postscripts in CVS. During image generation we create file /etc/IMGVERSION and fill it with CVS "$Id$" of files with image definition (.pkglist, .exlist, .repolist, .postinstall). Then, during boot, each "CVS enabled" postscript (see /install/postscripts/cvs_template.sh and /install/postscripts/cvs_template.pl) adds one line to /etc/IMGVERSION. Then you can determine in any time what image you are running and what postscipts in which versions were run. -#cat /dev/null > $installroot/etc/IMGVERSION -#for ext in pkglist exlist postinstall repolist; do -# [ -r $workdir/$profile.$ext ] && cat $workdir/$profile.$ext | grep -E '^[[:space:]]*#.*[[:space:]]\$Id' >> $installroot/etc/IMGVERSION -#done diff --git a/xCAT-server/share/xcat/netboot/rocky/service.rocky10.riscv64.postinstall b/xCAT-server/share/xcat/netboot/rocky/service.rocky10.riscv64.postinstall new file mode 120000 index 0000000000..86c3964bd3 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rocky/service.rocky10.riscv64.postinstall @@ -0,0 +1 @@ +compute.rocky10.riscv64.postinstall \ No newline at end of file From 4a894610a50a2e958745aab42a061cc0b64a5905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Mon, 19 Oct 2026 11:40:08 -0300 Subject: [PATCH 09/22] test(profiles): exercise packaged assets and custom profile precedence --- .github/workflows/xcat_test.yml | 6 +- xCAT-test/native/profile_package_payload.t | 43 +++++++ xCAT-test/unit/profile_customization.t | 123 +++++++++++++++++++++ 3 files changed, 169 insertions(+), 3 deletions(-) create mode 100644 xCAT-test/native/profile_package_payload.t create mode 100644 xCAT-test/unit/profile_customization.t diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml index da6e641b74..5874b752e6 100644 --- a/.github/workflows/xcat_test.yml +++ b/.github/workflows/xcat_test.yml @@ -15,7 +15,7 @@ jobs: - name: Install lifecycle test dependencies run: sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests ucf debconf-utils systemd libxml-simple-perl apache2 curl - name: Test Debian package lifecycle - run: prove -v xCAT-test/native/xcatd_debian_lifecycle.t xCAT-test/native/xcatd_restart_callers.t xCAT-test/native/apache_package_lifecycle.t xCAT-test/native/package_upgrade_logging.t + run: prove -v xCAT-test/native/xcatd_debian_lifecycle.t xCAT-test/native/xcatd_restart_callers.t xCAT-test/native/apache_package_lifecycle.t xCAT-test/native/package_upgrade_logging.t xCAT-test/native/profile_package_payload.t - name: Install image test dependencies if: ${{ !cancelled() }} @@ -111,8 +111,8 @@ jobs: - name: Install lifecycle test dependencies run: | dnf install -y epel-release - dnf --enablerepo=${{ matrix.repository }} install -y perl perl-Capture-Tiny perl-File-Slurper perl-Test-Simple rpm-build bubblewrap systemd chkconfig initscripts tar gzip which diffutils httpd curl procps-ng + dnf --enablerepo=${{ matrix.repository }} install -y perl perl-Capture-Tiny perl-File-Slurper perl-Test-Simple perl-DBI perl-DBD-SQLite perl-JSON perl-XML-Simple rpm-build bubblewrap systemd chkconfig initscripts tar gzip which diffutils httpd curl procps-ng - name: Enable lifecycle test namespaces run: sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 - name: Test RPM package lifecycle - run: su -s /bin/sh nobody -c 'prove -v xCAT-test/native/xcatd_rpm_lifecycle.t xCAT-test/native/apache_rpm_configuration.t xCAT-test/native/apache_package_lifecycle.t xCAT-test/native/package_upgrade_logging.t' + run: su -s /bin/sh nobody -c 'prove -v xCAT-test/native/xcatd_rpm_lifecycle.t xCAT-test/native/apache_rpm_configuration.t xCAT-test/native/apache_package_lifecycle.t xCAT-test/native/package_upgrade_logging.t xCAT-test/native/profile_package_payload.t' diff --git a/xCAT-test/native/profile_package_payload.t b/xCAT-test/native/profile_package_payload.t new file mode 100644 index 0000000000..72b3a6020c --- /dev/null +++ b/xCAT-test/native/profile_package_payload.t @@ -0,0 +1,43 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use FindBin; +use lib "$FindBin::Bin/../lib"; +use File::Temp qw(tempdir); +use File::Slurper qw(read_binary); +use Fcntl qw(S_IMODE); +use Test::More; +use XCAT::Test::File qw(repo_path); +use XCAT::Test::Lifecycle; +use XCAT::Test::RPM; +use XCAT::Test::Process qw(run_command); + +plan skip_all => 'requires Linux package tools' unless $^O eq 'linux'; +die 'run package builds as an unprivileged user' unless $>; +my $root = tempdir(CLEANUP => 1); +if (-f '/etc/debian_version') { + my $deb = XCAT::Test::Lifecycle::build_deb('xCAT-server'); + XCAT::Test::Lifecycle::checked('dpkg-deb', '-x', $deb, $root); +} else { + my $rpm = XCAT::Test::RPM->build('xCAT-server', 1); + XCAT::Test::Lifecycle::checked('bash', '-o', 'pipefail', '-c', + 'cd "$1" && rpm2cpio "$2" | cpio -idm --quiet', 'bash', $root, $rpm); +} +my $share = repo_path('xCAT-server/share/xcat'); +my @assets = grep { /riscv64\./ } + glob "$share/{install,netboot}/{rh,rocky}/*"; +ok(@assets, 'finds the RISC-V profile assets'); +for my $source (@assets) { + my $relative = substr($source, length($share) + 1); + my $delivered = "$root/opt/xcat/share/xcat/$relative"; + ok(-r $delivered, "$relative is readable after extraction") or next; + is(read_binary($delivered), read_binary($source), "$relative retains its complete contents"); + is(S_IMODE((stat($delivered))[2]), S_IMODE((stat($source))[2]), + "$relative retains its permissions"); +} +my ($status, $output) = run_command($^X, + repo_path('xCAT-test/unit/profile_customization.t'), "$root/opt/xcat"); +is($status, 0, 'packaged profiles resolve and remain independently customizable') or diag($output); + +done_testing(); diff --git a/xCAT-test/unit/profile_customization.t b/xCAT-test/unit/profile_customization.t new file mode 100644 index 0000000000..a654dcf883 --- /dev/null +++ b/xCAT-test/unit/profile_customization.t @@ -0,0 +1,123 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use FindBin; +use lib "$FindBin::Bin/../lib"; +use lib "$FindBin::Bin/../../perl-xCAT", "$FindBin::Bin/../../xCAT-server/lib/perl"; +use File::Copy qw(copy); +use File::Path qw(make_path); +use File::Slurper qw(read_binary write_binary); +use File::Temp qw(tempdir); +use Fcntl qw(S_IMODE); +use Test::More; +use XCAT::Test::File qw(repo_path); + +my $prefix = shift @ARGV // repo_path('xCAT-server'); +my $work = tempdir(CLEANUP => 1); +$ENV{XCATROOT} = $prefix; +$ENV{XCATCFG} = "SQLite:$work/db"; +make_path("$work/db", "$work/install"); +require xCAT::SvrUtils; +require xCAT::Postage; +require xCAT::Table; + +my %packages = ( + 'install/compute' => ['@Minimal Install', qw(kernel chrony net-tools nfs-utils + openssh-server openssl rsync util-linux wget python3 tar bzip2 + perl-interpreter grub2-efi-riscv64 efibootmgr)], + 'netboot/compute' => ['@minimal-environment', qw(initscripts chrony kernel + net-tools nfs-utils openssh-server rsync tar util-linux wget python3 tar + bzip2 bc dracut dracut-network NetworkManager rsyslog hostname e2fsprogs + ethtool parted openssl openssh-clients bash vim-minimal rpm iputils + perl-interpreter)], + 'netboot/service' => ['@minimal-environment', qw(chrony kernel net-tools + nfs-utils openssh-server rsync tar util-linux wget perl-DBD-MySQL + perl-DBD-Pg perl-lib python3 tar bzip2 bc dracut dracut-network rsyslog + hostname e2fsprogs ethtool parted openssl openssh-clients bash + vim-minimal rpm iputils)], +); + +my @cases; +for my $family (['rh', 'rhels10'], ['rocky', 'rocky10']) { + my ($directory, $os) = @$family; + for my $profile (qw(compute service)) { + push @cases, map { ['install', $directory, $profile, $os, 'riscv64', $_] } + qw(tmpl pkglist); + push @cases, map { ['netboot', $directory, $profile, $os, 'riscv64', $_] } + qw(pkglist exlist postinstall); + } + push @cases, map { [$_, $directory, 'service', $os, 'riscv64', 'otherpkgs.pkglist'] } + qw(install netboot); +} + +for my $case (@cases) { + my ($kind, $directory, $profile, $os, $arch, $extension) = @$case; + my $base = "$prefix/share/xcat/$kind/$directory"; + my $name = "$profile.$os.$arch.$extension"; + subtest "$kind/$directory/$name" => sub { + my $selected = $extension eq 'postinstall' + ? xCAT::SvrUtils->get_postinstall_file_name($base, $profile, "$os.2", $arch) + : xCAT::SvrUtils::get_file_name($base, $extension, $profile, "$os.2", $arch); + is($selected, "$base/$name", 'retains the public profile filename'); + ok(defined($selected) && -r $selected, 'selected asset is readable') or return; + is(sprintf('%04o', S_IMODE((stat($selected))[2])), + $extension eq 'postinstall' ? '0755' : '0644', + 'retains the asset permissions'); + my $original = read_binary($selected); + my $custom = "$work/$name"; + copy($selected, $custom) or die "copy $selected: $!"; + is(read_binary($custom), $original, 'a custom copy contains the complete asset'); + if ($extension eq 'otherpkgs.pkglist') { + is_deeply([xCAT::Postage::get_pkglist_records($selected)], + ['xcat/xcat-core/xCATsn', 'xcat/xcat-dep/rh10/riscv64/goconserver'], + 'the service node retains its architecture-specific packages'); + } + if ($extension eq 'pkglist' && $packages{"$kind/$profile"}) { + is_deeply([xCAT::Postage::get_pkglist_records($selected)], + $packages{"$kind/$profile"}, 'retains package order and repeated entries'); + } + }; +} + +my $site = xCAT::Table->new('site', -create => 1) or die 'Cannot create site table'; +$site->setAttribs({key => 'installdir'}, {value => "$work/install"}); +$site->close(); +my $custom = "$work/install/custom/install/rocky"; +make_path($custom); +my $name = 'compute.rocky10.riscv64'; +copy("$prefix/share/xcat/install/rocky/$name.tmpl", "$custom/$name.tmpl") or die $!; +write_binary("$custom/$name.pkglist", "local-package\n"); +my ($status, $error) = xCAT::SvrUtils->update_tables_with_templates( + 'rocky10.2', 'riscv64', '/install/media', 'fixture'); +is($status, 0, 'discovers the custom and shipped profiles') or diag($error); +my $images = xCAT::Table->new('linuximage') or die 'Cannot open linuximage table'; +my $compute = $images->getAttribs({imagename => 'rocky10.2-riscv64-install-compute'}, 'template', 'pkglist'); +is($compute->{template}, "$custom/$name.tmpl", 'image discovery prefers the custom template'); +is($compute->{pkglist}, "$custom/$name.pkglist", 'image discovery prefers the custom package list'); +is(xCAT::Postage::get_pkglist_tex($compute->{pkglist}), 'local-package', + 'the selected custom package list reaches the package reader'); +my $service = $images->getAttribs({imagename => 'rocky10.2-riscv64-install-service'}, 'template'); +is($service->{template}, "$prefix/share/xcat/install/rocky/service.rocky10.riscv64.tmpl", + 'a different profile still uses its shipped template'); +$images->close(); + +my $rh_custom = "$work/install/custom/install/rh"; +make_path($rh_custom); +my $rh_name = 'compute.rhels10.riscv64.tmpl'; +my $shipped = read_binary("$prefix/share/xcat/install/rh/$rh_name"); +write_binary("$rh_custom/$rh_name", $shipped . "\n# custom compute template\n"); +($status, $error) = xCAT::SvrUtils->update_tables_with_templates( + 'rhels10.2', 'riscv64', '/install/media', 'fixture'); +is($status, 0, 'discovers the customized canonical profile and shipped alias') or diag($error); +$images = xCAT::Table->new('linuximage') or die 'Cannot open linuximage table'; +$compute = $images->getAttribs({imagename => 'rhels10.2-riscv64-install-compute'}, 'template'); +is($compute->{template}, "$rh_custom/$rh_name", 'image discovery selects the custom canonical profile'); +$service = $images->getAttribs({imagename => 'rhels10.2-riscv64-install-service'}, 'template'); +is($service->{template}, "$prefix/share/xcat/install/rh/service.rhels10.riscv64.tmpl", + 'the service profile retains its shipped alias'); +is(read_binary($service->{template}), $shipped, + 'the shipped alias does not inherit the custom canonical profile'); +$images->close(); + +done_testing(); From 0d1e044ea92baae4ade0717d00ba9679c46eddfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Mon, 19 Oct 2026 11:41:26 -0300 Subject: [PATCH 10/22] refactor(ubuntu): share identical release and architecture package lists --- .../ubuntu/compute.ubuntu22.04.pkglist | 6 +---- .../ubuntu/compute.ubuntu24.04.pkglist | 6 +---- .../ubuntu/compute.ubuntu26.04.pkglist | 6 +---- .../compute.ubuntu26.04.riscv64.pkglist | 16 +------------ .../install/ubuntu/kvm.ubuntu14.04.pkglist | 12 +--------- .../install/ubuntu/kvm.ubuntu16.04.pkglist | 12 +--------- .../compute.ubuntu24.04.riscv64.pkglist | 23 +------------------ .../compute.ubuntu26.04.riscv64.pkglist | 19 +-------------- 8 files changed, 8 insertions(+), 92 deletions(-) mode change 100644 => 120000 xCAT-server/share/xcat/install/ubuntu/compute.ubuntu22.04.pkglist mode change 100644 => 120000 xCAT-server/share/xcat/install/ubuntu/compute.ubuntu24.04.pkglist mode change 100644 => 120000 xCAT-server/share/xcat/install/ubuntu/compute.ubuntu26.04.pkglist mode change 100644 => 120000 xCAT-server/share/xcat/install/ubuntu/compute.ubuntu26.04.riscv64.pkglist mode change 100644 => 120000 xCAT-server/share/xcat/install/ubuntu/kvm.ubuntu14.04.pkglist mode change 100644 => 120000 xCAT-server/share/xcat/install/ubuntu/kvm.ubuntu16.04.pkglist mode change 100644 => 120000 xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu24.04.riscv64.pkglist mode change 100644 => 120000 xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.riscv64.pkglist diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu22.04.pkglist b/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu22.04.pkglist deleted file mode 100644 index aaec41835f..0000000000 --- a/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu22.04.pkglist +++ /dev/null @@ -1,5 +0,0 @@ -openssh-server -chrony -gawk -nfs-common -snmpd diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu22.04.pkglist b/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu22.04.pkglist new file mode 120000 index 0000000000..8fd2f4f507 --- /dev/null +++ b/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu22.04.pkglist @@ -0,0 +1 @@ +compute.ubuntu20.04.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu24.04.pkglist b/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu24.04.pkglist deleted file mode 100644 index aaec41835f..0000000000 --- a/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu24.04.pkglist +++ /dev/null @@ -1,5 +0,0 @@ -openssh-server -chrony -gawk -nfs-common -snmpd diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu24.04.pkglist b/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu24.04.pkglist new file mode 120000 index 0000000000..8fd2f4f507 --- /dev/null +++ b/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu24.04.pkglist @@ -0,0 +1 @@ +compute.ubuntu20.04.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu26.04.pkglist b/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu26.04.pkglist deleted file mode 100644 index aaec41835f..0000000000 --- a/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu26.04.pkglist +++ /dev/null @@ -1,5 +0,0 @@ -openssh-server -chrony -gawk -nfs-common -snmpd diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu26.04.pkglist b/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu26.04.pkglist new file mode 120000 index 0000000000..8fd2f4f507 --- /dev/null +++ b/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu26.04.pkglist @@ -0,0 +1 @@ +compute.ubuntu20.04.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu26.04.riscv64.pkglist b/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu26.04.riscv64.pkglist deleted file mode 100644 index 813cb2bc2f..0000000000 --- a/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu26.04.riscv64.pkglist +++ /dev/null @@ -1,15 +0,0 @@ -bash -nfs-common -openssl -isc-dhcp-client -libc-bin -openssh-server -openssh-client -wget -vim -rsync -busybox-static -gawk -bind9-dnsutils -chrony -gpg diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu26.04.riscv64.pkglist b/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu26.04.riscv64.pkglist new file mode 120000 index 0000000000..6d378f56d5 --- /dev/null +++ b/xCAT-server/share/xcat/install/ubuntu/compute.ubuntu26.04.riscv64.pkglist @@ -0,0 +1 @@ +compute.ubuntu26.04.x86_64.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/ubuntu/kvm.ubuntu14.04.pkglist b/xCAT-server/share/xcat/install/ubuntu/kvm.ubuntu14.04.pkglist deleted file mode 100644 index 1b4a77b1ed..0000000000 --- a/xCAT-server/share/xcat/install/ubuntu/kvm.ubuntu14.04.pkglist +++ /dev/null @@ -1,11 +0,0 @@ -openssh-server -ntp -gawk -nfs-common -snmpd -qemu-kvm -libvirt-bin -bridge-utils -libcap2-bin -vlan -tmux diff --git a/xCAT-server/share/xcat/install/ubuntu/kvm.ubuntu14.04.pkglist b/xCAT-server/share/xcat/install/ubuntu/kvm.ubuntu14.04.pkglist new file mode 120000 index 0000000000..1d6f7a810f --- /dev/null +++ b/xCAT-server/share/xcat/install/ubuntu/kvm.ubuntu14.04.pkglist @@ -0,0 +1 @@ +kvm.ubuntu12.04.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/ubuntu/kvm.ubuntu16.04.pkglist b/xCAT-server/share/xcat/install/ubuntu/kvm.ubuntu16.04.pkglist deleted file mode 100644 index 1b4a77b1ed..0000000000 --- a/xCAT-server/share/xcat/install/ubuntu/kvm.ubuntu16.04.pkglist +++ /dev/null @@ -1,11 +0,0 @@ -openssh-server -ntp -gawk -nfs-common -snmpd -qemu-kvm -libvirt-bin -bridge-utils -libcap2-bin -vlan -tmux diff --git a/xCAT-server/share/xcat/install/ubuntu/kvm.ubuntu16.04.pkglist b/xCAT-server/share/xcat/install/ubuntu/kvm.ubuntu16.04.pkglist new file mode 120000 index 0000000000..1d6f7a810f --- /dev/null +++ b/xCAT-server/share/xcat/install/ubuntu/kvm.ubuntu16.04.pkglist @@ -0,0 +1 @@ +kvm.ubuntu12.04.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu24.04.riscv64.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu24.04.riscv64.pkglist deleted file mode 100644 index 4c6b2b3c42..0000000000 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu24.04.riscv64.pkglist +++ /dev/null @@ -1,22 +0,0 @@ -bash -nfs-common -openssl -isc-dhcp-client -libc-bin -linux-image-generic -openssh-server -openssh-client -wget -rsync -busybox-static -gawk -bind9-dnsutils -tar -gzip -xz-utils -cpio -chrony -util-linux-extra -iproute2 -dracut -dracut-network diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu24.04.riscv64.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu24.04.riscv64.pkglist new file mode 120000 index 0000000000..faaa2c0254 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu24.04.riscv64.pkglist @@ -0,0 +1 @@ +compute.ubuntu24.04.x86_64.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.riscv64.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.riscv64.pkglist deleted file mode 100644 index ef2f26fe10..0000000000 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.riscv64.pkglist +++ /dev/null @@ -1,18 +0,0 @@ -bash -nfs-common -openssl -isc-dhcp-client -libc-bin -linux-image-generic -openssh-server -openssh-client -wget -rsync -busybox-static -gawk -bind9-dnsutils -tar -gzip -xz-utils -cpio -chrony diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.riscv64.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.riscv64.pkglist new file mode 120000 index 0000000000..6d378f56d5 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.riscv64.pkglist @@ -0,0 +1 @@ +compute.ubuntu26.04.x86_64.pkglist \ No newline at end of file From 16ebc987023427a1cedda57c4228600f4a32d268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Mon, 19 Oct 2026 11:42:52 -0300 Subject: [PATCH 11/22] test(ubuntu): cover package-list aliases across releases and architectures --- xCAT-test/native/profile_package_payload.t | 3 ++ xCAT-test/unit/profile_customization.t | 34 +++++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/xCAT-test/native/profile_package_payload.t b/xCAT-test/native/profile_package_payload.t index 72b3a6020c..861a9e7a9a 100644 --- a/xCAT-test/native/profile_package_payload.t +++ b/xCAT-test/native/profile_package_payload.t @@ -28,6 +28,9 @@ my $share = repo_path('xCAT-server/share/xcat'); my @assets = grep { /riscv64\./ } glob "$share/{install,netboot}/{rh,rocky}/*"; ok(@assets, 'finds the RISC-V profile assets'); +my @ubuntu = glob "$share/{install,netboot}/ubuntu/*.pkglist"; +ok(@ubuntu, 'finds the Ubuntu package lists'); +push @assets, @ubuntu; for my $source (@assets) { my $relative = substr($source, length($share) + 1); my $delivered = "$root/opt/xcat/share/xcat/$relative"; diff --git a/xCAT-test/unit/profile_customization.t b/xCAT-test/unit/profile_customization.t index a654dcf883..f907884d33 100644 --- a/xCAT-test/unit/profile_customization.t +++ b/xCAT-test/unit/profile_customization.t @@ -51,10 +51,36 @@ for my $family (['rh', 'rhels10'], ['rocky', 'rocky10']) { qw(install netboot); } +my $ubuntu_compute = [qw(openssh-server chrony gawk nfs-common snmpd)]; +my $ubuntu_kvm = [qw(openssh-server ntp gawk nfs-common snmpd qemu-kvm + libvirt-bin bridge-utils libcap2-bin vlan tmux)]; +for my $release (qw(20.04 22.04 24.04 26.04)) { + push @cases, ['install', 'ubuntu', 'compute', "ubuntu$release", 'aarch64', + 'pkglist', "compute.ubuntu$release.pkglist", $ubuntu_compute]; +} +for my $release (qw(12.04 14.04 16.04)) { + push @cases, ['install', 'ubuntu', 'kvm', "ubuntu$release", 'x86_64', + 'pkglist', "kvm.ubuntu$release.pkglist", $ubuntu_kvm]; +} +push @cases, ['install', 'ubuntu', 'compute', 'ubuntu26.04', 'riscv64', + 'pkglist', 'compute.ubuntu26.04.riscv64.pkglist', + [qw(bash nfs-common openssl isc-dhcp-client libc-bin openssh-server + openssh-client wget vim rsync busybox-static gawk bind9-dnsutils chrony gpg)]]; +for my $release (qw(24.04 26.04)) { + my @expected = qw(bash nfs-common openssl isc-dhcp-client libc-bin + linux-image-generic openssh-server openssh-client wget rsync + busybox-static gawk bind9-dnsutils tar gzip xz-utils cpio chrony); + push @expected, qw(util-linux-extra iproute2 dracut dracut-network) + if $release eq '24.04'; + push @cases, ['netboot', 'ubuntu', 'compute', "ubuntu$release", 'riscv64', + 'pkglist', "compute.ubuntu$release.riscv64.pkglist", \@expected]; +} + for my $case (@cases) { - my ($kind, $directory, $profile, $os, $arch, $extension) = @$case; + my ($kind, $directory, $profile, $os, $arch, $extension, $name, $expected_packages) = @$case; my $base = "$prefix/share/xcat/$kind/$directory"; - my $name = "$profile.$os.$arch.$extension"; + $name //= "$profile.$os.$arch.$extension"; + $expected_packages //= $packages{"$kind/$profile"}; subtest "$kind/$directory/$name" => sub { my $selected = $extension eq 'postinstall' ? xCAT::SvrUtils->get_postinstall_file_name($base, $profile, "$os.2", $arch) @@ -73,9 +99,9 @@ for my $case (@cases) { ['xcat/xcat-core/xCATsn', 'xcat/xcat-dep/rh10/riscv64/goconserver'], 'the service node retains its architecture-specific packages'); } - if ($extension eq 'pkglist' && $packages{"$kind/$profile"}) { + if ($extension eq 'pkglist' && $expected_packages) { is_deeply([xCAT::Postage::get_pkglist_records($selected)], - $packages{"$kind/$profile"}, 'retains package order and repeated entries'); + $expected_packages, 'retains package order and repeated entries'); } }; } From 7f3a0acf8e22a84d18d8b8f2e84d2b6fb141134b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Mon, 19 Oct 2026 11:48:36 -0300 Subject: [PATCH 12/22] test(profiles): retain Rocky assets in the reduced RPM --- xCAT-test/native/profile_package_payload.t | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/xCAT-test/native/profile_package_payload.t b/xCAT-test/native/profile_package_payload.t index 861a9e7a9a..6aedc3d0c5 100644 --- a/xCAT-test/native/profile_package_payload.t +++ b/xCAT-test/native/profile_package_payload.t @@ -43,4 +43,23 @@ my ($status, $output) = run_command($^X, repo_path('xCAT-test/unit/profile_customization.t'), "$root/opt/xcat"); is($status, 0, 'packaged profiles resolve and remain independently customizable') or diag($output); +if (!-f '/etc/debian_version') { + local $ENV{fsm} = 1; + my $reduced = tempdir(CLEANUP => 1); + my $rpm = XCAT::Test::RPM->build('xCAT-server', 1); + XCAT::Test::Lifecycle::checked('bash', '-o', 'pipefail', '-c', + 'cd "$1" && rpm2cpio "$2" | cpio -idm --quiet', 'bash', $reduced, $rpm); + ok(!-e "$reduced/opt/xcat/share/xcat/install", 'the reduced RPM omits install profiles'); + ok(!-e "$reduced/opt/xcat/share/xcat/netboot/rh", 'the reduced RPM omits RHEL netboot profiles'); + for my $source (glob "$share/netboot/rocky/*.riscv64.*") { + my $relative = substr($source, length($share) + 1); + my $delivered = "$reduced/opt/xcat/share/xcat/$relative"; + ok(-r $delivered, "reduced RPM: $relative still resolves") or next; + is(read_binary($delivered), read_binary($source), + "reduced RPM: $relative retains its complete contents"); + is(S_IMODE((stat($delivered))[2]), S_IMODE((stat($source))[2]), + "reduced RPM: $relative retains its permissions"); + } +} + done_testing(); From 91e19b16b1438e4db973e2670f3b7ffd4247b7fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Mon, 19 Oct 2026 19:01:02 -0300 Subject: [PATCH 13/22] test(profiles): check packaged modes independently of checkout RPM preparation removes group write permission from source files. Assert the packaged data and postinstall modes instead of comparing them with checkout permissions. Report modes in octal and keep the content, alias and customization checks. --- xCAT-test/native/profile_package_payload.t | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-test/native/profile_package_payload.t b/xCAT-test/native/profile_package_payload.t index 6aedc3d0c5..0711a6d9bf 100644 --- a/xCAT-test/native/profile_package_payload.t +++ b/xCAT-test/native/profile_package_payload.t @@ -36,8 +36,8 @@ for my $source (@assets) { my $delivered = "$root/opt/xcat/share/xcat/$relative"; ok(-r $delivered, "$relative is readable after extraction") or next; is(read_binary($delivered), read_binary($source), "$relative retains its complete contents"); - is(S_IMODE((stat($delivered))[2]), S_IMODE((stat($source))[2]), - "$relative retains its permissions"); + is(sprintf('%04o', S_IMODE((stat($delivered))[2])), $source =~ /\.postinstall$/ ? '0755' : '0644', + "$relative has the packaged permissions"); } my ($status, $output) = run_command($^X, repo_path('xCAT-test/unit/profile_customization.t'), "$root/opt/xcat"); @@ -57,8 +57,8 @@ if (!-f '/etc/debian_version') { ok(-r $delivered, "reduced RPM: $relative still resolves") or next; is(read_binary($delivered), read_binary($source), "reduced RPM: $relative retains its complete contents"); - is(S_IMODE((stat($delivered))[2]), S_IMODE((stat($source))[2]), - "reduced RPM: $relative retains its permissions"); + is(sprintf('%04o', S_IMODE((stat($delivered))[2])), $source =~ /\.postinstall$/ ? '0755' : '0644', + "reduced RPM: $relative has the packaged permissions"); } } From fa29763b71ae99e971572c347a00d5effa4bf9d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Mon, 19 Oct 2026 19:29:44 -0300 Subject: [PATCH 14/22] test(profiles): allow group-writable source checkouts Check executable bits when selecting source profiles. Exact package modes remain covered by the native payload test. --- xCAT-test/unit/profile_customization.t | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-test/unit/profile_customization.t b/xCAT-test/unit/profile_customization.t index f907884d33..03851240d3 100644 --- a/xCAT-test/unit/profile_customization.t +++ b/xCAT-test/unit/profile_customization.t @@ -87,9 +87,9 @@ for my $case (@cases) { : xCAT::SvrUtils::get_file_name($base, $extension, $profile, "$os.2", $arch); is($selected, "$base/$name", 'retains the public profile filename'); ok(defined($selected) && -r $selected, 'selected asset is readable') or return; - is(sprintf('%04o', S_IMODE((stat($selected))[2])), - $extension eq 'postinstall' ? '0755' : '0644', - 'retains the asset permissions'); + is(sprintf('%03o', S_IMODE((stat($selected))[2]) & oct('111')), + $extension eq 'postinstall' ? '111' : '000', + 'only postinstall assets are executable'); my $original = read_binary($selected); my $custom = "$work/$name"; copy($selected, $custom) or die "copy $selected: $!"; From 0ad1448564d20090d981dcb9e610abc9bbecbf9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Mon, 19 Oct 2026 19:31:25 -0300 Subject: [PATCH 15/22] fix(packaging): remove write access from Debian profile payloads Group-writable sources leave install and netboot assets writable by other users in the Debian package. Remove group and other write permission from those two staged trees. Preserve executable bits and leave source files and the rest of the payload unchanged. --- xCAT-server/debian/rules | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/debian/rules b/xCAT-server/debian/rules index 1795e732c4..4e7eb5bb70 100755 --- a/xCAT-server/debian/rules +++ b/xCAT-server/debian/rules @@ -52,6 +52,7 @@ binary-arch: chmod 755 $(rootdir)/share/xcat/ib/* chmod 755 $(rootdir)/share/xcat/ib/netboot/sles/* chmod 755 $(rootdir)/share/xcat/ib/netboot/rh/* + chmod -R go-w $(rootdir)/share/xcat/install $(rootdir)/share/xcat/netboot chmod 644 $(rootdir)/lib/perl/xCAT_plugin/* chmod 644 $(rootdir)/lib/perl/xCAT/* chmod 644 $(rootdir)/xdsh/Context/* From fa233e6d367c15308cc7cd674ba2cb7e491c562f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Mon, 19 Oct 2026 19:33:33 -0300 Subject: [PATCH 16/22] test(packaging): cover Debian profile permissions from writable sources Preserve source modes when staging Debian package builds and accept a private source fixture. Build group-writable profiles under umasks 0022 and 0002, then check the extracted data, postscripts and directories. Verify that staging and packaging leave source permissions unchanged, including a world-writable data file. Reuse the payload checks for normal, reduced and permission-regression builds. --- xCAT-test/lib/XCAT/Test/Lifecycle.pm | 7 +-- xCAT-test/native/profile_package_payload.t | 56 ++++++++++++++++------ 2 files changed, 45 insertions(+), 18 deletions(-) diff --git a/xCAT-test/lib/XCAT/Test/Lifecycle.pm b/xCAT-test/lib/XCAT/Test/Lifecycle.pm index 8aaa597f18..022ac35c6d 100644 --- a/xCAT-test/lib/XCAT/Test/Lifecycle.pm +++ b/xCAT-test/lib/XCAT/Test/Lifecycle.pm @@ -27,10 +27,11 @@ sub checked { } sub build_deb { - my ($package) = @_; + my ($package, $source) = @_; + $source //= repo_path('.'); my $work = tempdir(CLEANUP => 1); - checked('tar', '-cf', "$work/source.tar", '-C', repo_path('.'), $package); - checked('tar', '-xf', "$work/source.tar", '-C', $work); + checked('tar', '-cf', "$work/source.tar", '-C', $source, $package); + checked('tar', '-xpf', "$work/source.tar", '-C', $work); my $previous = getcwd(); chdir "$work/$package" or die "chdir: $!"; local $ENV{PWD} = getcwd(); diff --git a/xCAT-test/native/profile_package_payload.t b/xCAT-test/native/profile_package_payload.t index 0711a6d9bf..b380ccd92e 100644 --- a/xCAT-test/native/profile_package_payload.t +++ b/xCAT-test/native/profile_package_payload.t @@ -4,6 +4,7 @@ use warnings; use FindBin; use lib "$FindBin::Bin/../lib"; +use File::Basename qw(dirname); use File::Temp qw(tempdir); use File::Slurper qw(read_binary); use Fcntl qw(S_IMODE); @@ -31,14 +32,18 @@ ok(@assets, 'finds the RISC-V profile assets'); my @ubuntu = glob "$share/{install,netboot}/ubuntu/*.pkglist"; ok(@ubuntu, 'finds the Ubuntu package lists'); push @assets, @ubuntu; -for my $source (@assets) { - my $relative = substr($source, length($share) + 1); - my $delivered = "$root/opt/xcat/share/xcat/$relative"; - ok(-r $delivered, "$relative is readable after extraction") or next; - is(read_binary($delivered), read_binary($source), "$relative retains its complete contents"); - is(sprintf('%04o', S_IMODE((stat($delivered))[2])), $source =~ /\.postinstall$/ ? '0755' : '0644', - "$relative has the packaged permissions"); +sub check_assets { + my ($payload, $label, @sources) = @_; + for my $source (@sources) { + my $relative = substr($source, length($share) + 1); + my $delivered = "$payload/opt/xcat/share/xcat/$relative"; + ok(-r $delivered, "$label$relative is readable after extraction") or next; + is(read_binary($delivered), read_binary($source), "$label$relative retains its complete contents"); + is(sprintf('%04o', S_IMODE((stat($delivered))[2])), $source =~ /\.postinstall$/ ? '0755' : '0644', + "$label$relative has the packaged permissions"); + } } +check_assets($root, '', @assets); my ($status, $output) = run_command($^X, repo_path('xCAT-test/unit/profile_customization.t'), "$root/opt/xcat"); is($status, 0, 'packaged profiles resolve and remain independently customizable') or diag($output); @@ -51,14 +56,35 @@ if (!-f '/etc/debian_version') { 'cd "$1" && rpm2cpio "$2" | cpio -idm --quiet', 'bash', $reduced, $rpm); ok(!-e "$reduced/opt/xcat/share/xcat/install", 'the reduced RPM omits install profiles'); ok(!-e "$reduced/opt/xcat/share/xcat/netboot/rh", 'the reduced RPM omits RHEL netboot profiles'); - for my $source (glob "$share/netboot/rocky/*.riscv64.*") { - my $relative = substr($source, length($share) + 1); - my $delivered = "$reduced/opt/xcat/share/xcat/$relative"; - ok(-r $delivered, "reduced RPM: $relative still resolves") or next; - is(read_binary($delivered), read_binary($source), - "reduced RPM: $relative retains its complete contents"); - is(sprintf('%04o', S_IMODE((stat($delivered))[2])), $source =~ /\.postinstall$/ ? '0755' : '0644', - "reduced RPM: $relative has the packaged permissions"); + check_assets($reduced, 'reduced RPM: ', glob "$share/netboot/rocky/*.riscv64.*"); +} else { + my $fixture = tempdir(CLEANUP => 1); + XCAT::Test::Lifecycle::checked('cp', '-a', repo_path('xCAT-server'), "$fixture/xCAT-server"); + my $profiles = "$fixture/xCAT-server/share/xcat"; + XCAT::Test::Lifecycle::checked('chmod', '-R', 'g+w', "$profiles/install", "$profiles/netboot"); + my $data = 'install/rh/compute.rhels10.riscv64.pkglist'; + my $postinstall = 'netboot/rocky/compute.rocky10.riscv64.postinstall'; + chmod(oct('0666'), "$profiles/$data") == 1 or die "chmod: $!"; + for my $mask ('0022', '0002') { + subtest "Debian writable sources with umask $mask" => sub { + my $previous = umask oct($mask); + my $deb = XCAT::Test::Lifecycle::build_deb('xCAT-server', $fixture); + umask $previous; + my $staged = dirname($deb) . '/xCAT-server/share/xcat'; + for my $input ($profiles, $staged) { + is(sprintf('%04o', S_IMODE((stat("$input/$data"))[2])), '0666', + 'data source permissions survive staging and packaging'); + is(sprintf('%04o', S_IMODE((stat("$input/$postinstall"))[2])), '0775', + 'postinstall source permissions survive staging and packaging'); + } + my $payload = tempdir(CLEANUP => 1); + XCAT::Test::Lifecycle::checked('dpkg-deb', '-x', $deb, $payload); + check_assets($payload, '', @assets); + for my $path (qw(install install/rh netboot netboot/rocky netboot/ubuntu/genimage)) { + is(sprintf('%04o', S_IMODE((stat("$payload/opt/xcat/share/xcat/$path"))[2])), + '0755', "$path remains executable without group or other write access"); + } + }; } } From 214cbd4c9a515c2b68fd85da4415204756f30de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Mon, 19 Oct 2026 19:47:59 -0300 Subject: [PATCH 17/22] test(profiles): accept owner-only executable source assets A restrictive checkout umask can remove group and other execute bits. Require the owner execute bit on source postinstall files and reject all execute bits on data files. Native package tests still require exact modes. --- xCAT-test/unit/profile_customization.t | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xCAT-test/unit/profile_customization.t b/xCAT-test/unit/profile_customization.t index 03851240d3..ee85c73ea4 100644 --- a/xCAT-test/unit/profile_customization.t +++ b/xCAT-test/unit/profile_customization.t @@ -87,9 +87,12 @@ for my $case (@cases) { : xCAT::SvrUtils::get_file_name($base, $extension, $profile, "$os.2", $arch); is($selected, "$base/$name", 'retains the public profile filename'); ok(defined($selected) && -r $selected, 'selected asset is readable') or return; - is(sprintf('%03o', S_IMODE((stat($selected))[2]) & oct('111')), - $extension eq 'postinstall' ? '111' : '000', - 'only postinstall assets are executable'); + my $mode = S_IMODE((stat($selected))[2]); + if ($extension eq 'postinstall') { + ok($mode & oct('100'), 'postinstall asset is executable by its owner'); + } else { + is($mode & oct('111'), 0, 'data asset is not executable'); + } my $original = read_binary($selected); my $custom = "$work/$name"; copy($selected, $custom) or die "copy $selected: $!"; From 516e915bcc2f23dfb512d5e238e504cd09ca910a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Wed, 14 Oct 2026 01:00:19 -0300 Subject: [PATCH 18/22] test(genesis): exercise the NetworkManager wait-online policy --- xCAT-test/native/genesis_metadata.py | 52 ++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/xCAT-test/native/genesis_metadata.py b/xCAT-test/native/genesis_metadata.py index ca12ba1743..b45e4bc2b9 100644 --- a/xCAT-test/native/genesis_metadata.py +++ b/xCAT-test/native/genesis_metadata.py @@ -308,6 +308,58 @@ class GenesisMetadata(unittest.TestCase): with self.assertRaises(bb.process.ExecutionError): bb.build.exec_func("do_kernel_metadata", data, dirs=[data.getVar("WORKDIR")]) + def test_networkmanager_does_not_enable_wait_online(self): + def entries(file): + result = [] + section = None + for line in file.read_text().splitlines(): + line = line.strip() + if not line or line.startswith(("#", ";")): + continue + if line.startswith("[") and line.endswith("]"): + section = line[1:-1] + else: + self.assertIsNotNone(section) + key, value = line.split("=", 1) + result.append((section, key.strip(), value.strip())) + return result + + data = self.task_data("networkmanager") + # Preserve the recipe appends while replacing the external Meson installation. + data.setVar("do_install", 'cp -a "${WORKDIR}/meson-install/." "${D}/"\n', parsing=True) + root = Path(data.getVar("D")) + fixture = Path(data.getVar("WORKDIR")) / "meson-install" + sources = Path(data.getVar("UNPACKDIR")) + (sources / "networkmanager.initd").write_text("#!/bin/sh\nexit 0\n") + units = fixture / data.getVar("systemd_system_unitdir").lstrip("/") + units.mkdir(parents=True) + unit = units / "NetworkManager.service" + installed_unit = root / unit.relative_to(fixture) + rule = fixture / data.getVar("nonarch_base_libdir").lstrip("/") / "udev/rules.d/84-nm-drivers.rules" + rule.parent.mkdir(parents=True) + rule.touch() + expected = ("[Unit]\nDescription=NetworkManager fixture\n" + "[Service]\nExecStart=/usr/sbin/NetworkManager --no-daemon\n" + "[Install]\nWantedBy=multi-user.target\n" + "Alias=dbus-org.freedesktop.NetworkManager.service\n" + "Also=fixture-auxiliary.service\nAlso=fixture-second.service\n") + unit.write_text(expected) + expected_entries = entries(unit) + directive = "Also=NetworkManager-wait-online.service\n" + fixtures = { + "absent": expected, + "first": expected.replace("[Install]\n", "[Install]\n" + directive), + "last": expected + directive, + "repeated": expected + directive * 2, + } + for name, fixture_text in fixtures.items(): + with self.subTest(directive=name): + unit.write_text(fixture_text) + for unused in range(2): + bb.build.exec_func("do_install", data, dirs=[data.getVar("WORKDIR")]) + self.assertEqual(entries(installed_unit), expected_entries) + unit.write_bytes(installed_unit.read_bytes()) + def test_installed_network(self): data, root = self.install("xcat-genesis-network") file = self.installed(data, root, "sysconfdir", "NetworkManager/conf.d/10-xcat-genesis.conf", 0o644) From 2281b14a1325988a6ef05a9555878781edb55a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Wed, 14 Oct 2026 01:03:11 -0300 Subject: [PATCH 19/22] test(genesis): exercise live console status and diagnostics --- xCAT-test/native/genesis_console_dialogs.py | 70 ++++++++++++++++++--- 1 file changed, 63 insertions(+), 7 deletions(-) diff --git a/xCAT-test/native/genesis_console_dialogs.py b/xCAT-test/native/genesis_console_dialogs.py index 1108c39a24..7f76679c1d 100644 --- a/xCAT-test/native/genesis_console_dialogs.py +++ b/xCAT-test/native/genesis_console_dialogs.py @@ -88,9 +88,20 @@ class ConsoleTerminal(unittest.TestCase): self.assertIsNone(self.process.poll(), display) self.fail(f"Terminal did not show {description}:\n{display}") + def assert_screen_stays(self, predicate, description, duration): + deadline = time.monotonic() + duration + while time.monotonic() < deadline: + display = self.read_screen(0.1) + self.assertTrue(predicate(display), f"{description}:\n{display}") + self.assertIsNone(self.process.poll(), display) + def key(self, sequence): os.write(self.master, sequence) + def visible_text(self, display): + return " ".join("".join(character if character.isascii() else " " + for character in display).split()) + class ConsoleDialogs(ConsoleTerminal): def test_help_and_diagnostics_scroll_close_and_reopen(self): @@ -108,15 +119,63 @@ class ConsoleDialogs(ConsoleTerminal): self.wait_text(first) self.wait_text(help_line) self.key(other_key) - self.assertIn(title, self.read_screen(0.2)) self.key(b"\x1b[6~" * 20) - self.wait_text(last) + self.assertIn(title, self.wait_text(last)) self.key(close_key) self.wait_text("Genesis status") self.wait_text("F1 Help") self.process.send_signal(signal.SIGTERM) self.assertEqual(self.process.wait(timeout=5), 0) + def publish(self, name, text): + target = self.root / name + target.parent.mkdir(parents=True, exist_ok=True) + temporary = target.with_suffix(".tmp") + temporary.write_text(text) + temporary.replace(target) + + def test_status_refresh_and_diagnostic_snapshot(self): + self.publish("response_file", "XCAT_NODE_NAME=updated-node\n") + self.assertRegex(self.wait_text("updated-node"), r"Node +updated-node") + self.publish("status_dir/action.env", "SCHEMA=1\nSTATE=RUNNING\n" + "DETAIL=Preparing test action\nUPDATED_SECONDS=100\n") + self.assertIn("RUNNING", self.wait_text("Preparing test action")) + self.key(b"\x1bOQ") + self.wait_text("Node: updated-node") + self.publish("response_file", "XCAT_NODE_NAME=short-node\n") + self.publish("status_dir/action.env", "SCHEMA=1\nSTATE=FAILED\n" + "DETAIL=Test action failed\nRECOVERY=Check test input\nUPDATED_SECONDS=101\n") + self.key(b"\x1b[6~" * 20) + self.wait_text("Provider names:") + self.key(b"\x1b[5~" * 20) + display = self.wait_text("Node: updated-node") + self.assertNotIn("short-node", display) + self.assert_screen_stays(lambda display: "Node: updated-node" in display + and "short-node" not in display, + "Diagnostics changed before reopening", 2) + self.key(b"\x1bOQ") + display = self.wait_text("Check test input") + self.assertRegex(display, r"Node +short-node +") + self.assertIn("FAILED", display) + self.assertIn("Test action failed", display) + self.assertNotIn("updated-node", display) + self.key(b"\x1bOQ") + self.wait_text("Node: short-node") + + def test_rendered_help_explains_read_only_pages_logs_and_shell(self): + self.key(b"\x1bOP") + display = self.wait_text("Screen fields") + text = self.visible_text(display) + self.assertIn("Status pages are read-only.", text) + self.assertIn("confirmed root maintenance shell", text) + self.key(b"\x1b[6~" * 20) + display = self.wait_text("Up and Down scroll this page.") + text = self.visible_text(display) + self.assertIn("F3 opens recent Genesis logs", text) + self.assertIn("press End to resume.", text) + self.assertIn("F12 asks before opening", text) + self.assertIn("Exit returns here.", text) + class ConsoleJournal(ConsoleTerminal): """Read real journal files in a private machine and journal namespace. @@ -189,11 +248,8 @@ class ConsoleJournal(ConsoleTerminal): f"selected log entry {text!r}") def assert_selection_stays(self, text): - deadline = time.monotonic() + 3 - while time.monotonic() < deadline: - self.read_screen(0.1) - self.assertEqual(self.selected_text(), text) - self.assertIsNone(self.process.poll()) + self.assert_screen_stays(lambda display: self.selected_text() == text, + "Selected journal entry changed", 3) def test_paused_entry_survives_history_rollover(self): self.write_journal([(f"RECORD-{number:04d}", "other.service", "xcat-genesis-register") From 385f641e03793ba2726ad4da001cfaa544e8b262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Fri, 16 Oct 2026 21:44:24 -0300 Subject: [PATCH 20/22] test(genesis): exercise journal follow and navigation --- xCAT-test/native/genesis_console_dialogs.py | 82 ++++++++++++++++++++- 1 file changed, 78 insertions(+), 4 deletions(-) diff --git a/xCAT-test/native/genesis_console_dialogs.py b/xCAT-test/native/genesis_console_dialogs.py index 7f76679c1d..43f78cf1d5 100644 --- a/xCAT-test/native/genesis_console_dialogs.py +++ b/xCAT-test/native/genesis_console_dialogs.py @@ -237,11 +237,14 @@ class ConsoleJournal(ConsoleTerminal): self.wait_text("Genesis logs") self.wait_text("F3 Back") + def selected_rows(self): + return ["".join(self.screen.buffer[row][column].data + for column in range(self.screen.columns) + if self.screen.buffer[row][column].bg == "red").strip() + for row in range(self.screen.lines)] + def selected_text(self): - return "\n".join("".join(self.screen.buffer[row][column].data - for column in range(self.screen.columns) - if self.screen.buffer[row][column].bg == "red").strip() - for row in range(self.screen.lines)).strip() + return "\n".join(self.selected_rows()).strip() def wait_selected(self, text): return self.wait_screen(lambda display: self.selected_text().endswith(text), @@ -343,6 +346,77 @@ class ConsoleJournal(ConsoleTerminal): self.key(b"\x1b[B") self.wait_selected("RECORD-0003") + def visible_entries(self): + return [message for message, unit, identifier in self.entries + if any(message in line for line in self.screen.display)] + + def assert_paused(self, text): + before = self.selected_rows() + self.assertIn(text, self.selected_text()) + self.assert_screen_stays(lambda display: self.selected_rows() == before, + "Paused journal selection moved", 5) + + def test_logs_follow_pause_and_reopen(self): + self.write_journal([ + ("FIRST", "xcat-genesis-register.service", "unit-fixture"), + ("TAIL", "other.service", "xcat-genesis-discovery"), + ]) + self.open_logs() + self.wait_selected("TAIL") + self.write_journal([("FOLLOWED", "other.service", "xcat-genesis-register")]) + self.wait_selected("FOLLOWED") + self.key(b"\x1b[H") + self.wait_selected("FIRST") + self.write_journal([("PAUSED", "other.service", "xcat-genesis-register")]) + self.wait_text("PAUSED") + self.assert_paused("FIRST") + self.key(b"\x1b[F") + self.wait_selected("PAUSED") + self.write_journal([("END-FOLLOWED", "other.service", "xcat-genesis-register")]) + self.wait_selected("END-FOLLOWED") + for index, close_key in enumerate((b"\x1bOR", b"\x1b")): + with self.subTest(close_key=close_key): + self.key(b"\x1b[H") + self.wait_selected("FIRST") + self.key(close_key) + self.wait_text("Genesis status") + self.open_logs() + self.wait_selected("END-FOLLOWED" if index == 0 else "REOPENED-0") + message = f"REOPENED-{index}" + self.write_journal([(message, "other.service", "xcat-genesis-register")]) + self.wait_selected(message) + + def test_logs_arrow_and_page_keys_pause_and_resume(self): + self.write_journal([(f"HISTORY-{number:03d}", "other.service", "xcat-genesis-register") + for number in range(40)]) + self.open_logs() + self.wait_selected("HISTORY-039") + for up, down in ((b"\x1b[A", b"\x1b[B"), (b"\x1b[5~", b"\x1b[6~")): + with self.subTest(up=up): + previous_tail = f"HISTORY-{len(self.entries) - 1:03d}" + if up == b"\x1b[A": + paused = f"HISTORY-{len(self.entries) - 2:03d}" + else: + visible = self.visible_entries() + self.assertGreater(len(visible), 2) + paused = visible[0] + self.key(up) + self.wait_selected(paused) + message = f"HISTORY-{len(self.entries):03d}" + self.write_journal([(message, "other.service", "xcat-genesis-register")]) + self.assert_paused(paused) + self.key(down) + self.wait_selected(previous_tail) + message = f"HISTORY-{len(self.entries):03d}" + self.write_journal([(message, "other.service", "xcat-genesis-register")]) + self.assert_paused(previous_tail) + self.key(down) + self.key(down) + self.wait_selected(message) + following = f"HISTORY-{len(self.entries):03d}" + self.write_journal([(following, "other.service", "xcat-genesis-register")]) + self.wait_selected(following) + def test_empty_journal(self): self.open_logs() self.wait_text("No Genesis journal entries are available.") From 8dab5e49891dce98019452ea79b682fcd216b684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Fri, 16 Oct 2026 21:51:02 -0300 Subject: [PATCH 21/22] test(genesis): exercise maintenance shell confirmation and return --- .github/workflows/genesis_openembedded.yml | 2 +- xCAT-test/native/genesis_console_dialogs.py | 132 ++++++++++++++++++-- 2 files changed, 123 insertions(+), 11 deletions(-) diff --git a/.github/workflows/genesis_openembedded.yml b/.github/workflows/genesis_openembedded.yml index 54b71d9d12..e025a4d766 100644 --- a/.github/workflows/genesis_openembedded.yml +++ b/.github/workflows/genesis_openembedded.yml @@ -22,7 +22,7 @@ jobs: sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y \ build-essential meson ninja-build pkg-config libnewt-dev \ libsystemd-dev python3-pyte bubblewrap systemd-journal-remote - - name: Enable isolated journal test namespaces + - name: Enable isolated console test namespaces run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 - name: Exercise the newt dialogs run: /usr/bin/python3 xCAT-test/native/genesis_console_dialogs.py diff --git a/xCAT-test/native/genesis_console_dialogs.py b/xCAT-test/native/genesis_console_dialogs.py index 43f78cf1d5..16e65e693d 100644 --- a/xCAT-test/native/genesis_console_dialogs.py +++ b/xCAT-test/native/genesis_console_dialogs.py @@ -7,6 +7,7 @@ import os from pathlib import Path import pty import select +import shlex import signal import struct import subprocess @@ -61,6 +62,16 @@ class ConsoleTerminal(unittest.TestCase): def console_command(self): return [str(self.binary)] + def isolated_prefix(self, mounts): + command = ["bwrap", "--unshare-all", "--die-with-parent", "--ro-bind", "/", "/", + "--dev", "/dev", "--proc", "/proc", "--tmpfs", "/run", "--tmpfs", "/var/log", + *mounts] + result = subprocess.run(command + ["/bin/true"], text=True, + capture_output=True, timeout=10) + self.assertEqual(result.returncode, 0, + "Console tests require working Bubblewrap namespaces: " + result.stderr) + return command + def stop(self): if self.process.poll() is None: self.process.terminate() @@ -196,19 +207,12 @@ class ConsoleJournal(ConsoleTerminal): self.entries = [] machine_id_file = self.root / "machine-id" machine_id_file.write_text(self.machine_id + "\n") - sandbox = [ - "bwrap", "--unshare-all", "--die-with-parent", "--ro-bind", "/", "/", - "--dev", "/dev", "--proc", "/proc", "--tmpfs", "/run", "--tmpfs", "/var/log", + self.sandbox = self.isolated_prefix([ "--bind", str(self.root), str(self.root), "--ro-bind", str(machine_id_file), "/etc/machine-id", "--ro-bind", str(journal_root), "/var/log/journal", - ] - result = subprocess.run(sandbox + ["/bin/true"], text=True, - capture_output=True, timeout=10) - self.assertEqual(result.returncode, 0, - "Journal tests require working Bubblewrap namespaces: " + result.stderr) - self.sandbox = sandbox - return sandbox + [str(self.binary)] + ]) + return self.sandbox + [str(self.binary)] def write_journal(self, entries, interval=1000000): records = [] @@ -474,5 +478,113 @@ class ConsoleJournal(ConsoleTerminal): self.wait_text("RECORD-0129") +class ConsoleShell(ConsoleTerminal): + """Mount a fixture libexec directory containing the external shell launcher. + + The linked console still owns confirmation, fork/exec, waiting and redraw. + The per-test temporary root is the only writable host-backed directory. + The libexec mount is read-only. + /run and /var/log are private tmpfs mounts. + """ + + def console_command(self): + directory = self.root / "libexec" + (directory / "xcat").mkdir(parents=True) + self.launcher = directory / "xcat/genesis-maintenance-shell" + self.calls = self.root / "shell-calls" + self.input = self.root / "shell-input" + self.write_launcher(0) + return self.isolated_prefix([ + "--bind", str(self.root), str(self.root), + "--ro-bind", str(directory), "/usr/libexec", + ]) + [str(self.binary)] + + def write_launcher(self, exit_status): + self.launcher.write_text( + "#!/bin/sh\n" + f"printf '%s\\n' started >> {shlex.quote(str(self.calls))}\n" + "printf 'SHELL-RUNNING\\n'\n" + "IFS= read -r answer\n" + f"printf '%s\\n' \"$answer\" > {shlex.quote(str(self.input))}\n" + f"exit {exit_status}\n") + self.launcher.chmod(0o755) + + def shell_dialog_text(self, display): + lines = display.splitlines() + for row, line in enumerate(lines): + if "Maintenance shell" not in line: + continue + left, right = line.rfind("┌"), line.find("┐") + if left < 0 or right <= left: + continue + content = [] + for line in lines[row + 1:]: + if line[left:right + 1].startswith("└") and line[right] == "┘": + return self.visible_text("\n".join(content)) + content.append(line[left + 1:right]) + return "" + + def confirm_shell(self): + self.key(b"\x1b[24~") + display = self.wait_screen( + lambda text: "Open a root maintenance shell?" in self.shell_dialog_text(text), + "maintenance shell confirmation") + self.assertIn("Provisioning services continue in the background.", + self.shell_dialog_text(display)) + + def wait_main(self): + def is_main(display): + return ("Maintenance shell" not in display + and "SHELL-RUNNING" not in display + and "Genesis diagnostics" not in display + and "Genesis status" in display) + + self.wait_screen(is_main, "the restored status console") + self.assert_screen_stays(is_main, "The restored status console changed", 1) + + def test_cancel_does_not_launch_shell(self): + self.confirm_shell() + self.assertFalse(self.calls.exists()) + self.key(b"\t\r") + self.wait_main() + self.assertFalse(self.calls.exists()) + self.key(b"\x1bOP") + self.wait_text("Genesis help") + + def test_confirmed_shell_accepts_input_and_returns_to_console(self): + for count, exit_status in enumerate((0, 7), 1): + with self.subTest(launch=count, exit_status=exit_status): + self.write_launcher(exit_status) + self.confirm_shell() + self.assertEqual(self.calls.read_text() if self.calls.exists() else "", + "started\n" * (count - 1)) + self.key(b"\r") + self.wait_text("SHELL-RUNNING") + self.assertEqual(self.calls.read_text(), "started\n" * count) + self.key(f"operator-input-{count}\r".encode()) + self.wait_main() + self.assertEqual(self.input.read_text(), f"operator-input-{count}\n") + self.assertIsNone(self.process.poll()) + self.key(b"\x1bOQ") + self.wait_text("Genesis diagnostics") + self.key(b"\x1bOQ") + self.wait_main() + + def test_shell_exec_error_is_reported_and_console_recovers(self): + self.launcher.unlink() + self.confirm_shell() + self.key(b"\r") + display = self.wait_screen( + lambda text: "No such file or directory" in self.shell_dialog_text(text), + "the maintenance shell executable error") + self.assertIn("The maintenance shell could not be opened: No such file or directory", + self.shell_dialog_text(display)) + self.assertFalse(self.calls.exists()) + self.key(b"\r") + self.wait_main() + self.key(b"\x1bOP") + self.wait_text("Genesis help") + + if __name__ == "__main__": unittest.main(verbosity=2) From 32a98d6d997dd645487f3c5e26d216f596f2080f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Fri, 16 Oct 2026 21:51:03 -0300 Subject: [PATCH 22/22] docs(test): describe Genesis policy and terminal coverage --- xCAT-test/native/README.md | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/xCAT-test/native/README.md b/xCAT-test/native/README.md index 4af5c8d7e3..b300996e19 100644 --- a/xCAT-test/native/README.md +++ b/xCAT-test/native/README.md @@ -247,6 +247,9 @@ permissions and an init process that reaps orphaned children. evaluate machine and package policy, install local-file recipes into temporary directories, generate extension manifests and reject invalid extension metadata. It does not extract or evaluate recipe source fragments. +The NetworkManager case supplies an installed-unit fixture and runs the +recipe's install append to check the wait-online policy. It does not verify +the unit format produced by an upstream NetworkManager build. The POWER patch case keeps BitBake's machine prepends and replaces only the upstream kernel task body with a no-op. It applies the real patch to a small metadata fixture, checks repeat runs and verifies that patch errors propagate. @@ -277,18 +280,27 @@ Meson, Ninja, pkg-config, and development packages for Newt and systemd. dependencies plus the `pyte` Python package, bubblewrap, systemd-journal-remote and journalctl. It runs the linked console in a pseudo-terminal and checks help and diagnostics navigation, scrolling, -return to the main screen, and F3 journal filtering, order and history limits. -Rollover cases check paused selection, expired entries, duplicate messages, -wrapped lines and returning to follow mode. +live status updates, diagnostic snapshots, and return to the main screen. +The F3 cases check journal filtering, order, history limits, follow mode, +paused selection, navigation and reopening. Rollover cases check expired +entries, duplicate messages and wrapped lines. The F12 cases check cancellation, +confirmation, terminal input, successful and nonzero exits, repeated launches +and executable errors. It checks termination from the main screen, not from inside a dialog. -The journal cases need working Linux user and mount namespaces. On Ubuntu -24.04, the CI job enables them with +The journal and shell cases need working Linux user and mount namespaces. +On Ubuntu 24.04, the CI job enables them with `sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0`. -They import private journal files, including appends while F3 is open, and -verify each import with journalctl. They do not start a journal service or -read the host journal. Missing tools or namespace support fail the tests; -they do not skip. +The journal cases import private journal files, including appends while F3 +is open, and verify each import with journalctl. They do not start a journal +service or read the host journal. Missing tools or namespace support fail +the tests; they do not skip. +The shell cases mount a fixture directory over `/usr/libexec` in a private +namespace to replace the external shell launcher. The real console handles +confirmation, child execution, waiting and terminal restoration. +The per-test temporary root is the only writable host-backed directory. +The libexec mount is read-only. Other writable mounts are private. +The real maintenance shell is not run. The Genesis runtime BATS cases need Bash, Perl, OpenSSL, coreutils, diffutils and bubblewrap. The credential-file cases use a private `/etc` in a Linux