mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-20 21:43:19 -07:00
* usr/lib/byobu/uptime:
- fix uptime status on MacOS
This commit is contained in:
commit
2a3e4032a6
2 changed files with 12 additions and 0 deletions
5
debian/changelog
vendored
5
debian/changelog
vendored
|
@ -1,5 +1,6 @@
|
|||
byobu (5.108) unreleased; urgency=medium
|
||||
|
||||
[ Dustin Kirkland ]
|
||||
* usr/lib/byobu/updates_available:
|
||||
- remove trailing whitespace
|
||||
* usr/lib/byobu/battery:
|
||||
|
@ -7,6 +8,10 @@ byobu (5.108) unreleased; urgency=medium
|
|||
POWER_SUPPLY_CHARGE_NOW are available; important for summing
|
||||
multiple batteries
|
||||
|
||||
[ Kevin Mark and Dustin Kirkland ]
|
||||
* usr/lib/byobu/uptime:
|
||||
- fix uptime status on MacOS
|
||||
|
||||
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 09 May 2016 18:26:22 -0500
|
||||
|
||||
byobu (5.107-0ubuntu1) yakkety; urgency=medium
|
||||
|
|
|
@ -30,6 +30,12 @@ __uptime() {
|
|||
if [ -r /proc/uptime ]; then
|
||||
read u idle < /proc/uptime
|
||||
u=${u%.*}
|
||||
elif [ -x /usr/sbin/sysctl ]; then
|
||||
# MacOS support
|
||||
u=$(/usr/sbin/sysctl -n kern.boottime | cut -f4 -d' ' | cut -d',' -f1)
|
||||
u=$(($(date +%s) - $u))
|
||||
fi
|
||||
if [ "$u" ]; then
|
||||
if [ "$u" -gt 86400 ]; then
|
||||
str="$(($u / 86400))d$((($u % 86400) / 3600))h"
|
||||
elif [ "$u" -gt 3600 ]; then
|
||||
|
@ -40,6 +46,7 @@ __uptime() {
|
|||
str="${u}s"
|
||||
fi
|
||||
else
|
||||
# Last ditch hack
|
||||
str=$(uptime | sed -e "s/.* up *//" -e "s/ *days, */d/" -e "s/:/h/" -e "s/,.*/m/")
|
||||
fi
|
||||
[ -n "$str" ] || return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue