Adjust commands sequence

This commit is contained in:
hugel 2025-02-06 16:21:00 +08:00
parent 81eeeabdc5
commit 8bc3ba5c85
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,30 @@
From 197d01359b386165ac61aa26c25f8ccc12410152 Mon Sep 17 00:00:00 2001
From: wx913462 <wangchen137@h-partners.com>
Date: Mon, 25 Apr 2022 09:29:41 +0800
Subject: [PATCH] Adjust commands sequence
Prefer hostname and uname commands to avoid time consuming in
hostnamectl.
---
profile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/profile b/profile
index 542add4..5a3ec3c 100644
--- a/profile
+++ b/profile
@@ -42,9 +42,9 @@ else
pathmunge /usr/sbin after
fi
-HOSTNAME=$(/usr/bin/hostnamectl --transient 2>/dev/null) || \
HOSTNAME=$(/usr/bin/hostname 2>/dev/null) || \
-HOSTNAME=$(/usr/bin/uname -n)
+HOSTNAME=$(/usr/bin/uname -n 2>/dev/null) || \
+HOSTNAME=$(/usr/bin/hostnamectl --transient 2>/dev/null) || echo "System commands: hostname uname and hostnamectl, which do not exist."
if [ -z "$HISTSIZE" ] ; then
HISTSIZE=1000
--
2.27.0

View File

@ -1,13 +1,14 @@
Summary: A set of system configuration and setup files Summary: A set of system configuration and setup files
Name: setup Name: setup
Version: 2.14.5 Version: 2.14.5
Release: 2 Release: 3
License: Public Domain License: Public Domain
Group: System Environment/Base Group: System Environment/Base
URL: https://pagure.io/setup/ URL: https://pagure.io/setup/
Source0: http://releases.pagure.org/%{name}/%{name}-%{version}.tar.bz2 Source0: http://releases.pagure.org/%{name}/%{name}-%{version}.tar.bz2
Patch0: support-filesystems-xfs.patch Patch0: support-filesystems-xfs.patch
Patch1: Delete-the-users-and-groups-declared-in-systemd.patch Patch1: Delete-the-users-and-groups-declared-in-systemd.patch
Patch2: Adjust-commands-sequence.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: systemd BuildRequires: systemd
BuildRequires: bash tcsh perl-interpreter BuildRequires: bash tcsh perl-interpreter
@ -134,6 +135,9 @@ end
/etc/dnf/protected.d/%{name}.conf /etc/dnf/protected.d/%{name}.conf
%changelog %changelog
* Thu Feb 6 2025 hugel <gengqihu2@h-partners.com> - 2.14.5-3
- Adjust commands sequence
* Sat May 11 2024 hongjinghao <hongjinghao@huawei.com> - 2.14.5-2 * Sat May 11 2024 hongjinghao <hongjinghao@huawei.com> - 2.14.5-2
- Delete the users and groups which is declared in systemd. - Delete the users and groups which is declared in systemd.