79 Commits
iOS ... 0.6.0

Author SHA1 Message Date
Dylan Araps
675814f33e pfetch: Revert to larger but more reliable print method. Closes #46 2020-03-11 22:39:16 +02:00
Dylan Araps
2ef3584f5b various: Once again hide kernel. Related to #46 2020-03-11 22:25:02 +02:00
Dylan Araps
aa22d4e32d pfetch: bold ascii 2020-03-10 12:27:37 +02:00
Dylan Araps
c0d0d65aa0 pfetch: Fix blank lines 2020-03-10 12:26:29 +02:00
Dylan Araps
a8a3e1f2fe docs: update 2020-03-10 00:08:47 +02:00
dylan
8633671f99 Merge pull request #45 from dylanaraps/irix
pfetch: Initial IRIX support.
2020-03-10 00:07:03 +02:00
Dylan Araps
577e8483a7 irix: ASCII 2020-03-10 00:06:06 +02:00
Dylan Araps
6558b34254 irix: kernel information 2020-03-09 23:41:13 +02:00
Dylan Araps
542b6af284 Merge branch 'master' into irix 2020-03-09 23:26:41 +02:00
Dylan Araps
177d77c335 irix: Fix support 2020-03-09 23:25:30 +02:00
Dylan Araps
e2068c61d5 IRIX: Packages support 2020-03-09 23:07:42 +02:00
Dylan Araps
39f767e45b irix: Uptime support. 2020-03-09 22:57:10 +02:00
Dylan Araps
b2aac93208 irix: Memory usage 2020-03-09 22:48:23 +02:00
Dylan Araps
271458be6e pfetch: Fixed posix change 2020-03-09 15:24:49 +02:00
Dylan Araps
9fc34b0000 pfetch: Revert prior change 2020-03-09 15:18:50 +02:00
Dylan Araps
3bb449700c pfetch: posix 2020-03-09 14:50:06 +02:00
Dylan Araps
f82f5e9d2d pfetch: Remove non-posix dot 2020-03-09 13:59:58 +02:00
Dylan Araps
be111026b1 ascii: Remove blank line 2020-03-09 12:30:11 +02:00
Dylan Araps
4cfef9c1e4 pfetch: Initial IRIX support. 2020-03-09 12:27:53 +02:00
Dylan Araps
c1cecae824 pfetch: Minix host information 2020-03-09 08:29:35 +02:00
Dylan Araps
f5b527d852 docs: update 2020-03-07 17:52:25 +02:00
dylan
2bf774e70f Merge pull request #44 from paradigm/master
pfetch: Add support for Bedrock
2020-03-07 17:50:55 +02:00
Daniel Thau
25324687b5 pfetch: Add support for Bedrock
Bedrock mimics other distros.  Part of doing so involves having distro
identifiers such as /etc/os-release look like those from other distros.
It must thus be special cased to be detected properly.

Bedrock typically includes /bedrock/cross/* entries in its $PATH.
However, they may be dropped as a hint to Bedrock-aware software that
they should act as though they were not Bedrock aware.  The $PATH check
is thus used to have pfetch conditionally disable the Bedrock special
casing even on Bedrock systems.

pfetch package count detection fails to consider repeated instances of a
given package manager.  Correcting this for the Bedrock specific concern
is purposefully eschewed for the sake of simplicity.  It may be
revisited later once Bedrock's Package Manager Manager ("pmm") feature
stabilizes.
2020-03-07 10:01:50 -05:00
Dylan Araps
f15a8d25dd docs: update 2020-03-07 14:48:17 +02:00
Dylan Araps
361a46df60 docs: update 2020-03-07 14:41:33 +02:00
Dylan Araps
9f55ffb5aa ascii: Fix format 2020-01-26 22:44:05 +02:00
Dylan Araps
364223cb48 ascii: Fix format 2020-01-26 22:38:04 +02:00
Dylan Araps
7094147013 ascii: Fix format 2020-01-26 22:33:51 +02:00
Dylan Araps
8d1b579b39 docs: update 2020-01-26 22:26:35 +02:00
Dylan Araps
32743859da pfetch: misc 2020-01-26 22:24:34 +02:00
Dylan Araps
c36607909b pfetch: OpenWrt support. Closes #37 2020-01-26 22:17:23 +02:00
Dylan Araps
a7b0439aeb pfetch: Added PF_SOURCE. Closes #34 2020-01-26 22:08:57 +02:00
dylan
0dcc4d6a82 Merge pull request #35 from dylanaraps/sync
pfetch: print without cursor movement
2020-01-26 22:05:58 +02:00
Dylan Araps
67204770ac pfetch: Add support for Endeavour 2020-01-03 09:48:20 +02:00
Dylan Araps
4524a3cc0a pkgs: support for solus 2019-11-18 15:56:21 +00:00
Dylan Araps
4f7617208d pkgs: openwrt support 2019-11-10 10:39:18 +00:00
Dylan Araps
8dd5981fbc pfetch: remove cursor movement for palette 2019-11-09 16:44:28 +00:00
Dylan Araps
24498852fd pfetch: minor fixes 2019-11-03 01:42:45 +00:00
Dylan Araps
a1bbe9749c pfetch: fix bugs 2019-11-03 00:45:53 +00:00
Dylan Araps
c9b4d26084 pfetch: print without cursor movement 2019-11-03 00:43:07 +00:00
Dylan Araps
1045166df2 wm: Add fallback to non-EWMH WMs 2019-10-20 00:00:02 +03:00
Dylan Araps
5893e26575 docs: update 2019-10-18 21:10:15 +03:00
Dylan Araps
14261f0fa1 docs: update 2019-10-18 21:07:45 +03:00
Dylan Araps
40d78a9b26 pfetch: revert sed removal 2019-10-18 21:07:08 +03:00
Dylan Araps
729f553d87 pfetch: Fix incorrect host output. Closes #29 2019-10-15 10:55:45 +03:00
Dylan Araps
6c3d5c3a87 pfetch: Fix android sed 2019-10-14 09:53:12 +03:00
Dylan Araps
616e1b0c3b pfetch: fix android issues 2019-10-14 09:04:15 +03:00
Dylan Araps
44dca45301 Merge branch 'master' of github.com:dylanaraps/pfetch 2019-10-14 08:45:25 +03:00
Dylan Araps
256c1678d6 pfetch: fix package count. 2019-10-14 08:45:07 +03:00
dylan
a3bdc11167 Merge pull request #26 from turquoise-hexagon/master
pfetch: crux pkgs count support
2019-10-06 12:56:26 +03:00
turquoise-hexagon
2bc0fd87a5 add support for crux pkgs count 2019-10-06 11:21:59 +02:00
Dylan Araps
8b9c409650 macOS: fix memory issue 2019-10-03 21:06:51 +03:00
Dylan Araps
52617b2e6e arch: new logo 2019-10-03 18:34:32 +03:00
Dylan Araps
77dce6a678 freebsd: better ascii 2019-10-03 13:59:36 +03:00
Dylan Araps
812f9ef231 docs: update 2019-10-03 12:30:25 +03:00
Dylan Araps
87effdbc5a host: add another dummy word 2019-10-03 12:29:31 +03:00
Dylan Araps
3f5845e20c pfetch: android support 2019-10-03 10:18:34 +03:00
Dylan Araps
c94e2c5d9d wm: handle non-matches 2019-10-02 15:36:09 +03:00
Dylan Araps
d8d8899ad2 macOS: Fix port false positive 2019-10-01 23:24:26 +03:00
Dylan Araps
1ff17055b9 pfetch: fix bug 2019-10-01 15:09:43 +03:00
Dylan Araps
d1d3b7b740 pfetch: fix bug 2019-10-01 15:07:50 +03:00
Dylan Araps
9564246e6c pfetch: fix bug 2019-10-01 15:06:37 +03:00
Dylan Araps
08d9834854 pfetch: fix bug 2019-10-01 15:05:42 +03:00
Dylan Araps
b7c7bc6c4c pfetch: fix bug 2019-10-01 15:03:56 +03:00
Dylan Araps
11d1c2e789 docs: update 2019-10-01 11:19:52 +03:00
Dylan Araps
55408239db docs: update 2019-10-01 11:19:32 +03:00
Dylan Araps
35ae795068 docs: update 2019-10-01 11:18:59 +03:00
Dylan Araps
e1228975fd docs: update 2019-10-01 11:17:57 +03:00
Dylan Araps
4d1be75c20 docs: update 2019-10-01 11:13:45 +03:00
Dylan Araps
8d1ab2d0dd docs: update 2019-10-01 11:13:13 +03:00
Dylan Araps
301c52dd5f docs: update 2019-10-01 11:12:55 +03:00
Dylan Araps
0d1a340ef2 docs: update 2019-10-01 11:12:16 +03:00
Dylan Araps
49a3db1653 docs: update 2019-10-01 11:03:39 +03:00
Dylan Araps
d828d1e718 docs: update 2019-10-01 11:02:48 +03:00
Dylan Araps
9963de75d5 docs: update 2019-10-01 11:02:31 +03:00
Dylan Araps
3e58031fe0 docs: update 2019-10-01 11:01:38 +03:00
Dylan Araps
405fc20eef docs: update 2019-10-01 11:00:58 +03:00
Dylan Araps
133d63137c docs: update 2019-10-01 11:00:01 +03:00
Dylan Araps
3686c06238 docs: update 2019-10-01 10:59:35 +03:00
2 changed files with 410 additions and 271 deletions

View File

@@ -1,80 +1,43 @@
# pfetch <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>
A pretty system information tool written in POSIX `sh`. <img src="https://user-images.githubusercontent.com/6799467/65945384-5bfff480-e423-11e9-863e-4e7cf16eb648.png" width="40%" align="right">
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"!
```sh <br>
➜ pfetch <br>
___ goldie@KISS <br>
(| os KISS Linux <br>
(<> | host Lenovo YOGA 900-13ISK
/ __ \ kernel 5.3.1-coffee
( / \ /| uptime 6h 20m
_/\ __)/_) pkgs 130
\/-____\/ memory 1721M / 7942M
```
## OS support ## 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** - **Haiku**
- **MacOS** - **MacOS**
- **Minix** - **Minix**
- **Solaris** - **Solaris**
- **BSD** - **IRIX**
- 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 ## Configuration
@@ -95,6 +58,11 @@ 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

573
pfetch
View File

@@ -83,7 +83,7 @@ log() {
printf '[3%s;1m%s' "${PF_COL1-4}" "$name" printf '[3%s;1m%s' "${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
@@ -129,9 +129,9 @@ get_os() {
case $os in case $os in
Linux*) Linux*)
# Some Linux disttributions (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
# distributions identification packages or files. # distribution's 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
@@ -154,6 +154,12 @@ get_os() {
if command -v lsb_release; then if command -v lsb_release; then
distro=$(lsb_release -sd) 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 else
# This used to be a simple '. /etc/os-release' but I believe # This used to be a simple '. /etc/os-release' but I believe
# this is insecure as we blindly executed whatever was in the # this is insecure as we blindly executed whatever was in the
@@ -176,6 +182,13 @@ 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.
@@ -273,13 +286,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
*)
# '$kernel' is the cached output of 'uname -r'.
log kernel "$kernel" >&6
;; ;;
esac esac
# '$kernel' is the cached output of 'uname -r'.
log kernel "$kernel" >&6
} }
get_host() { get_host() {
@@ -304,7 +317,7 @@ get_host() {
machdep.dmi.system-product) machdep.dmi.system-product)
;; ;;
*BSD*) *BSD*|Minix)
host=$(sysctl -n hw.vendor hw.product) host=$(sysctl -n hw.vendor hw.product)
;; ;;
esac esac
@@ -337,9 +350,9 @@ 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 | by | O.E.M. | OEM |\ To | [Bb]e | [Ff]illed | [Bb]y | O.E.M. | OEM |\
Not | Applicable | Specified | System | Product | Name |\ Not | Applicable | Specified | System | Product | Name |\
Version | Undefined | Default | string | INVALID | <20> ) Version | Undefined | Default | string | INVALID | <20> | os )
continue continue
;; ;;
esac esac
@@ -391,6 +404,25 @@ 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.
@@ -432,18 +464,21 @@ get_pkgs() {
Linux*) Linux*)
# Commands which print packages one per line. # Commands which print packages one per line.
has bonsai && bonsai list has bonsai && bonsai list
has crux && pkginfo -i
has pacman-key && pacman -Qq has pacman-key && pacman -Qq
has dpkg && dpkg-query -f '.\n' -W has dpkg && dpkg-query -f '.\n' -W
has rpm && rpm -qa has rpm && rpm -qa
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 && {
@@ -455,10 +490,24 @@ get_pkgs() {
Darwin*) Darwin*)
# Commands which print packages one per line. # Commands which print packages one per line.
has pkgin && pkgin list has pkgin && pkgin list
has port && port installed
# Directories containing packages. # Directories containing packages.
has brew && printf '%s\n' /usr/local/Cellar/* 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*) FreeBSD*|DragonFly*)
@@ -485,10 +534,20 @@ 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
` `
log pkgs "${packages:-?}" >&6 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
} }
get_memory() { get_memory() {
@@ -531,7 +590,7 @@ get_memory() {
# split is used on '.' to filter it out. # split is used on '.' to filter it out.
while IFS=:. read -r key val; do while IFS=:. read -r key val; do
case $key in case $key in
*wired*|*active*|*occupied*) *' wired'*|*' active'*|*' occupied'*)
mem_used=$((mem_used + ${val:-0})) mem_used=$((mem_used + ${val:-0}))
;; ;;
esac esac
@@ -668,6 +727,27 @@ 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
@@ -688,7 +768,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 and monster. # catwm, fvwm, dwm, 2bwm, monster, wmaker and sowm [mine! ;)].
# #
# 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
@@ -751,8 +831,50 @@ get_wm() {
# To extract the name, everything before '_NET_WM_NAME = \"' # To extract the name, everything before '_NET_WM_NAME = \"'
# is removed and everything after the next '"' is removed. # is removed and everything after the next '"' is removed.
wm=$(xprop -id "$id" -notype -len 25 -f _NET_WM_NAME 8t) 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##*_NET_WM_NAME = \"}
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 esac
@@ -789,12 +911,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=" $c1 $c2 $c3 $c4 $c5 $c6 $c7 " palette="$c1 $c1 $c2 $c2 $c3 $c3 $c4 $c4 $c5 $c5 $c6 $c6 "
# Print the palette with a newline before and after. # Print the palette with a new-line before and afterwards.
# The '\033[%sC' moves the text to the right, the printf '\n' >&6
# length of the ascii art. log "$palette
printf '\n[%sC%s\n' "${ascii_width-1}" "$palette" >&6 " " " >&6
} }
get_ascii() { get_ascii() {
@@ -841,54 +963,63 @@ 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} ,' ',
/ O O \\ ${c2} / O O \\
| | ${c2}| |
'-----------------' ${c2}'-----------------'
EOF EOF
;; ;;
[Aa]rch*) [Aa]rch*)
read_ascii 4 <<-EOF read_ascii 4 <<-EOF
${c6} /\\ ${c6} /\\
/^^\\ ${c6} / \\
/\\ \\ ${c6} /\\ \\
/${c7} __ \\ ${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
;; ;;
@@ -907,11 +1038,11 @@ get_ascii() {
[Dd]ebian*) [Dd]ebian*)
read_ascii 1 <<-EOF read_ascii 1 <<-EOF
${c1} _____ ${c1} _____
/ __ \\ ${c1} / __ \\
| / | ${c1}| / |
| \\___- ${c1}| \\___-
-_ ${c1}-_
--_ ${c1} --_
EOF EOF
;; ;;
@@ -922,19 +1053,30 @@ 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
;; ;;
@@ -953,73 +1095,84 @@ 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}( \\
\\ 0 \\ ${c5}\\ 0 \\
${c7} \\ ) ${c7} \\ )
/ _/ ${c7} / _/
( _- ${c7}( _-
\\____- ${c7}\\____-
EOF EOF
;; ;;
[Gg]uix[Ss][Dd]*|guix*) [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 EOF
;; ;;
[Ll]inux*[Ll]ite*) [Ii][Rr][Ii][Xx]*)
read_ascii 1 <<-EOF
${c1} __
${c1} \\ \\ __
${c1} \\ \\ / /
${c1} \\ v /
${c1} / . \\
${c1} /_/ \\ \\
${c1} \\_\\
EOF
;;
[Ll]inux*[Ll]ite*|[Ll]ite*)
read_ascii 3 <<-EOF read_ascii 3 <<-EOF
${c3} /\\ ${c3} /\\
/ \\ ${c3} / \\
/ ${c7}/ ${c3}/ ${c3} / ${c7}/ ${c3}/
> ${c7}/ ${c3}/ ${c3}> ${c7}/ ${c3}/
\\ ${c7}\\ ${c3}\\ ${c3}\\ ${c7}\\ ${c3}\\
\\_${c7}\\${c3}_\\ ${c3}\\_${c7}\\${c3}_\\
${c7} \\ ${c7} \\
EOF EOF
;; ;;
@@ -1027,12 +1180,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}|_ \\
| ${c7}| _____ ${c2}| ${c2}| ${c7}| _____ ${c2}|
| ${c7}| | | | ${c2}| ${c2}| ${c7}| | | | ${c2}|
| ${c7}| | | | ${c2}| ${c2}| ${c7}| | | | ${c2}|
| ${c7}\\__${c7}___/ ${c2}| ${c2}| ${c7}\\__${c7}___/ ${c2}|
\\_________/ ${c2}\\_________/
EOF EOF
;; ;;
@@ -1040,10 +1193,10 @@ get_ascii() {
[Ll]inux*) [Ll]inux*)
read_ascii 4 <<-EOF read_ascii 4 <<-EOF
${c4} ___ ${c4} ___
(${c7}.· ${c4}| ${c4}(${c7}.. ${c4}|
(${c5}<> ${c4}| ${c4}(${c5}<> ${c4}|
/ ${c7}__ ${c4}\\ ${c4}/ ${c7}__ ${c4}\\
( ${c7}/ \\ ${c4}/| ${c4}( ${c7}/ \\ ${c4}/|
${c5}_${c4}/\\ ${c7}__)${c4}/${c5}_${c4}) ${c5}_${c4}/\\ ${c7}__)${c4}/${c5}_${c4})
${c5}\/${c4}-____${c5}\/ ${c5}\/${c4}-____${c5}\/
EOF EOF
@@ -1052,9 +1205,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} \`._.-._.'
@@ -1064,49 +1217,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} ,, ,,
;${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} ;
; ${c7};, '' ,;${c4} ; ${c4}; ${c7};, '' ,;${c4} ;
; ${c7};${c4};${c7}',,'${c4};${c7};${c4} ; ${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}'
EOF EOF
;; ;;
[Mm][Xx]*) [Mm][Xx]*)
read_ascii <<-EOF read_ascii <<-EOF
${c7} \\\\ / ${c7} \\\\ /
\\\\/ ${c7} \\\\/
\\\\ ${c7} \\\\
/\\/ \\\\ ${c7} /\\/ \\\\
/ \\ /\\ ${c7} / \\ /\\
/ \\/ \\ ${c7} / \\/ \\
/__________\\ ${c7}/__________\\
EOF EOF
;; ;;
@@ -1117,124 +1270,137 @@ 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} \\_/ \\
| ${c7}O O${c3} | ${c3} | ${c7}O O${c3} |
|_ < ) 3 ) ${c3} |_ < ) 3 )
/ \\ / ${c3} / \\ /
/-_____-\\ ${c3} /-_____-\\
EOF EOF
;; ;;
openSUSE*|open*SUSE*|SUSE*|suse*) [Oo]pen[Ss][Uu][Ss][Ee]*|[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]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
;; ;;
@@ -1297,6 +1463,16 @@ 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
# 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. # Generic color list.
# Disable warning about unused variables. # Disable warning about unused variables.
# shellcheck disable=2034 # shellcheck disable=2034
@@ -1307,9 +1483,7 @@ main() {
c7=''; c8='' 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 # 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
@@ -1317,14 +1491,11 @@ main() {
[ "$TERM" = dumb ] || [ "$TERM" = dumb ] ||
[ "$TERM" = minix ] || [ "$TERM" = minix ] ||
[ "$TERM" = cons25 ] || { [ "$TERM" = cons25 ] || {
# '[?7l': Disable line-wrapping. # Disable line-wrapping.
# '[?25l': Hide the cursor. printf '[?7l' >&6
printf '[?7l[?25l' >&6
# Leave the terminal how we found it on exit or Ctrl+C. # Enable line-wrapping again on exit.
# '[?7h': Enable line-wrapping. trap 'printf [?7h >&6' EXIT
# '[?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
@@ -1372,7 +1543,7 @@ main() {
# N lines. # N lines.
# #
# This was a ternary operation but they aren't supported in Minix's shell. # This was a ternary operation but they aren't supported in Minix's shell.
[ "$info_height" -lt "$ascii_height" ] && [ "${info_height:-0}" -lt "${ascii_height:-0}" ] &&
cursor_pos=$((ascii_height - info_height)) cursor_pos=$((ascii_height - info_height))
# Print '$cursor_pos' amount of newlines to correctly position the # Print '$cursor_pos' amount of newlines to correctly position the