From the website: Byobu is a GPLv3 open source text-based window manager and terminal multiplexer. It was originally designed to provide elegant enhancements to the otherwise functional, plain, practical GNU Screen, for the Ubuntu server distribution. Byobu now includes an enhanced profiles, convenient keybindings, configuration utilities, and toggle-able system status notifications for both the GNU Screen window manager and the more modern Tmux terminal multiplexer, and works on most Linux, BSD, and Mac distributions. Adapted from the old packages feed: https://git.openwrt.org/?p=openwrt/svn-archive/packages.git;a=tree;f=utils/byobu Signed-off-by: Jeffery To <jeffery.to@gmail.com>
33 lines
802 B
Diff
33 lines
802 B
Diff
--- a/usr/lib/byobu/whoami
|
|
+++ b/usr/lib/byobu/whoami
|
|
@@ -19,12 +19,28 @@
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
+___get_user() {
|
|
+ if eval $BYOBU_TEST whoami >/dev/null 2>&1; then
|
|
+ whoami
|
|
+ elif eval $BYOBU_TEST id >/dev/null 2>&1; then
|
|
+ id -un
|
|
+ fi
|
|
+}
|
|
+
|
|
__whoami_detail() {
|
|
- getent -- passwd "$USER"
|
|
+ local user=$(___get_user)
|
|
+ [ -n "$user" ] || return
|
|
+ if eval $BYOBU_TEST getent >/dev/null 2>&1; then
|
|
+ getent -- passwd "$user"
|
|
+ else
|
|
+ grep "^$user:" /etc/passwd
|
|
+ fi
|
|
}
|
|
|
|
__whoami() {
|
|
- color bold2; printf "%s@" "$(whoami)"; color -
|
|
+ local user=$(___get_user)
|
|
+ [ -n "$user" ] || return
|
|
+ color bold2; printf "%s@" "$user"; color -
|
|
}
|
|
|
|
# vi: syntax=sh ts=4 noexpandtab
|