mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-14 10:46:58 -07:00
* usr/lib/byobu/whoami:
- Use id if the whoami command is not available - Read from /etc/passwd if the getent command is not available
This commit is contained in:
parent
6e62ff2ffc
commit
e537a69098
2 changed files with 21 additions and 2 deletions
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -40,6 +40,9 @@ byobu (5.128) unreleased; urgency=medium
|
|||
- Fix reading services from $BYOBU_CONFIG_DIR/statusrc
|
||||
* usr/lib/byobu/updates_available:
|
||||
- Add support for opkg (OpenWrt)
|
||||
* usr/lib/byobu/whoami:
|
||||
- Use id if the whoami command is not available
|
||||
- Read from /etc/passwd if the getent command is not available
|
||||
* usr/share/byobu/keybindings/f-keys.tmux:
|
||||
- Remove -k for new-window. In older versions of tmux, -k without
|
||||
-t <target-window> had no effect. In tmux 2.8, -k without -t will
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue