1 Commits
0.6.0 ... iOS

Author SHA1 Message Date
Dylan Araps
987d3b61fd pfetch: iOS support 2019-10-01 10:01:02 +03:00
2 changed files with 303 additions and 432 deletions

View File

@@ -1,43 +1,80 @@
<p align="center"><img src="https://user-images.githubusercontent.com/6799467/65944518-68834d80-e421-11e9-9b14-6ca26a16108a.png" width="350px"></p>
<h1 align="center">pfetch</h1>
<p align="center">A pretty system information tool written in POSIX sh</p><br>
# pfetch
<img src="https://user-images.githubusercontent.com/6799467/65945384-5bfff480-e423-11e9-863e-4e7cf16eb648.png" width="40%" align="right">
A pretty system information tool written in POSIX `sh`.
The goal of this project is to implement a simple system
information tool in POSIX `sh` using features built into
the language itself (*where possible*).
The goal of this project is to implement a simple system information tool in POSIX `sh` using features built into the language itself (*where possible*).
The source code is highly documented and I hope it will
act as a learning resource for POSIX `sh` and simple
information detection across various different operating
systems.
The source code is highly documented and I hope it will act as a learning resource for POSIX `sh` and simple information detection across various different operating systems.
If anything in the source code is unclear or is lacking
in its explanation, open an issue. Sometimes you get too
close to something and you fail to see the "bigger
picture"!
If anything in the source code is unclear or is lacking in its explanation, open an issue. Sometimes you get too close to something and you fail to see the "bigger picture"!
<br>
<br>
<br>
<br>
```sh
➜ pfetch
___ goldie@KISS
(| os KISS Linux
(<> | host Lenovo YOGA 900-13ISK
/ __ \ kernel 5.3.1-coffee
( / \ /| uptime 6h 20m
_/\ __)/_) pkgs 130
\/-____\/ memory 1721M / 7942M
```
## OS support
- **Linux**
- Alpine Linux, Arch Linux, Arco Linux, Artix Linux, CentOS, Debian, Elementary, Fedora, Gentoo, Guix, Hyperbola, KISS Linux, Linux Lite, Linux Mint, Mageia, Manjaro, MX Linux, NixOS, OpenSUSE, Parabola, Pop!\_OS, PureOS, Slackware, Ubuntu and Void Linux.
- All other distributions are supported with a generic penguin logo.
- **Android**
- **BSD**
- DragonflyBSD, FreeBSD, NetBSD and OpenBSD.
- **Windows**
- Windows subsystem for Linux.
- **Haiku**
- **MacOS**
- **Minix**
- **Solaris**
- **IRIX**
- **BSD**
- DragonflyBSD
- FreeBSD
- NetBSD
- OpenBSD
- **Windows**
- Windows subsystem for Linux.
- **Linux**
- Alpine Linux
- Arch Linux
- Arco Linux
- Artix Linux
- CentOS
- Debian
- Elementary
- Fedora
- Gentoo
- Guix
- Hyperbola
- KISS Linux
- Linux Lite
- Linux Mint
- Mageia
- Manjaro
- MX Linux
- NixOS
- OpenSUSE
- Parabola
- Pop!\_OS
- PureOS
- Slackware
- Ubuntu
- Void Linux
- Other distributions are supported with a generic penguin logo.
## TODO
- [ ] Add optional and additional information detection.
- [ ] Terminal Emulator ([#12](https://github.com/dylanaraps/pfetch/pull/12))
- The way I implement this in `neofetch` is interesting.
- [ ] Expand operating system support.
- [ ] Android
- [ ] iOS
- [ ] AIX ([#7](https://github.com/dylanaraps/pfetch/issues/7))
- [ ] IRIX ([#8](https://github.com/dylanaraps/pfetch/issues/8))
- [ ] FreeMiNT ([#9](https://github.com/dylanaraps/pfetch/issues/9))
- [ ] Windows ([#10](https://github.com/dylanaraps/pfetch/issues/10))
- [ ] CYGWIN
- [ ] MSYS
- [ ] MINGW
## Configuration
@@ -58,11 +95,6 @@ PF_INFO="ascii"
# Example: Only Information.
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.
# Default: unset
# Valid: string

597
pfetch
View File

@@ -83,7 +83,7 @@ log() {
printf '[3%s;1m%s' "${PF_COL1-4}" "$name"
# 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
# then move it forwards the length of the *longest* info name. This
@@ -129,9 +129,9 @@ get_os() {
case $os in
Linux*)
# Some Linux distributions (which are based on others)
# Some Linux disttributions (which are based on others)
# 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
# each and every distribution (which _is_ technically no
@@ -154,12 +154,6 @@ get_os() {
if command -v lsb_release; then
distro=$(lsb_release -sd)
# Android detection works by checking for the existence of
# the follow two directories. I don't think there's a simpler
# method than this.
elif [ -d /system/app ] && [ -d /system/priv-app ]; then
distro="Android $(getprop ro.build.version.release)"
else
# This used to be a simple '. /etc/os-release' but I believe
# this is insecure as we blindly executed whatever was in the
@@ -182,13 +176,6 @@ get_os() {
command -v crux && distro=$(crux)
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
# WSL1 (Windows subsystem for Linux [version 1]) and
# append a string accordingly.
@@ -223,19 +210,27 @@ get_os() {
# says "populate $line with the third field's contents".
while IFS='<>' read -r _ _ line _; do
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.
ProductVersion)
IFS='<>' read -r _ _ mac_version _
#
# Define a shell variable using the key's value.
ProductName|ProductVersion)
IFS='<>' read -r _ _ "${line?}" _
break
;;
esac
done < /System/Library/CoreServices/SystemVersion.plist
# 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 $mac_version in
case ${ProductName?} in
iPhone*)
distro="iOS ${ProductVersion?}"
;;
*)
# 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' ;;
@@ -251,7 +246,9 @@ get_os() {
*) distro='macOS' ;;
esac
distro="$distro $mac_version"
distro="$distro ${ProductVersion?}"
;;
esac
;;
Haiku)
@@ -286,13 +283,13 @@ get_kernel() {
case $os in
# Don't print kernel output on some systems as the
# OS name includes it.
*BSD*|Haiku|Minix)
return
;;
esac
*BSD*|Haiku|Minix) ;;
*)
# '$kernel' is the cached output of 'uname -r'.
log kernel "$kernel" >&6
;;
esac
}
get_host() {
@@ -317,7 +314,7 @@ get_host() {
machdep.dmi.system-product)
;;
*BSD*|Minix)
*BSD*)
host=$(sysctl -n hw.vendor hw.product)
;;
esac
@@ -350,9 +347,9 @@ get_host() {
# found in the "blacklist" below. Only non-matches are appended
# to the final host string.
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 |\
Version | Undefined | Default | string | INVALID | <20> | os )
Version | Undefined | Default | string | INVALID | <20> )
continue
;;
esac
@@ -404,25 +401,6 @@ get_uptime() {
$(kstat -p unix:0:system_misc:snaptime)
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
# Convert the uptime from seconds into days, hours and minutes.
@@ -464,21 +442,18 @@ get_pkgs() {
Linux*)
# Commands which print packages one per line.
has bonsai && bonsai list
has crux && pkginfo -i
has pacman-key && pacman -Qq
has dpkg && dpkg-query -f '.\n' -W
has rpm && rpm -qa
has xbps-query && xbps-query -l
has apk && apk info
has guix && guix package --list-installed
has opkg && opkg list-installed
# Directories containing packages.
has kiss && printf '%s\n' /var/db/kiss/installed/*/
has brew && printf '%s\n' "$(brew --cellar)/"*
has emerge && printf '%s\n' /var/db/pkg/*/*/
has pkgtool && printf '%s\n' /var/log/packages/*
has eopkg && printf '%s\n' /var/lib/eopkg/package/*
# 'nix' requires two commands.
has nix-store && {
@@ -490,24 +465,10 @@ get_pkgs() {
Darwin*)
# Commands which print packages one per line.
has pkgin && pkgin list
has port && port installed
# Directories containing packages.
has brew && printf '%s\n' /usr/local/Cellar/*
# 'port' prints a single line of output to 'stdout'
# when no packages are installed and exits with
# success causing a false-positive of 1 package
# installed.
#
# 'port' should really exit with a non-zero code
# in this case to allow scripts to cleanly handle
# this behavior.
has port && {
pkg_list=$(port installed)
[ "$pkg_list" = "No ports are installed." ] ||
printf '%s\n' "$pkg_list"
}
;;
FreeBSD*|DragonFly*)
@@ -534,20 +495,10 @@ get_pkgs() {
has pkginfo && pkginfo -i
has pkg && pkg list
;;
IRIX)
versions -b
;;
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
log pkgs "${packages:-?}" >&6
}
get_memory() {
@@ -590,7 +541,7 @@ get_memory() {
# split is used on '.' to filter it out.
while IFS=:. read -r key val; do
case $key in
*' wired'*|*' active'*|*' occupied'*)
*wired*|*active*|*occupied*)
mem_used=$((mem_used + ${val:-0}))
;;
esac
@@ -727,27 +678,6 @@ get_memory() {
mem_free=$((pages_free * hw_pagesize / 1024 / 1024))
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
log memory "${mem_used:-?}M / ${mem_full:-?}M" >&6
@@ -768,7 +698,7 @@ get_wm() {
# 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_
# support Wayland environments. The only solution which supports
@@ -831,50 +761,8 @@ get_wm() {
# To extract the name, everything before '_NET_WM_NAME = \"'
# is removed and everything after the next '"' is removed.
wm=$(xprop -id "$id" -notype -len 25 -f _NET_WM_NAME 8t)
# Handle cases of a window manager _not_ populating the
# '_NET_WM_NAME' atom. Display nothing in this case.
case $wm in
*'_NET_WM_NAME = '*)
wm=${wm##*_NET_WM_NAME = \"}
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 +799,12 @@ get_palette() {
#
# This allows us to save hardcoding a second set of sequences
# for background colors.
palette="$c1 $c1 $c2 $c2 $c3 $c3 $c4 $c4 $c5 $c5 $c6 $c6 "
palette=" $c1 $c2 $c3 $c4 $c5 $c6 $c7 "
# Print the palette with a new-line before and afterwards.
printf '\n' >&6
log "$palette
" " " >&6
# Print the palette with a newline before and after.
# The '\033[%sC' moves the text to the right, the
# length of the ascii art.
printf '\n[%sC%s\n' "${ascii_width-1}" "$palette" >&6
}
get_ascii() {
@@ -963,63 +851,54 @@ get_ascii() {
/${c7}/ ${c4}\\ \\
/${c7}// ${c4}\\ \\
${c7}// ${c4}\\ \\
${c4}\\
\\
EOF
;;
[Aa]ndroid*)
read_ascii 2 <<-EOF
${c2} ;, ,;
${c2} ';,.-----.,;'
${c2} ,' ',
${c2} / O O \\
${c2}| |
${c2}'-----------------'
';,.-----.,;'
,' ',
/ O O \\
| |
'-----------------'
EOF
;;
[Aa]rch*)
read_ascii 4 <<-EOF
${c6} /\\
${c6} / \\
${c6} /\\ \\
${c4} / \\
${c4} / ,, \\
${c4} / | | -\\
${c4} /_-'' ''-_\\
/^^\\
/\\ \\
/${c7} __ \\
/ ( ) \\
/ __| |__\\\\
/// \\\\\\
EOF
;;
[Aa]rco*)
read_ascii 4 <<-EOF
${c4} /\\
${c4} / \\
${c4} / /\\ \\
${c4} / / \\ \\
${c4} / / \\ \\
${c4} / / _____\\ \\
${c4}/_/ \`----.\\_\\
/ \\
/ /\\ \\
/ / \\ \\
/ / \\ \\
/ / _____\\ \\
/_/ \`----.\\_\\
EOF
;;
[Aa]rtix*)
read_ascii 6 <<-EOF
${c4} /\\
${c4} / \\
${c4} /\`'.,\\
${c4} / ',
${c4} / ,\`\\
${c4} / ,.'\`. \\
${c4}/.,'\` \`'.\\
EOF
;;
[Bb]edrock*)
read_ascii 4 <<-EOF
${c7}__
${c7}\\ \\___
${c7} \\ _ \\
${c7} \\___/
/ \\
/\`'.,\\
/ ',
/ ,\`\\
/ ,.'\`. \\
/.,'\` \`'.\\
EOF
;;
@@ -1038,11 +917,11 @@ get_ascii() {
[Dd]ebian*)
read_ascii 1 <<-EOF
${c1} _____
${c1} / __ \\
${c1}| / |
${c1}| \\___-
${c1}-_
${c1} --_
/ __ \\
| / |
| \\___-
-_
--_
EOF
;;
@@ -1053,30 +932,19 @@ get_ascii() {
>--${c1}|${c7}--<
(_-'${c1}|${c7}'-_)
${c1}|
${c1}|
${c1}|
|
|
EOF
;;
[Ee]lementary*)
read_ascii <<-EOF
${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
;;
@@ -1095,84 +963,73 @@ get_ascii() {
[Ff]ree[Bb][Ss][Dd]*)
read_ascii 1 <<-EOF
${c1}/\\,-'''''-,/\\
${c1}\\_) (_/
${c1}| |
${c1}| |
${c1}; ;
${c1}'-_____-'
${c1} /\\ _____ /\\
\\_) (_/
/ \\
| |
| |
\ /
--_____--
EOF
;;
[Gg]entoo*)
read_ascii 5 <<-EOF
${c5} _-----_
${c5}( \\
${c5}\\ 0 \\
( \\
\\ 0 \\
${c7} \\ )
${c7} / _/
${c7}( _-
${c7}\\____-
/ _/
( _-
\\____-
EOF
;;
[Gg]uix[Ss][Dd]*|[Gg]uix*)
[Gg]uix[Ss][Dd]*|guix*)
read_ascii 3 <<-EOF
${c3}|.__ __.|
${c3}|__ \\ / __|
${c3}\\ \\ / /
${c3}\\ \\ / /
${c3}\\ \\ / /
${c3}\\ \\/ /
${c3}\\__/
|__ \\ / __|
\\ \\ / /
\\ \\ / /
\\ \\ / /
\\ \\/ /
\\__/
EOF
;;
[Hh]aiku*)
read_ascii 3 <<-EOF
${c3} ,^,
${c3} / \\
${c3}*--_ ; ; _--*
${c3}\\ '" "' /
${c3}'. .'
${c3}.-'" "'-.
${c3}'-.__. .__.-'
${c3}|_|
/ \\
*--_ ; ; _--*
\\ '" "' /
'. .'
.-'" "'-.
'-.__. .__.-'
|_|
EOF
;;
[Hh]yperbola*)
read_ascii <<-EOF
${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
;;
[Ll]inux*[Ll]ite*|[Ll]ite*)
[Ll]inux*[Ll]ite*)
read_ascii 3 <<-EOF
${c3} /\\
${c3} / \\
${c3} / ${c7}/ ${c3}/
${c3}> ${c7}/ ${c3}/
${c3}\\ ${c7}\\ ${c3}\\
${c3}\\_${c7}\\${c3}_\\
/ \\
/ ${c7}/ ${c3}/
> ${c7}/ ${c3}/
\\ ${c7}\\ ${c3}\\
\\_${c7}\\${c3}_\\
${c7} \\
EOF
;;
@@ -1180,12 +1037,12 @@ get_ascii() {
[Ll]inux*[Mm]int*|[Mm]int)
read_ascii 2 <<-EOF
${c2} ___________
${c2}|_ \\
${c2}| ${c7}| _____ ${c2}|
${c2}| ${c7}| | | | ${c2}|
${c2}| ${c7}| | | | ${c2}|
${c2}| ${c7}\\__${c7}___/ ${c2}|
${c2}\\_________/
|_ \\
| ${c7}| _____ ${c2}|
| ${c7}| | | | ${c2}|
| ${c7}| | | | ${c2}|
| ${c7}\\__${c7}___/ ${c2}|
\\_________/
EOF
;;
@@ -1193,10 +1050,10 @@ get_ascii() {
[Ll]inux*)
read_ascii 4 <<-EOF
${c4} ___
${c4}(${c7}.. ${c4}|
${c4}(${c5}<> ${c4}|
${c4}/ ${c7}__ ${c4}\\
${c4}( ${c7}/ \\ ${c4}/|
(${c7}.· ${c4}|
(${c5}<> ${c4}|
/ ${c7}__ ${c4}\\
( ${c7}/ \\ ${c4}/|
${c5}_${c4}/\\ ${c7}__)${c4}/${c5}_${c4})
${c5}\/${c4}-____${c5}\/
EOF
@@ -1205,9 +1062,9 @@ get_ascii() {
[Mm]ac[Oo][Ss]*|[Dd]arwin*)
read_ascii 1 <<-EOF
${c1} .:'
${c1} _ :'_
_ :'_
${c2} .'\`_\`-'_\`\`.
${c2}:________.-'
:________.-'
${c3}:_______:
${c4} :_______\`-;
${c5} \`._.-._.'
@@ -1217,49 +1074,49 @@ get_ascii() {
[Mm]ageia*)
read_ascii 2 <<-EOF
${c6} *
${c6} *
${c6} **
*
**
${c7} /\\__/\\
${c7}/ \\
${c7}\\ /
${c7} \\____/
/ \\
\\ /
\\____/
EOF
;;
[Mm]anjaro*)
read_ascii 2 <<-EOF
${c2}||||||||| ||||
${c2}||||||||| ||||
${c2}|||| ||||
${c2}|||| |||| ||||
${c2}|||| |||| ||||
${c2}|||| |||| ||||
${c2}|||| |||| ||||
||||||||| ||||
|||| ||||
|||| |||| ||||
|||| |||| ||||
|||| |||| ||||
|||| |||| ||||
EOF
;;
[Mm]inix*)
read_ascii 4 <<-EOF
${c4} ,, ,,
${c4};${c7},${c4} ', ,' ${c7},${c4};
${c4}; ${c7}',${c4} ',,' ${c7},'${c4} ;
${c4}; ${c7}',${c4} ${c7},'${c4} ;
${c4}; ${c7};, '' ,;${c4} ;
${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} ;
; ${c7}',${c4} ${c7},'${c4} ;
; ${c7};, '' ,;${c4} ;
; ${c7};${c4};${c7}',,'${c4};${c7};${c4} ;
', ${c7};${c4};; ;;${c7};${c4} ,'
'${c7};${c4}' '${c7};${c4}'
EOF
;;
[Mm][Xx]*)
read_ascii <<-EOF
${c7} \\\\ /
${c7} \\\\/
${c7} \\\\
${c7} /\\/ \\\\
${c7} / \\ /\\
${c7} / \\/ \\
${c7}/__________\\
\\\\/
\\\\
/\\/ \\\\
/ \\ /\\
/ \\/ \\
/__________\\
EOF
;;
@@ -1270,137 +1127,124 @@ get_ascii() {
${c7} \\\\ ${c3}\`.____
${c7} \\\\${c3}-______,----\`-
${c7} \\\\
${c7} \\\\
${c7} \\\\
\\\\
\\\\
EOF
;;
[Nn]ix[Oo][Ss]*)
read_ascii 4 <<-EOF
${c4} \\\\ \\\\ //
${c4} ==\\\\__\\\\/ //
${c4} // \\\\//
${c4}==// //==
${c4} //\\\\___//
${c4}// /\\\\ \\\\==
${c4} // \\\\ \\\\
==\\\\__\\\\/ //
// \\\\//
==// //==
//\\\\___//
// /\\\\ \\\\==
// \\\\ \\\\
EOF
;;
[Oo]pen[Bb][Ss][Dd]*)
read_ascii 3 <<-EOF
${c3} _____
${c3} \\- -/
${c3} \\_/ \\
${c3} | ${c7}O O${c3} |
${c3} |_ < ) 3 )
${c3} / \\ /
${c3} /-_____-\\
\\- -/
\\_/ \\
| ${c7}O O${c3} |
|_ < ) 3 )
/ \\ /
/-_____-\\
EOF
;;
[Oo]pen[Ss][Uu][Ss][Ee]*|[Oo]pen*SUSE*|SUSE*|suse*)
openSUSE*|open*SUSE*|SUSE*|suse*)
read_ascii 2 <<-EOF
${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
;;
[Pp]arabola*)
read_ascii 5 <<-EOF
${c5} __ __ __ _
${c5}.\`_//_//_/ / \`.
${c5} / .\`
${c5} / .\`
${c5} /.\`
${c5} /\`
.\`_//_//_/ / \`.
/ .\`
/ .\`
/.\`
/\`
EOF
;;
[Pp]op!_[Oo][Ss]*)
read_ascii 6 <<-EOF
${c6}______
${c6}\\ _ \\ __
${c6}\\ \\ \\ \\ / /
${c6}\\ \\_\\ \\ / /
${c6}\\ ___\\ /_/
${c6} \\ \\ _
${c6} __\\_\\__(_)_
${c6}(___________)
\\ _ \\ __
\\ \\ \\ \\ / /
\\ \\_\\ \\ / /
\\ ___\\ /_/
\\ \\ _
__\\_\\__(_)_
(___________)
EOF
;;
[Pp]ure[Oo][Ss]*)
read_ascii <<-EOF
${c7} _____________
${c7}| _________ |
${c7}| | | |
${c7}| | | |
${c7}| |_________| |
${c7}|_____________|
| _________ |
| | | |
| | | |
| |_________| |
|_____________|
EOF
;;
[Ss]lackware*)
read_ascii 4 <<-EOF
${c4} ________
${c4} / ______|
${c4} | |______
${c4} \\______ \\
${c4} ______| |
${c4}| |________/
${c4}|____________
/ ______|
| |______
\\______ \\
______| |
| |________/
|____________
EOF
;;
[Ss]un[Oo][Ss]|[Ss]olaris*)
[Ss]un[Oo][Ss])
read_ascii 3 <<-EOF
${c3} . .; .
${c3} . :; :: ;: .
${c3} .;. .. .. .;.
${c3}.. .. .. ..
${c3} .;, ,;.
. :; :: ;: .
.;. .. .. .;.
.. .. .. ..
.;, ,;.
EOF
;;
[Uu]buntu*)
read_ascii 3 <<-EOF
${c3} _
${c3} ---(_)
${c3} _/ --- \\
${c3}(_) | |
${c3} \\ --- _/
${c3} ---(_)
---(_)
_/ --- \\
(_) | |
\\ --- _/
---(_)
EOF
;;
[Vv]oid*)
read_ascii 2 <<-EOF
${c2} _______
${c2} _ \\______ -
${c2}| \\ ___ \\ |
${c2}| | / \ | |
${c2}| | \___/ | |
${c2}| \\______ \\_|
${c2} -_______\\
_ \\______ -
| \\ ___ \\ |
| | / \ | |
| | \___/ | |
| \\______ \\_|
-_______\\
EOF
;;
@@ -1463,16 +1307,6 @@ main() {
# This gives full control over what it displayed on the screen.
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
# fail without the write permission. This was found to be the
# case on Android where the temporary directory requires root.
[ -w "${TMPDIR:-/tmp}" ] || export TMPDIR=~
# Generic color list.
# Disable warning about unused variables.
# shellcheck disable=2034
@@ -1483,7 +1317,9 @@ main() {
c7=''; c8=''
}
# 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
# silently conceal them if they're printed resulting in
@@ -1491,11 +1327,14 @@ main() {
[ "$TERM" = dumb ] ||
[ "$TERM" = minix ] ||
[ "$TERM" = cons25 ] || {
# Disable line-wrapping.
printf '[?7l' >&6
# '[?7l': Disable line-wrapping.
# '[?25l': Hide the cursor.
printf '[?7l[?25l' >&6
# Enable line-wrapping again on exit.
trap 'printf [?7h >&6' EXIT
# Leave the terminal how we found it on exit or Ctrl+C.
# '[?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
@@ -1543,7 +1382,7 @@ main() {
# N lines.
#
# This was a ternary operation but they aren't supported in Minix's shell.
[ "${info_height:-0}" -lt "${ascii_height:-0}" ] &&
[ "$info_height" -lt "$ascii_height" ] &&
cursor_pos=$((ascii_height - info_height))
# Print '$cursor_pos' amount of newlines to correctly position the