mirror of
https://github.com/dylanaraps/pfetch.git
synced 2026-01-02 16:02:12 +01:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
987d3b61fd |
94
pfetch
94
pfetch
@@ -210,35 +210,45 @@ get_os() {
|
|||||||
# says "populate $line with the third field's contents".
|
# says "populate $line with the third field's contents".
|
||||||
while IFS='<>' read -r _ _ line _; do
|
while IFS='<>' read -r _ _ line _; do
|
||||||
case $line in
|
case $line in
|
||||||
# Match 'ProductVersion' and read the next line
|
# Match the key and read the next line
|
||||||
# directly as it contains the key's value.
|
# directly as it contains the key's value.
|
||||||
ProductVersion)
|
#
|
||||||
IFS='<>' read -r _ _ mac_version _
|
# Define a shell variable using the key's value.
|
||||||
|
ProductName|ProductVersion)
|
||||||
|
IFS='<>' read -r _ _ "${line?}" _
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done < /System/Library/CoreServices/SystemVersion.plist
|
done < /System/Library/CoreServices/SystemVersion.plist
|
||||||
|
|
||||||
# Use the ProductVersion to determine which macOS/OS X codename
|
case ${ProductName?} in
|
||||||
# the system has. As far as I'm aware there's no "dynamic" way
|
iPhone*)
|
||||||
# of grabbing this information.
|
distro="iOS ${ProductVersion?}"
|
||||||
case $mac_version in
|
;;
|
||||||
10.4*) distro='Mac OS X Tiger' ;;
|
|
||||||
10.5*) distro='Mac OS X Leopard' ;;
|
|
||||||
10.6*) distro='Mac OS X Snow Leopard' ;;
|
|
||||||
10.7*) distro='Mac OS X Lion' ;;
|
|
||||||
10.8*) distro='OS X Mountain Lion' ;;
|
|
||||||
10.9*) distro='OS X Mavericks' ;;
|
|
||||||
10.10*) distro='OS X Yosemite' ;;
|
|
||||||
10.11*) distro='OS X El Capitan' ;;
|
|
||||||
10.12*) distro='macOS Sierra' ;;
|
|
||||||
10.13*) distro='macOS High Sierra' ;;
|
|
||||||
10.14*) distro='macOS Mojave' ;;
|
|
||||||
10.15*) distro='macOS Catalina' ;;
|
|
||||||
*) distro='macOS' ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
distro="$distro $mac_version"
|
*)
|
||||||
|
# Use the ProductVersion to determine which macOS/OS X
|
||||||
|
# codename the system has. As far as I'm aware there's
|
||||||
|
# no "dynamic" way of grabbing this information.
|
||||||
|
case ${ProductVersion?} in
|
||||||
|
10.4*) distro='Mac OS X Tiger' ;;
|
||||||
|
10.5*) distro='Mac OS X Leopard' ;;
|
||||||
|
10.6*) distro='Mac OS X Snow Leopard' ;;
|
||||||
|
10.7*) distro='Mac OS X Lion' ;;
|
||||||
|
10.8*) distro='OS X Mountain Lion' ;;
|
||||||
|
10.9*) distro='OS X Mavericks' ;;
|
||||||
|
10.10*) distro='OS X Yosemite' ;;
|
||||||
|
10.11*) distro='OS X El Capitan' ;;
|
||||||
|
10.12*) distro='macOS Sierra' ;;
|
||||||
|
10.13*) distro='macOS High Sierra' ;;
|
||||||
|
10.14*) distro='macOS Mojave' ;;
|
||||||
|
10.15*) distro='macOS Catalina' ;;
|
||||||
|
*) distro='macOS' ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
distro="$distro ${ProductVersion?}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
Haiku)
|
Haiku)
|
||||||
@@ -261,19 +271,6 @@ get_os() {
|
|||||||
IFS='(' read -r distro _ < /etc/release
|
IFS='(' read -r distro _ < /etc/release
|
||||||
;;
|
;;
|
||||||
|
|
||||||
CYGWIN*|MSYS*|MINGW*)
|
|
||||||
# Grab everything after the first instance of
|
|
||||||
# white-space in the command output of 'wmic'.
|
|
||||||
#
|
|
||||||
# The format of 'wmic' is as follows:
|
|
||||||
# Caption=Microsoft Windows 7 Enterprise
|
|
||||||
#
|
|
||||||
# This extracts: ^^^^^^^^^^^^^^^^^^^^
|
|
||||||
read -r _ distro <<-EOF
|
|
||||||
$(wmic os get Caption /value)
|
|
||||||
EOF
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
*)
|
||||||
# Catch all to ensure '$distro' is never blank.
|
# Catch all to ensure '$distro' is never blank.
|
||||||
# This also handles the BSDs.
|
# This also handles the BSDs.
|
||||||
@@ -320,21 +317,6 @@ get_host() {
|
|||||||
*BSD*)
|
*BSD*)
|
||||||
host=$(sysctl -n hw.vendor hw.product)
|
host=$(sysctl -n hw.vendor hw.product)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
CYGWIN*|MSYS*|MINGW*)
|
|
||||||
# Grab everything after the first instance of '=' in each
|
|
||||||
# line of the command output of 'wmic'. Append the output
|
|
||||||
# of each line to the '$host' variable.
|
|
||||||
#
|
|
||||||
# The format of 'wmic' is as follows:
|
|
||||||
# Manufacturer=VMware, Inc.
|
|
||||||
# Model=VMware Virtual Platform
|
|
||||||
while IFS='=' read -r _ val; do
|
|
||||||
host="${host}${val:+ $val}"
|
|
||||||
done <<-EOF
|
|
||||||
$(wmic computersystem get manufacturer,model /value)
|
|
||||||
EOF
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Turn the host string into an argument list so we can iterate
|
# Turn the host string into an argument list so we can iterate
|
||||||
@@ -384,7 +366,7 @@ get_uptime() {
|
|||||||
# converting that data into days, hours and minutes using simple
|
# converting that data into days, hours and minutes using simple
|
||||||
# math.
|
# math.
|
||||||
case $os in
|
case $os in
|
||||||
Linux*|Minix*|CYGWIN*|MSYS*|MINGW*)
|
Linux*|Minix*)
|
||||||
IFS=. read -r s _ < /proc/uptime
|
IFS=. read -r s _ < /proc/uptime
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -513,14 +495,6 @@ get_pkgs() {
|
|||||||
has pkginfo && pkginfo -i
|
has pkginfo && pkginfo -i
|
||||||
has pkg && pkg list
|
has pkg && pkg list
|
||||||
;;
|
;;
|
||||||
|
|
||||||
CYGWIN*)
|
|
||||||
cygcheck -cd
|
|
||||||
;;
|
|
||||||
|
|
||||||
MSYS*)
|
|
||||||
pacman -Qq
|
|
||||||
;;
|
|
||||||
esac | wc -l
|
esac | wc -l
|
||||||
`
|
`
|
||||||
|
|
||||||
@@ -532,7 +506,7 @@ get_memory() {
|
|||||||
# Used memory is calculated using the following "formula":
|
# Used memory is calculated using the following "formula":
|
||||||
# MemUsed = MemTotal + Shmem - MemFree - Buffers - Cached - SReclaimable
|
# MemUsed = MemTotal + Shmem - MemFree - Buffers - Cached - SReclaimable
|
||||||
# Source: https://github.com/KittyKatt/screenFetch/issues/386
|
# Source: https://github.com/KittyKatt/screenFetch/issues/386
|
||||||
Linux*|CYGWIN*|MSYS*|MINGW*)
|
Linux*)
|
||||||
# Parse the '/proc/meminfo' file splitting on ':' and 'k'.
|
# Parse the '/proc/meminfo' file splitting on ':' and 'k'.
|
||||||
# The format of the file is 'key: 000kB' and an additional
|
# The format of the file is 'key: 000kB' and an additional
|
||||||
# split is used on 'k' to filter out 'kB'.
|
# split is used on 'k' to filter out 'kB'.
|
||||||
|
|||||||
Reference in New Issue
Block a user