From 1059ccd56630438455f74f796a3bcc2bd79bfe9f Mon Sep 17 00:00:00 2001 From: dylan araps Date: Tue, 5 Jan 2016 16:32:34 +1100 Subject: [PATCH] Start of Windows support --- fetch.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/fetch.sh b/fetch.sh index 09dd87d1..03d3a6b6 100755 --- a/fetch.sh +++ b/fetch.sh @@ -216,6 +216,10 @@ case "$(uname)" in "OpenBSD") os="OpenBSD" ;; + + "CYGWIN"*) + os="Windows" + ;; esac # Get Distro @@ -239,6 +243,15 @@ getdistro () { 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" ;; @@ -302,6 +315,10 @@ getuptime () { uptime=${uptime# } ;; + "Windows") + uptime=$(uptime | awk -F ':[0-9]{2}+ |(, ){1}+' '{printf $2}') + ;; + *) uptime="Unknown" ;; @@ -355,6 +372,10 @@ getpackages () { packages=$(pkg_info | wc -l) ;; + "Windows"*) + packages=$(cygcheck -cd | wc -l) + ;; + *) packages="Unknown" ;;