[PR] dylanaraps/neofetch#2196 from matt-fidd - Added for OmniOS illumos distribution

Upstream PR: https://github.com/dylanaraps/neofetch/pull/2196
Thanks to @matt-fidd

Co-authored-by: matt <matt@fiddaman.net>
This commit is contained in:
Azalea (on HyDEV-Daisy) 2022-10-04 12:31:15 -04:00
commit 59b9dc6e1a
No known key found for this signature in database
GPG key ID: E289FAC0DA92DD2B

View file

@ -954,7 +954,10 @@ get_os() {
# just the output of "uname -s". # just the output of "uname -s".
case $kernel_name in case $kernel_name in
Darwin) os=$darwin_name ;; Darwin) os=$darwin_name ;;
SunOS) os=Solaris ;; SunOS) case $(uname -o 2>/dev/null) in
illumos) os=illumos ;;
*) os=Solaris ;;
esac ;;
Haiku) os=Haiku ;; Haiku) os=Haiku ;;
MINIX) os=MINIX ;; MINIX) os=MINIX ;;
AIX) os=AIX ;; AIX) os=AIX ;;
@ -1301,7 +1304,7 @@ get_distro() {
distro=${distro/Microsoft } distro=${distro/Microsoft }
;; ;;
Solaris) Solaris|illumos)
case $distro_shorthand in case $distro_shorthand in
on|tiny) distro=$(awk 'NR==1 {print $1,$3}' /etc/release) ;; on|tiny) distro=$(awk 'NR==1 {print $1,$3}' /etc/release) ;;
*) distro=$(awk 'NR==1 {print $1,$2,$3}' /etc/release) ;; *) distro=$(awk 'NR==1 {print $1,$2,$3}' /etc/release) ;;
@ -1332,7 +1335,7 @@ get_distro() {
# Get OS architecture. # Get OS architecture.
case $os in case $os in
Solaris|AIX|Haiku|IRIX|FreeMiNT|BSD) Solaris|illumos|AIX|Haiku|IRIX|FreeMiNT|BSD)
machine_arch=$(uname -p) machine_arch=$(uname -p)
;; ;;
@ -1577,7 +1580,7 @@ get_model() {
model=${model/Model} model=${model/Model}
;; ;;
Solaris) Solaris|illumos)
model=$(prtconf -b | awk -F':' '/banner-name/ {printf $2}') model=$(prtconf -b | awk -F':' '/banner-name/ {printf $2}')
;; ;;
@ -1616,7 +1619,18 @@ get_title() {
user=${USER:-$(id -un || printf %s "${HOME/*\/}")} user=${USER:-$(id -un || printf %s "${HOME/*\/}")}
case $title_fqdn in case $title_fqdn in
on) hostname=$(hostname -f) ;; on)
case $os in
illumos|Solaris)
hostname=$(hostname)
domainname=$(domainname)
[[ -n "$domainname" ]] && hostname+=".$domainname"
;;
*)
hostname=$(hostname -f)
;;
esac
;;
*) *)
hostname=${HOSTNAME:-$(hostname)} hostname=${HOSTNAME:-$(hostname)}
hostname=${hostname%.*} hostname=${hostname%.*}
@ -1681,9 +1695,11 @@ get_uptime() {
s=$((now - boot)) s=$((now - boot))
;; ;;
Solaris) Solaris|illumos)
s=$(kstat -p unix:0:system_misc:snaptime | awk '{print $2}') boot=$(kstat -p unix:0:system_misc:boot_time | awk '{print $2}')
s=${s/.*} now=$(date +%s)
s=$((now - boot))
;; ;;
AIX|IRIX) AIX|IRIX)
@ -1783,7 +1799,7 @@ get_packages() {
} }
case $os in case $os in
Linux|BSD|"iPhone OS"|Solaris) Linux|BSD|"iPhone OS"|Solaris|illumos)
# Package Manager Programs. # Package Manager Programs.
has kiss && tot kiss l has kiss && tot kiss l
has cpt-list && tot cpt-list has cpt-list && tot cpt-list
@ -1876,6 +1892,10 @@ get_packages() {
((packages == 0)) && ((packages == 0)) &&
has pkg && tot pkg list has pkg && tot pkg list
;; ;;
illumos-*)
has pkg && tot pkg list
;;
esac esac
# List these last as they accompany regular package managers. # List these last as they accompany regular package managers.
@ -2729,7 +2749,7 @@ END
esac esac
;; ;;
"Solaris") "Solaris" | "illumos")
# Get CPU name. # Get CPU name.
cpu="$(psrinfo -pv)" cpu="$(psrinfo -pv)"
cpu="${cpu//*$'\n'}" cpu="${cpu//*$'\n'}"
@ -3161,10 +3181,10 @@ get_memory() {
esac esac
;; ;;
"Solaris" | "AIX") "Solaris" | "illumos" | "AIX")
hw_pagesize="$(pagesize)" hw_pagesize="$(pagesize)"
case $os in case $os in
"Solaris") "Solaris" | "illumos")
pages_total="$(kstat -p unix:0:system_pages:pagestotal | awk '{print $2}')" pages_total="$(kstat -p unix:0:system_pages:pagestotal | awk '{print $2}')"
pages_free="$(kstat -p unix:0:system_pages:pagesfree | awk '{print $2}')" pages_free="$(kstat -p unix:0:system_pages:pagesfree | awk '{print $2}')"
;; ;;
@ -4504,7 +4524,7 @@ get_battery() {
get_local_ip() { get_local_ip() {
case $os in case $os in
"Linux" | "BSD" | "Solaris" | "AIX" | "IRIX") "Linux" | "BSD" | "Solaris" | "illumos" | "AIX" | "IRIX")
if [[ "${local_ip_interface[0]}" == "auto" ]]; then if [[ "${local_ip_interface[0]}" == "auto" ]]; then
local_ip="$(ip route get 1 | awk -F'src' '{print $2; exit}')" local_ip="$(ip route get 1 | awk -F'src' '{print $2; exit}')"
local_ip="${local_ip/uid*}" local_ip="${local_ip/uid*}"
@ -10545,6 +10565,22 @@ Q@@@@@ggg@@f@ @@@@@@L
EOF EOF
;; ;;
"OmniOS"*)
set_colors 15 3 8
read -rd '' ascii_data <<'EOF'
${c1}
____ __ __ _ _ _
/ __ \ | \/ || \ | || |
| | | || || \| || |
| |__| || |\/| || , `${c2}_${c1}||${c2}_${c1}| ${c2}____${c1}
\____/ |_| |_||_|\${c2}/ __ \ / ___|
| | | ||(__
${c3}community${c2} | |__| | ___)|
${c3}edition${c2} \____/ |____/
EOF
;;
"openbsd_small") "openbsd_small")
set_colors 3 7 6 1 8 set_colors 3 7 6 1 8
read -rd '' ascii_data <<'EOF' read -rd '' ascii_data <<'EOF'