Adjust commands sequence

(cherry picked from commit ed2e69cee2e1d1271a012e9f1faa614893ad0668)
This commit is contained in:
zhangyao 2025-01-14 11:42:13 +08:00 committed by openeuler-sync-bot
parent c033af094b
commit ba4f5d04f0
2 changed files with 38 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."
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
--
2.27.0

View File

@ -1,13 +1,14 @@
Summary: A set of system configuration and setup files
Name: setup
Version: 2.13.9.1
Release: 1
Release: 2
License: Public Domain
Group: System Environment/Base
URL: https://pagure.io/setup/
Source0: http://releases.pagure.org/%{name}/%{name}-%{version}.tar.bz2
Patch0: support-filesystems-xfs.patch
Patch1: source-cshlocal-when-login.patch
Patch2: Adjust-commands-sequence.patch
BuildArch: noarch
BuildRequires: systemd
BuildRequires: bash tcsh perl-interpreter
@ -117,6 +118,12 @@ end
%{_tmpfilesdir}/%{name}.conf
%changelog
* Tue Jan 14 2025 zhangyao <zhangyao108@huawei.com> - 2.13.9.1-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Adjust commands sequence
* Tue Nov 30 2021 wangjie <wangjie375@huawei.com> - 2.13.9.1-1
- Type:enhancement
- ID:NA