Start of Windows support (experimental, needs testing)

This commit is contained in:
dylan araps 2016-01-05 11:46:08 +11:00
parent 0145b678ac
commit 0d18832f71
1 changed files with 22 additions and 0 deletions

View File

@ -205,6 +205,10 @@ case "$(uname)" in
"OpenBSD") "OpenBSD")
os="OpenBSD" os="OpenBSD"
;; ;;
"CYGWIN"*)
os="Windows"
;;
esac esac
# Get Distro # Get Distro
@ -228,6 +232,15 @@ getdistro () {
distro="OpenBSD" distro="OpenBSD"
;; ;;
"Windows")
# TODO: Detect XP/7
if [ "$(wmic os get version | grep -o '^10')" ]; then
distro="Windows 10"
else
distro="Windows"
fi
;;
*) *)
distro="Unknown" distro="Unknown"
;; ;;
@ -291,6 +304,10 @@ getuptime () {
uptime=${uptime# } uptime=${uptime# }
;; ;;
"Windows")
uptime=$(uptime | awk -F ':[0-9]{2}+ |(, ){1}+' '{printf $2}')
;;
*) *)
uptime="Unknown" uptime="Unknown"
;; ;;
@ -344,6 +361,10 @@ getpackages () {
packages=$(pkg_info | wc -l) packages=$(pkg_info | wc -l)
;; ;;
"Windows"*)
packages=$(cygcheck -cd | wc -l)
;;
*) *)
packages="Unknown" packages="Unknown"
;; ;;
@ -890,3 +911,4 @@ printf "\e[$(tput lines)H\e[1A\e[?25h"
# }}} # }}}