From 0d18832f71b6d9f37023d2e86e5ac8b34ee2acd8 Mon Sep 17 00:00:00 2001 From: dylan araps Date: Tue, 5 Jan 2016 11:46:08 +1100 Subject: [PATCH] Start of Windows support (experimental, needs testing) --- fetch.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/fetch.sh b/fetch.sh index f5c4165d..8957b386 100755 --- a/fetch.sh +++ b/fetch.sh @@ -205,6 +205,10 @@ case "$(uname)" in "OpenBSD") os="OpenBSD" ;; + + "CYGWIN"*) + os="Windows" + ;; esac # Get Distro @@ -228,6 +232,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" ;; @@ -291,6 +304,10 @@ getuptime () { uptime=${uptime# } ;; + "Windows") + uptime=$(uptime | awk -F ':[0-9]{2}+ |(, ){1}+' '{printf $2}') + ;; + *) uptime="Unknown" ;; @@ -344,6 +361,10 @@ getpackages () { packages=$(pkg_info | wc -l) ;; + "Windows"*) + packages=$(cygcheck -cd | wc -l) + ;; + *) packages="Unknown" ;; @@ -890,3 +911,4 @@ printf "\e[$(tput lines)H\e[1A\e[?25h" # }}} +