mirror of
https://github.com/dylanaraps/pfetch.git
synced 2026-01-02 16:02:12 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af166966b9 | ||
|
|
219d8f2117 | ||
|
|
0834d53b2a | ||
|
|
0f1d6845db | ||
|
|
3895dd003d |
@@ -37,7 +37,6 @@ picture"!
|
|||||||
- **MacOS**
|
- **MacOS**
|
||||||
- **Minix**
|
- **Minix**
|
||||||
- **Solaris**
|
- **Solaris**
|
||||||
- **IRIX**
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
@@ -58,11 +57,6 @@ PF_INFO="ascii"
|
|||||||
# Example: Only Information.
|
# Example: Only Information.
|
||||||
PF_INFO="title os host kernel uptime pkgs memory"
|
PF_INFO="title os host kernel uptime pkgs memory"
|
||||||
|
|
||||||
# A file to source before running pfetch.
|
|
||||||
# Default: unset
|
|
||||||
# Valid: A shell script
|
|
||||||
PF_SOURCE=""
|
|
||||||
|
|
||||||
# Separator between info name and info data.
|
# Separator between info name and info data.
|
||||||
# Default: unset
|
# Default: unset
|
||||||
# Valid: string
|
# Valid: string
|
||||||
|
|||||||
590
pfetch
590
pfetch
@@ -83,7 +83,7 @@ log() {
|
|||||||
printf '[3%s;1m%s[m' "${PF_COL1-4}" "$name"
|
printf '[3%s;1m%s[m' "${PF_COL1-4}" "$name"
|
||||||
|
|
||||||
# Print the info name and info data separator.
|
# Print the info name and info data separator.
|
||||||
printf %s "$PF_SEP"
|
printf '%s' "$PF_SEP"
|
||||||
|
|
||||||
# Move the cursor backward the length of the *current* info name and
|
# Move the cursor backward the length of the *current* info name and
|
||||||
# then move it forwards the length of the *longest* info name. This
|
# then move it forwards the length of the *longest* info name. This
|
||||||
@@ -131,7 +131,7 @@ get_os() {
|
|||||||
Linux*)
|
Linux*)
|
||||||
# Some Linux distributions (which are based on others)
|
# Some Linux distributions (which are based on others)
|
||||||
# fail to identify as they **do not** change the upstream
|
# fail to identify as they **do not** change the upstream
|
||||||
# distribution's identification packages or files.
|
# distributions identification packages or files.
|
||||||
#
|
#
|
||||||
# It is senseless to add a special case in the code for
|
# It is senseless to add a special case in the code for
|
||||||
# each and every distribution (which _is_ technically no
|
# each and every distribution (which _is_ technically no
|
||||||
@@ -182,13 +182,6 @@ get_os() {
|
|||||||
command -v crux && distro=$(crux)
|
command -v crux && distro=$(crux)
|
||||||
command -v guix && distro='Guix System'
|
command -v guix && distro='Guix System'
|
||||||
|
|
||||||
# Check to see if we're running Bedrock Linux which is
|
|
||||||
# very unique. This simply checks to see if the user's
|
|
||||||
# PATH contais a Bedrock specific value.
|
|
||||||
case $PATH in
|
|
||||||
*/bedrock/cross/*) distro='Bedrock Linux'
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Check to see if Linux is running in Windows 10 under
|
# Check to see if Linux is running in Windows 10 under
|
||||||
# WSL1 (Windows subsystem for Linux [version 1]) and
|
# WSL1 (Windows subsystem for Linux [version 1]) and
|
||||||
# append a string accordingly.
|
# append a string accordingly.
|
||||||
@@ -286,13 +279,13 @@ get_kernel() {
|
|||||||
case $os in
|
case $os in
|
||||||
# Don't print kernel output on some systems as the
|
# Don't print kernel output on some systems as the
|
||||||
# OS name includes it.
|
# OS name includes it.
|
||||||
*BSD*|Haiku|Minix)
|
*BSD*|Haiku|Minix) ;;
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# '$kernel' is the cached output of 'uname -r'.
|
*)
|
||||||
log kernel "$kernel" >&6
|
# '$kernel' is the cached output of 'uname -r'.
|
||||||
|
log kernel "$kernel" >&6
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
get_host() {
|
get_host() {
|
||||||
@@ -317,7 +310,7 @@ get_host() {
|
|||||||
machdep.dmi.system-product)
|
machdep.dmi.system-product)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*BSD*|Minix)
|
*BSD*)
|
||||||
host=$(sysctl -n hw.vendor hw.product)
|
host=$(sysctl -n hw.vendor hw.product)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -350,7 +343,7 @@ get_host() {
|
|||||||
# found in the "blacklist" below. Only non-matches are appended
|
# found in the "blacklist" below. Only non-matches are appended
|
||||||
# to the final host string.
|
# to the final host string.
|
||||||
case $word in
|
case $word in
|
||||||
To | [Bb]e | [Ff]illed | [Bb]y | O.E.M. | OEM |\
|
To | [Bb]e | [Ff]illed | by | O.E.M. | OEM |\
|
||||||
Not | Applicable | Specified | System | Product | Name |\
|
Not | Applicable | Specified | System | Product | Name |\
|
||||||
Version | Undefined | Default | string | INVALID | <20> | os )
|
Version | Undefined | Default | string | INVALID | <20> | os )
|
||||||
continue
|
continue
|
||||||
@@ -404,25 +397,6 @@ get_uptime() {
|
|||||||
$(kstat -p unix:0:system_misc:snaptime)
|
$(kstat -p unix:0:system_misc:snaptime)
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
IRIX)
|
|
||||||
# Grab the uptime in a pretty format. Usually,
|
|
||||||
# 00:00:00 from the 'ps' command.
|
|
||||||
t=$(LC_ALL=POSIX ps -o etime= -p 1)
|
|
||||||
|
|
||||||
# Split the pretty output into days or hours
|
|
||||||
# based on the uptime.
|
|
||||||
case $t in
|
|
||||||
*-*) d=${t%%-*} t=${t#*-} ;;
|
|
||||||
*:*:*) h=${t%%:*} t=${t#*:} ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
h=${h#0} t=${t#0}
|
|
||||||
|
|
||||||
# Convert the split pretty fields back into
|
|
||||||
# seconds so we may re-convert them to our format.
|
|
||||||
s=$((${d:-0}*86400 + ${h:-0}*3600 + ${t%%:*}*60 + ${t#*:}))
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Convert the uptime from seconds into days, hours and minutes.
|
# Convert the uptime from seconds into days, hours and minutes.
|
||||||
@@ -471,14 +445,12 @@ get_pkgs() {
|
|||||||
has xbps-query && xbps-query -l
|
has xbps-query && xbps-query -l
|
||||||
has apk && apk info
|
has apk && apk info
|
||||||
has guix && guix package --list-installed
|
has guix && guix package --list-installed
|
||||||
has opkg && opkg list-installed
|
|
||||||
|
|
||||||
# Directories containing packages.
|
# Directories containing packages.
|
||||||
has kiss && printf '%s\n' /var/db/kiss/installed/*/
|
has kiss && printf '%s\n' /var/db/kiss/installed/*/
|
||||||
has brew && printf '%s\n' "$(brew --cellar)/"*
|
has brew && printf '%s\n' "$(brew --cellar)/"*
|
||||||
has emerge && printf '%s\n' /var/db/pkg/*/*/
|
has emerge && printf '%s\n' /var/db/pkg/*/*/
|
||||||
has pkgtool && printf '%s\n' /var/log/packages/*
|
has pkgtool && printf '%s\n' /var/log/packages/*
|
||||||
has eopkg && printf '%s\n' /var/lib/eopkg/package/*
|
|
||||||
|
|
||||||
# 'nix' requires two commands.
|
# 'nix' requires two commands.
|
||||||
has nix-store && {
|
has nix-store && {
|
||||||
@@ -534,19 +506,9 @@ get_pkgs() {
|
|||||||
has pkginfo && pkginfo -i
|
has pkginfo && pkginfo -i
|
||||||
has pkg && pkg list
|
has pkg && pkg list
|
||||||
;;
|
;;
|
||||||
|
|
||||||
IRIX)
|
|
||||||
versions -b
|
|
||||||
;;
|
|
||||||
esac | wc -l
|
esac | wc -l
|
||||||
`
|
`
|
||||||
|
|
||||||
case $os in
|
|
||||||
# IRIX's package manager adds 3 lines of extra
|
|
||||||
# output which we must account for here.
|
|
||||||
IRIX) packages=$((packages - 3)) ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
[ "$packages" -gt 1 ] && log pkgs "$packages" >&6
|
[ "$packages" -gt 1 ] && log pkgs "$packages" >&6
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -727,32 +689,72 @@ get_memory() {
|
|||||||
mem_free=$((pages_free * hw_pagesize / 1024 / 1024))
|
mem_free=$((pages_free * hw_pagesize / 1024 / 1024))
|
||||||
mem_used=$((mem_full - mem_free))
|
mem_used=$((mem_full - mem_free))
|
||||||
;;
|
;;
|
||||||
|
|
||||||
IRIX)
|
|
||||||
# Read the memory information from the 'top' command. Parse
|
|
||||||
# and split each line until we reach the line starting with
|
|
||||||
# "Memory".
|
|
||||||
#
|
|
||||||
# Example output: Memory: 160M max, 147M avail, .....
|
|
||||||
while IFS=' :' read -r label mem_full _ mem_free _; do
|
|
||||||
case $label in
|
|
||||||
Memory)
|
|
||||||
mem_full=${mem_full%M}
|
|
||||||
mem_free=${mem_free%M}
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done <<-EOF
|
|
||||||
$(top -n)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
mem_used=$((mem_full - mem_free))
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
log memory "${mem_used:-?}M / ${mem_full:-?}M" >&6
|
log memory "${mem_used:-?}M / ${mem_full:-?}M" >&6
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_disk() {
|
||||||
|
# Store the version of the 'df' command as the available
|
||||||
|
# flags, options and implementation differs between operating
|
||||||
|
# systems and we need to handle these edge-cases.
|
||||||
|
df_version=$(df --version 2>&1)
|
||||||
|
|
||||||
|
case $df_version in
|
||||||
|
# The 'df' command is from AIX.
|
||||||
|
*IMitv*)
|
||||||
|
set -- -P -g
|
||||||
|
;;
|
||||||
|
|
||||||
|
# The 'df' command is from IRIX.
|
||||||
|
*befhikm*)
|
||||||
|
set -- -P -k
|
||||||
|
;;
|
||||||
|
|
||||||
|
# The 'df' command is from OpenBSD.
|
||||||
|
*hiklnP*)
|
||||||
|
set -- -h
|
||||||
|
;;
|
||||||
|
|
||||||
|
# The 'df' command is from Haiku and is wildly
|
||||||
|
# different and provides no workable output,
|
||||||
|
# end here.
|
||||||
|
*Tracker*) # Haiku
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
|
||||||
|
# From testing it is saffe to assume that
|
||||||
|
# any other 'df' version provides these flags.
|
||||||
|
*)
|
||||||
|
set -- -P -h
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Read the output of 'df' line by line. The first line
|
||||||
|
# contains header information for the "table" so it is
|
||||||
|
# skipped.
|
||||||
|
#
|
||||||
|
# The next lines are then split to grab the relevant
|
||||||
|
# information and thankfully the output remains the
|
||||||
|
# same between all but one 'df' implementation.
|
||||||
|
#
|
||||||
|
# TODO: Configure disks to send to 'df'. Do we need to
|
||||||
|
# do this? I'd love to _not_ do it.
|
||||||
|
df "$@" / | while read -r name full used _ perc _; do
|
||||||
|
[ "$header" ] || { header=1; continue; }
|
||||||
|
|
||||||
|
case $df_version in
|
||||||
|
# The 'df' command is from IRIX.
|
||||||
|
*befhikm*)
|
||||||
|
used=$((used/1024/1024))G
|
||||||
|
full=$((full/1024/1024))G
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
log disk "$name [$used / $full ($perc)]" >&6
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
get_wm() {
|
get_wm() {
|
||||||
case $os in
|
case $os in
|
||||||
# Don't display window manager on macOS.
|
# Don't display window manager on macOS.
|
||||||
@@ -768,7 +770,7 @@ get_wm() {
|
|||||||
# atom..
|
# atom..
|
||||||
#
|
#
|
||||||
# List of window managers which fail to set the name atom:
|
# List of window managers which fail to set the name atom:
|
||||||
# catwm, fvwm, dwm, 2bwm, monster, wmaker and sowm [mine! ;)].
|
# catwm, fvwm, dwm, 2bwm and monster.
|
||||||
#
|
#
|
||||||
# The final downside to this approach is that it does _not_
|
# The final downside to this approach is that it does _not_
|
||||||
# support Wayland environments. The only solution which supports
|
# support Wayland environments. The only solution which supports
|
||||||
@@ -840,40 +842,7 @@ get_wm() {
|
|||||||
wm=${wm%%\"*}
|
wm=${wm%%\"*}
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*) wm= ;;
|
||||||
# Fallback to checking the process list
|
|
||||||
# for the select few window managers which
|
|
||||||
# don't set '_NET_WM_NAME'.
|
|
||||||
#
|
|
||||||
# TODO: This is currently limited to 'grep'
|
|
||||||
# implementations providing the '-o'
|
|
||||||
# flag. This needs to be replaced with
|
|
||||||
# a command which searches for a list
|
|
||||||
# of strings and returns _only_ the
|
|
||||||
# first match's contents (also ensuring
|
|
||||||
# the search itself isn't matched).
|
|
||||||
#
|
|
||||||
# A generic parser isn't possible as
|
|
||||||
# the output of 'ps' is _not_ the same
|
|
||||||
# between implementations and across
|
|
||||||
# operating systems.
|
|
||||||
#
|
|
||||||
# The simple search method above works
|
|
||||||
# regardless of 'ps' implementation.
|
|
||||||
#
|
|
||||||
# Disable the shellcheck warning about using
|
|
||||||
# 'pgrep' instead of 'ps | grep' as 'pgrep'
|
|
||||||
# is not always available.
|
|
||||||
# shellcheck disable=2009
|
|
||||||
wm=$(ps x | grep -o \
|
|
||||||
-e '[c]atwm' \
|
|
||||||
-e '[f]vwm' \
|
|
||||||
-e '[d]wm' \
|
|
||||||
-e '[2]bwm' \
|
|
||||||
-e '[m]onsterwm' \
|
|
||||||
-e '[w]maker' \
|
|
||||||
-e '[s]owm')
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
;;
|
;;
|
||||||
@@ -911,12 +880,12 @@ get_palette() {
|
|||||||
#
|
#
|
||||||
# This allows us to save hardcoding a second set of sequences
|
# This allows us to save hardcoding a second set of sequences
|
||||||
# for background colors.
|
# for background colors.
|
||||||
palette="[7m$c1 $c1 $c2 $c2 $c3 $c3 $c4 $c4 $c5 $c5 $c6 $c6 [m"
|
palette=" [7m$c1 $c2 $c3 $c4 $c5 $c6 $c7 "
|
||||||
|
|
||||||
# Print the palette with a new-line before and afterwards.
|
# Print the palette with a newline before and after.
|
||||||
printf '\n' >&6
|
# The '\033[%sC' moves the text to the right, the
|
||||||
log "$palette
|
# length of the ascii art.
|
||||||
" " " >&6
|
printf '\n[%sC%s[m\n' "${ascii_width-1}" "$palette" >&6
|
||||||
}
|
}
|
||||||
|
|
||||||
get_ascii() {
|
get_ascii() {
|
||||||
@@ -963,63 +932,54 @@ get_ascii() {
|
|||||||
/${c7}/ ${c4}\\ \\
|
/${c7}/ ${c4}\\ \\
|
||||||
/${c7}// ${c4}\\ \\
|
/${c7}// ${c4}\\ \\
|
||||||
${c7}// ${c4}\\ \\
|
${c7}// ${c4}\\ \\
|
||||||
${c4}\\
|
\\
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Aa]ndroid*)
|
[Aa]ndroid*)
|
||||||
read_ascii 2 <<-EOF
|
read_ascii 2 <<-EOF
|
||||||
${c2} ;, ,;
|
${c2} ;, ,;
|
||||||
${c2} ';,.-----.,;'
|
';,.-----.,;'
|
||||||
${c2} ,' ',
|
,' ',
|
||||||
${c2} / O O \\
|
/ O O \\
|
||||||
${c2}| |
|
| |
|
||||||
${c2}'-----------------'
|
'-----------------'
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Aa]rch*)
|
[Aa]rch*)
|
||||||
read_ascii 4 <<-EOF
|
read_ascii 4 <<-EOF
|
||||||
${c6} /\\
|
${c6} /\\
|
||||||
${c6} / \\
|
/ \\
|
||||||
${c6} /\\ \\
|
/\\ \\
|
||||||
${c4} / \\
|
${c4} / \\
|
||||||
${c4} / ,, \\
|
/ ,, \\
|
||||||
${c4} / | | -\\
|
/ | | -\\
|
||||||
${c4} /_-'' ''-_\\
|
/_-'' ''-_\\
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Aa]rco*)
|
[Aa]rco*)
|
||||||
read_ascii 4 <<-EOF
|
read_ascii 4 <<-EOF
|
||||||
${c4} /\\
|
${c4} /\\
|
||||||
${c4} / \\
|
/ \\
|
||||||
${c4} / /\\ \\
|
/ /\\ \\
|
||||||
${c4} / / \\ \\
|
/ / \\ \\
|
||||||
${c4} / / \\ \\
|
/ / \\ \\
|
||||||
${c4} / / _____\\ \\
|
/ / _____\\ \\
|
||||||
${c4}/_/ \`----.\\_\\
|
/_/ \`----.\\_\\
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Aa]rtix*)
|
[Aa]rtix*)
|
||||||
read_ascii 6 <<-EOF
|
read_ascii 6 <<-EOF
|
||||||
${c4} /\\
|
${c4} /\\
|
||||||
${c4} / \\
|
/ \\
|
||||||
${c4} /\`'.,\\
|
/\`'.,\\
|
||||||
${c4} / ',
|
/ ',
|
||||||
${c4} / ,\`\\
|
/ ,\`\\
|
||||||
${c4} / ,.'\`. \\
|
/ ,.'\`. \\
|
||||||
${c4}/.,'\` \`'.\\
|
/.,'\` \`'.\\
|
||||||
EOF
|
|
||||||
;;
|
|
||||||
|
|
||||||
[Bb]edrock*)
|
|
||||||
read_ascii 4 <<-EOF
|
|
||||||
${c7}__
|
|
||||||
${c7}\\ \\___
|
|
||||||
${c7} \\ _ \\
|
|
||||||
${c7} \\___/
|
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -1038,11 +998,11 @@ get_ascii() {
|
|||||||
[Dd]ebian*)
|
[Dd]ebian*)
|
||||||
read_ascii 1 <<-EOF
|
read_ascii 1 <<-EOF
|
||||||
${c1} _____
|
${c1} _____
|
||||||
${c1} / __ \\
|
/ __ \\
|
||||||
${c1}| / |
|
| / |
|
||||||
${c1}| \\___-
|
| \\___-
|
||||||
${c1}-_
|
-_
|
||||||
${c1} --_
|
--_
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -1053,30 +1013,19 @@ get_ascii() {
|
|||||||
>--${c1}|${c7}--<
|
>--${c1}|${c7}--<
|
||||||
(_-'${c1}|${c7}'-_)
|
(_-'${c1}|${c7}'-_)
|
||||||
${c1}|
|
${c1}|
|
||||||
${c1}|
|
|
|
||||||
${c1}|
|
|
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Ee]lementary*)
|
[Ee]lementary*)
|
||||||
read_ascii <<-EOF
|
read_ascii <<-EOF
|
||||||
${c7} _______
|
${c7} _______
|
||||||
${c7} / ____ \\
|
/ ____ \\
|
||||||
${c7}/ | / /\\
|
/ | / /\\
|
||||||
${c7}|__\\ / / |
|
|__\\ / / |
|
||||||
${c7}\\ /__/ /
|
\\ /__/ /
|
||||||
${c7}\\_______/
|
\\_______/
|
||||||
EOF
|
|
||||||
;;
|
|
||||||
|
|
||||||
[Ee]ndeavour*)
|
|
||||||
read_ascii 4 <<-EOF
|
|
||||||
${c1}/${c4}\\
|
|
||||||
${c1}/${c4}/ \\${c6}\\
|
|
||||||
${c1}/${c4}/ \\ ${c6}\\
|
|
||||||
${c1}/ ${c4}/ _) ${c6})
|
|
||||||
${c1}/_${c4}/___-- ${c6}__-
|
|
||||||
${c6}/____--
|
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -1096,83 +1045,71 @@ get_ascii() {
|
|||||||
[Ff]ree[Bb][Ss][Dd]*)
|
[Ff]ree[Bb][Ss][Dd]*)
|
||||||
read_ascii 1 <<-EOF
|
read_ascii 1 <<-EOF
|
||||||
${c1}/\\,-'''''-,/\\
|
${c1}/\\,-'''''-,/\\
|
||||||
${c1}\\_) (_/
|
\\_) (_/
|
||||||
${c1}| |
|
| |
|
||||||
${c1}| |
|
| |
|
||||||
${c1}; ;
|
; ;
|
||||||
${c1}'-_____-'
|
'-_____-'
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Gg]entoo*)
|
[Gg]entoo*)
|
||||||
read_ascii 5 <<-EOF
|
read_ascii 5 <<-EOF
|
||||||
${c5} _-----_
|
${c5} _-----_
|
||||||
${c5}( \\
|
( \\
|
||||||
${c5}\\ 0 \\
|
\\ 0 \\
|
||||||
${c7} \\ )
|
${c7} \\ )
|
||||||
${c7} / _/
|
/ _/
|
||||||
${c7}( _-
|
( _-
|
||||||
${c7}\\____-
|
\\____-
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Gg]uix[Ss][Dd]*|[Gg]uix*)
|
[Gg]uix[Ss][Dd]*|[Gg]uix*)
|
||||||
read_ascii 3 <<-EOF
|
read_ascii 3 <<-EOF
|
||||||
${c3}|.__ __.|
|
${c3}|.__ __.|
|
||||||
${c3}|__ \\ / __|
|
|__ \\ / __|
|
||||||
${c3}\\ \\ / /
|
\\ \\ / /
|
||||||
${c3}\\ \\ / /
|
\\ \\ / /
|
||||||
${c3}\\ \\ / /
|
\\ \\ / /
|
||||||
${c3}\\ \\/ /
|
\\ \\/ /
|
||||||
${c3}\\__/
|
\\__/
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Hh]aiku*)
|
[Hh]aiku*)
|
||||||
read_ascii 3 <<-EOF
|
read_ascii 3 <<-EOF
|
||||||
${c3} ,^,
|
${c3} ,^,
|
||||||
${c3} / \\
|
/ \\
|
||||||
${c3}*--_ ; ; _--*
|
*--_ ; ; _--*
|
||||||
${c3}\\ '" "' /
|
\\ '" "' /
|
||||||
${c3}'. .'
|
'. .'
|
||||||
${c3}.-'" "'-.
|
.-'" "'-.
|
||||||
${c3}'-.__. .__.-'
|
'-.__. .__.-'
|
||||||
${c3}|_|
|
|_|
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Hh]yperbola*)
|
[Hh]yperbola*)
|
||||||
read_ascii <<-EOF
|
read_ascii <<-EOF
|
||||||
${c7} |\`__.\`/
|
${c7} |\`__.\`/
|
||||||
${c7} \____/
|
\____/
|
||||||
${c7} .--.
|
.--.
|
||||||
${c7} / \\
|
/ \\
|
||||||
${c7} / ___ \\
|
/ ___ \\
|
||||||
${c7}/ .\` \`.\\
|
/ .\` \`.\\
|
||||||
${c7}/.\` \`.\\
|
/.\` \`.\\
|
||||||
EOF
|
|
||||||
;;
|
|
||||||
|
|
||||||
[Ii][Rr][Ii][Xx]*)
|
|
||||||
read_ascii 1 <<-EOF
|
|
||||||
${c1} __
|
|
||||||
${c1} \\ \\ __
|
|
||||||
${c1} \\ \\ / /
|
|
||||||
${c1} \\ v /
|
|
||||||
${c1} / . \\
|
|
||||||
${c1} /_/ \\ \\
|
|
||||||
${c1} \\_\\
|
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Ll]inux*[Ll]ite*|[Ll]ite*)
|
[Ll]inux*[Ll]ite*|[Ll]ite*)
|
||||||
read_ascii 3 <<-EOF
|
read_ascii 3 <<-EOF
|
||||||
${c3} /\\
|
${c3} /\\
|
||||||
${c3} / \\
|
/ \\
|
||||||
${c3} / ${c7}/ ${c3}/
|
/ ${c7}/ ${c3}/
|
||||||
${c3}> ${c7}/ ${c3}/
|
> ${c7}/ ${c3}/
|
||||||
${c3}\\ ${c7}\\ ${c3}\\
|
\\ ${c7}\\ ${c3}\\
|
||||||
${c3}\\_${c7}\\${c3}_\\
|
\\_${c7}\\${c3}_\\
|
||||||
${c7} \\
|
${c7} \\
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
@@ -1180,12 +1117,12 @@ get_ascii() {
|
|||||||
[Ll]inux*[Mm]int*|[Mm]int)
|
[Ll]inux*[Mm]int*|[Mm]int)
|
||||||
read_ascii 2 <<-EOF
|
read_ascii 2 <<-EOF
|
||||||
${c2} ___________
|
${c2} ___________
|
||||||
${c2}|_ \\
|
|_ \\
|
||||||
${c2}| ${c7}| _____ ${c2}|
|
| ${c7}| _____ ${c2}|
|
||||||
${c2}| ${c7}| | | | ${c2}|
|
| ${c7}| | | | ${c2}|
|
||||||
${c2}| ${c7}| | | | ${c2}|
|
| ${c7}| | | | ${c2}|
|
||||||
${c2}| ${c7}\\__${c7}___/ ${c2}|
|
| ${c7}\\__${c7}___/ ${c2}|
|
||||||
${c2}\\_________/
|
\\_________/
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -1193,10 +1130,10 @@ get_ascii() {
|
|||||||
[Ll]inux*)
|
[Ll]inux*)
|
||||||
read_ascii 4 <<-EOF
|
read_ascii 4 <<-EOF
|
||||||
${c4} ___
|
${c4} ___
|
||||||
${c4}(${c7}.. ${c4}|
|
(${c7}.· ${c4}|
|
||||||
${c4}(${c5}<> ${c4}|
|
(${c5}<> ${c4}|
|
||||||
${c4}/ ${c7}__ ${c4}\\
|
/ ${c7}__ ${c4}\\
|
||||||
${c4}( ${c7}/ \\ ${c4}/|
|
( ${c7}/ \\ ${c4}/|
|
||||||
${c5}_${c4}/\\ ${c7}__)${c4}/${c5}_${c4})
|
${c5}_${c4}/\\ ${c7}__)${c4}/${c5}_${c4})
|
||||||
${c5}\/${c4}-____${c5}\/
|
${c5}\/${c4}-____${c5}\/
|
||||||
EOF
|
EOF
|
||||||
@@ -1205,9 +1142,9 @@ get_ascii() {
|
|||||||
[Mm]ac[Oo][Ss]*|[Dd]arwin*)
|
[Mm]ac[Oo][Ss]*|[Dd]arwin*)
|
||||||
read_ascii 1 <<-EOF
|
read_ascii 1 <<-EOF
|
||||||
${c1} .:'
|
${c1} .:'
|
||||||
${c1} _ :'_
|
_ :'_
|
||||||
${c2} .'\`_\`-'_\`\`.
|
${c2} .'\`_\`-'_\`\`.
|
||||||
${c2}:________.-'
|
:________.-'
|
||||||
${c3}:_______:
|
${c3}:_______:
|
||||||
${c4} :_______\`-;
|
${c4} :_______\`-;
|
||||||
${c5} \`._.-._.'
|
${c5} \`._.-._.'
|
||||||
@@ -1217,49 +1154,49 @@ get_ascii() {
|
|||||||
[Mm]ageia*)
|
[Mm]ageia*)
|
||||||
read_ascii 2 <<-EOF
|
read_ascii 2 <<-EOF
|
||||||
${c6} *
|
${c6} *
|
||||||
${c6} *
|
*
|
||||||
${c6} **
|
**
|
||||||
${c7} /\\__/\\
|
${c7} /\\__/\\
|
||||||
${c7}/ \\
|
/ \\
|
||||||
${c7}\\ /
|
\\ /
|
||||||
${c7} \\____/
|
\\____/
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Mm]anjaro*)
|
[Mm]anjaro*)
|
||||||
read_ascii 2 <<-EOF
|
read_ascii 2 <<-EOF
|
||||||
${c2}||||||||| ||||
|
${c2}||||||||| ||||
|
||||||
${c2}||||||||| ||||
|
||||||||| ||||
|
||||||
${c2}|||| ||||
|
|||| ||||
|
||||||
${c2}|||| |||| ||||
|
|||| |||| ||||
|
||||||
${c2}|||| |||| ||||
|
|||| |||| ||||
|
||||||
${c2}|||| |||| ||||
|
|||| |||| ||||
|
||||||
${c2}|||| |||| ||||
|
|||| |||| ||||
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Mm]inix*)
|
[Mm]inix*)
|
||||||
read_ascii 4 <<-EOF
|
read_ascii 4 <<-EOF
|
||||||
${c4} ,, ,,
|
${c4} ,, ,,
|
||||||
${c4};${c7},${c4} ', ,' ${c7},${c4};
|
;${c7},${c4} ', ,' ${c7},${c4};
|
||||||
${c4}; ${c7}',${c4} ',,' ${c7},'${c4} ;
|
; ${c7}',${c4} ',,' ${c7},'${c4} ;
|
||||||
${c4}; ${c7}',${c4} ${c7},'${c4} ;
|
; ${c7}',${c4} ${c7},'${c4} ;
|
||||||
${c4}; ${c7};, '' ,;${c4} ;
|
; ${c7};, '' ,;${c4} ;
|
||||||
${c4}; ${c7};${c4};${c7}',,'${c4};${c7};${c4} ;
|
; ${c7};${c4};${c7}',,'${c4};${c7};${c4} ;
|
||||||
${c4}', ${c7};${c4};; ;;${c7};${c4} ,'
|
', ${c7};${c4};; ;;${c7};${c4} ,'
|
||||||
${c4} '${c7};${c4}' '${c7};${c4}'
|
'${c7};${c4}' '${c7};${c4}'
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Mm][Xx]*)
|
[Mm][Xx]*)
|
||||||
read_ascii <<-EOF
|
read_ascii <<-EOF
|
||||||
${c7} \\\\ /
|
${c7} \\\\ /
|
||||||
${c7} \\\\/
|
\\\\/
|
||||||
${c7} \\\\
|
\\\\
|
||||||
${c7} /\\/ \\\\
|
/\\/ \\\\
|
||||||
${c7} / \\ /\\
|
/ \\ /\\
|
||||||
${c7} / \\/ \\
|
/ \\/ \\
|
||||||
${c7}/__________\\
|
/__________\\
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -1270,137 +1207,124 @@ get_ascii() {
|
|||||||
${c7} \\\\ ${c3}\`.____
|
${c7} \\\\ ${c3}\`.____
|
||||||
${c7} \\\\${c3}-______,----\`-
|
${c7} \\\\${c3}-______,----\`-
|
||||||
${c7} \\\\
|
${c7} \\\\
|
||||||
${c7} \\\\
|
\\\\
|
||||||
${c7} \\\\
|
\\\\
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Nn]ix[Oo][Ss]*)
|
[Nn]ix[Oo][Ss]*)
|
||||||
read_ascii 4 <<-EOF
|
read_ascii 4 <<-EOF
|
||||||
${c4} \\\\ \\\\ //
|
${c4} \\\\ \\\\ //
|
||||||
${c4} ==\\\\__\\\\/ //
|
==\\\\__\\\\/ //
|
||||||
${c4} // \\\\//
|
// \\\\//
|
||||||
${c4}==// //==
|
==// //==
|
||||||
${c4} //\\\\___//
|
//\\\\___//
|
||||||
${c4}// /\\\\ \\\\==
|
// /\\\\ \\\\==
|
||||||
${c4} // \\\\ \\\\
|
// \\\\ \\\\
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Oo]pen[Bb][Ss][Dd]*)
|
[Oo]pen[Bb][Ss][Dd]*)
|
||||||
read_ascii 3 <<-EOF
|
read_ascii 3 <<-EOF
|
||||||
${c3} _____
|
${c3} _____
|
||||||
${c3} \\- -/
|
\\- -/
|
||||||
${c3} \\_/ \\
|
\\_/ \\
|
||||||
${c3} | ${c7}O O${c3} |
|
| ${c7}O O${c3} |
|
||||||
${c3} |_ < ) 3 )
|
|_ < ) 3 )
|
||||||
${c3} / \\ /
|
/ \\ /
|
||||||
${c3} /-_____-\\
|
/-_____-\\
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Oo]pen[Ss][Uu][Ss][Ee]*|[Oo]pen*SUSE*|SUSE*|suse*)
|
[Oo]penSUSE*|[Oo]pen*SUSE*|SUSE*|suse*)
|
||||||
read_ascii 2 <<-EOF
|
read_ascii 2 <<-EOF
|
||||||
${c2} _______
|
${c2} _______
|
||||||
${c2}__| __ \\
|
__| __ \\
|
||||||
${c2} / .\\ \\
|
/ .\\ \\
|
||||||
${c2} \\__/ |
|
\\__/ |
|
||||||
${c2} _______|
|
_______|
|
||||||
${c2} \\_______
|
\\_______
|
||||||
${c2}__________/
|
__________/
|
||||||
EOF
|
|
||||||
;;
|
|
||||||
|
|
||||||
[Oo]pen[Ww]rt*)
|
|
||||||
read_ascii 1 <<-EOF
|
|
||||||
${c1} _______
|
|
||||||
${c1}| |.-----.-----.-----.
|
|
||||||
${c1}| - || _ | -__| |
|
|
||||||
${c1}|_______|| __|_____|__|__|
|
|
||||||
${c1} ________|__| __
|
|
||||||
${c1}| | | |.----.| |_
|
|
||||||
${c1}| | | || _|| _|
|
|
||||||
${c1}|________||__| |____|
|
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Pp]arabola*)
|
[Pp]arabola*)
|
||||||
read_ascii 5 <<-EOF
|
read_ascii 5 <<-EOF
|
||||||
${c5} __ __ __ _
|
${c5} __ __ __ _
|
||||||
${c5}.\`_//_//_/ / \`.
|
.\`_//_//_/ / \`.
|
||||||
${c5} / .\`
|
/ .\`
|
||||||
${c5} / .\`
|
/ .\`
|
||||||
${c5} /.\`
|
/.\`
|
||||||
${c5} /\`
|
/\`
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Pp]op!_[Oo][Ss]*)
|
[Pp]op!_[Oo][Ss]*)
|
||||||
read_ascii 6 <<-EOF
|
read_ascii 6 <<-EOF
|
||||||
${c6}______
|
${c6}______
|
||||||
${c6}\\ _ \\ __
|
\\ _ \\ __
|
||||||
${c6}\\ \\ \\ \\ / /
|
\\ \\ \\ \\ / /
|
||||||
${c6}\\ \\_\\ \\ / /
|
\\ \\_\\ \\ / /
|
||||||
${c6}\\ ___\\ /_/
|
\\ ___\\ /_/
|
||||||
${c6} \\ \\ _
|
\\ \\ _
|
||||||
${c6} __\\_\\__(_)_
|
__\\_\\__(_)_
|
||||||
${c6}(___________)
|
(___________)
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Pp]ure[Oo][Ss]*)
|
[Pp]ure[Oo][Ss]*)
|
||||||
read_ascii <<-EOF
|
read_ascii <<-EOF
|
||||||
${c7} _____________
|
${c7} _____________
|
||||||
${c7}| _________ |
|
| _________ |
|
||||||
${c7}| | | |
|
| | | |
|
||||||
${c7}| | | |
|
| | | |
|
||||||
${c7}| |_________| |
|
| |_________| |
|
||||||
${c7}|_____________|
|
|_____________|
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Ss]lackware*)
|
[Ss]lackware*)
|
||||||
read_ascii 4 <<-EOF
|
read_ascii 4 <<-EOF
|
||||||
${c4} ________
|
${c4} ________
|
||||||
${c4} / ______|
|
/ ______|
|
||||||
${c4} | |______
|
| |______
|
||||||
${c4} \\______ \\
|
\\______ \\
|
||||||
${c4} ______| |
|
______| |
|
||||||
${c4}| |________/
|
| |________/
|
||||||
${c4}|____________
|
|____________
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Ss]un[Oo][Ss]|[Ss]olaris*)
|
[Ss]un[Oo][Ss]|[Ss]olaris*)
|
||||||
read_ascii 3 <<-EOF
|
read_ascii 3 <<-EOF
|
||||||
${c3} . .; .
|
${c3} . .; .
|
||||||
${c3} . :; :: ;: .
|
. :; :: ;: .
|
||||||
${c3} .;. .. .. .;.
|
.;. .. .. .;.
|
||||||
${c3}.. .. .. ..
|
.. .. .. ..
|
||||||
${c3} .;, ,;.
|
.;, ,;.
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Uu]buntu*)
|
[Uu]buntu*)
|
||||||
read_ascii 3 <<-EOF
|
read_ascii 3 <<-EOF
|
||||||
${c3} _
|
${c3} _
|
||||||
${c3} ---(_)
|
---(_)
|
||||||
${c3} _/ --- \\
|
_/ --- \\
|
||||||
${c3}(_) | |
|
(_) | |
|
||||||
${c3} \\ --- _/
|
\\ --- _/
|
||||||
${c3} ---(_)
|
---(_)
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Vv]oid*)
|
[Vv]oid*)
|
||||||
read_ascii 2 <<-EOF
|
read_ascii 2 <<-EOF
|
||||||
${c2} _______
|
${c2} _______
|
||||||
${c2} _ \\______ -
|
_ \\______ -
|
||||||
${c2}| \\ ___ \\ |
|
| \\ ___ \\ |
|
||||||
${c2}| | / \ | |
|
| | / \ | |
|
||||||
${c2}| | \___/ | |
|
| | \___/ | |
|
||||||
${c2}| \\______ \\_|
|
| \\______ \\_|
|
||||||
${c2} -_______\\
|
-_______\\
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -1439,8 +1363,12 @@ get_ascii() {
|
|||||||
# output without the use of a pipe ('|').
|
# output without the use of a pipe ('|').
|
||||||
# This ensures that any variables defined in the while loop
|
# This ensures that any variables defined in the while loop
|
||||||
# are still accessible in the script.
|
# are still accessible in the script.
|
||||||
|
#
|
||||||
|
# The 'awk' command below used to be a simple 'sed', however
|
||||||
|
# some versions of Android shipped with a totally broken 'sed'
|
||||||
|
# command from 'toybox' and so we're forced to avoid 'sed'.
|
||||||
done <<-EOF
|
done <<-EOF
|
||||||
$(printf %s "$ascii" | sed 's/\[3.m//g')
|
$(printf %s "$ascii" | awk '{gsub("\\[3.m","");print}')
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Add a gap between the ascii art and the information.
|
# Add a gap between the ascii art and the information.
|
||||||
@@ -1463,11 +1391,6 @@ main() {
|
|||||||
# This gives full control over what it displayed on the screen.
|
# This gives full control over what it displayed on the screen.
|
||||||
exec 6>&1 >/dev/null
|
exec 6>&1 >/dev/null
|
||||||
|
|
||||||
# Allow the user to execute their own script and modify or
|
|
||||||
# extend pfetch's behavior.
|
|
||||||
# shellcheck source=/dev/null
|
|
||||||
. "${PF_SOURCE:-/dev/null}" ||:
|
|
||||||
|
|
||||||
# Ensure that the 'TMPDIR' is writable as heredocs use it and
|
# Ensure that the 'TMPDIR' is writable as heredocs use it and
|
||||||
# fail without the write permission. This was found to be the
|
# fail without the write permission. This was found to be the
|
||||||
# case on Android where the temporary directory requires root.
|
# case on Android where the temporary directory requires root.
|
||||||
@@ -1483,7 +1406,9 @@ main() {
|
|||||||
c7='[37m'; c8='[38m'
|
c7='[37m'; c8='[38m'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Avoid text-wrapping from wrecking the program output.
|
# Avoid text-wrapping from wrecking the program output
|
||||||
|
# and hide the cursor to hide its moving around during
|
||||||
|
# the printing process.
|
||||||
#
|
#
|
||||||
# Some terminals don't support these sequences, nor do they
|
# Some terminals don't support these sequences, nor do they
|
||||||
# silently conceal them if they're printed resulting in
|
# silently conceal them if they're printed resulting in
|
||||||
@@ -1491,11 +1416,14 @@ main() {
|
|||||||
[ "$TERM" = dumb ] ||
|
[ "$TERM" = dumb ] ||
|
||||||
[ "$TERM" = minix ] ||
|
[ "$TERM" = minix ] ||
|
||||||
[ "$TERM" = cons25 ] || {
|
[ "$TERM" = cons25 ] || {
|
||||||
# Disable line-wrapping.
|
# '[?7l': Disable line-wrapping.
|
||||||
printf '[?7l' >&6
|
# '[?25l': Hide the cursor.
|
||||||
|
printf '[?7l[?25l' >&6
|
||||||
|
|
||||||
# Enable line-wrapping again on exit.
|
# Leave the terminal how we found it on exit or Ctrl+C.
|
||||||
trap 'printf [?7h >&6' EXIT
|
# '[?7h': Enable line-wrapping.
|
||||||
|
# '[?25h': Show the cursor.
|
||||||
|
trap 'printf [?7h[?25h >&6' EXIT
|
||||||
}
|
}
|
||||||
|
|
||||||
# Store the output of 'uname' to avoid calling it multiple times
|
# Store the output of 'uname' to avoid calling it multiple times
|
||||||
|
|||||||
Reference in New Issue
Block a user