Start of Windows support

This commit is contained in:
dylan araps 2016-01-05 16:32:34 +11:00
parent c3c8c23d1d
commit 1059ccd566

View file

@ -216,6 +216,10 @@ case "$(uname)" in
"OpenBSD") "OpenBSD")
os="OpenBSD" os="OpenBSD"
;; ;;
"CYGWIN"*)
os="Windows"
;;
esac esac
# Get Distro # Get Distro
@ -239,6 +243,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"
;; ;;
@ -302,6 +315,10 @@ getuptime () {
uptime=${uptime# } uptime=${uptime# }
;; ;;
"Windows")
uptime=$(uptime | awk -F ':[0-9]{2}+ |(, ){1}+' '{printf $2}')
;;
*) *)
uptime="Unknown" uptime="Unknown"
;; ;;
@ -355,6 +372,10 @@ getpackages () {
packages=$(pkg_info | wc -l) packages=$(pkg_info | wc -l)
;; ;;
"Windows"*)
packages=$(cygcheck -cd | wc -l)
;;
*) *)
packages="Unknown" packages="Unknown"
;; ;;