Add DragonFly and Solaris (?) portability. SunOS is only test on

openindiana (SunOS 5.11 oi_151a2 i86pc i386 i86pc Solaris)

Battery state is untested on those OS
This commit is contained in:
joris 2012-07-23 16:05:49 +02:00
parent e5f558c08d
commit ead8a9ff41

View File

@ -54,6 +54,8 @@ OS="Linux"
case $(uname) in case $(uname) in
"Linux" ) OS="Linux" ;; "Linux" ) OS="Linux" ;;
"FreeBSD") OS="FreeBSD" ;; "FreeBSD") OS="FreeBSD" ;;
"DragonFly") OS="FreeBSD" ;;
"SunOS") OS="SunOS" ;;
esac esac
# Colors declarations # Colors declarations
@ -130,6 +132,11 @@ __cpunum_FreeBSD ()
sysctl -n hw.ncpu sysctl -n hw.ncpu
} }
__cpunum_SunOS ()
{
kstat -m cpu_info | grep "module: cpu_info" | wc -l
}
__CPUNUM=$(__cpunum_$OS) __CPUNUM=$(__cpunum_$OS)
@ -147,6 +154,12 @@ __load_FreeBSD()
echo -n "$load" echo -n "$load"
} }
__load_SunOS()
{
load=$(LANG=C uptime | awk '{print $10}'| sed -e 's/,//')
echo -n "$load"
}
############### ###############
# Who are we? # # Who are we? #