From 7cd5821d801e79f5b122864617cf9f973dee4354 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Mon, 27 May 2019 03:12:44 +0800 Subject: [PATCH] * usr/lib/byobu/hostname: - Read from /proc/sys/kernel/hostname if the hostname command is not available --- debian/changelog | 3 +++ usr/lib/byobu/hostname | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index be77d117..624744f1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -26,6 +26,9 @@ byobu (5.128) unreleased; urgency=medium creating it) * usr/lib/byobu/disk_io: - Ensure the detected mount point device exists + * usr/lib/byobu/hostname: + - Read from /proc/sys/kernel/hostname if the hostname command is not + available * usr/lib/byobu/logo: - Add logo for OpenWrt * usr/share/byobu/keybindings/f-keys.tmux: diff --git a/usr/lib/byobu/hostname b/usr/lib/byobu/hostname index 4e6ba317..348aed76 100755 --- a/usr/lib/byobu/hostname +++ b/usr/lib/byobu/hostname @@ -20,12 +20,16 @@ # along with this program. If not, see . __hostname_detail() { - hostname -f + hostname -f 2>/dev/null } __hostname() { local h= - h=$(hostname -s 2>/dev/null || hostname) + if eval $BYOBU_TEST hostname >/dev/null 2>&1; then + h=$(hostname -s 2>/dev/null || hostname) + elif [ -r /proc/sys/kernel/hostname ]; then + read h < /proc/sys/kernel/hostname + fi if metadata_available; then local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/hostname" # Background a retrieval of our public hostname