Skip to content

Commit

Permalink
[PR] dylanaraps#2196 from matt-fidd - Added for OmniOS illumos distri…
Browse files Browse the repository at this point in the history
…bution

Upstream PR: dylanaraps#2196
Thanks to @matt-fidd

Co-authored-by: matt <matt@fiddaman.net>
  • Loading branch information
hykilpikonna and matt-fidd committed Oct 4, 2022
2 parents 0f302ee + c3beb21 commit 59b9dc6
Showing 1 changed file with 49 additions and 13 deletions.
62 changes: 49 additions & 13 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,10 @@ get_os() {
# just the output of "uname -s".
case $kernel_name in
Darwin) os=$darwin_name ;;
SunOS) os=Solaris ;;
SunOS) case $(uname -o 2>/dev/null) in
illumos) os=illumos ;;
*) os=Solaris ;;
esac ;;
Haiku) os=Haiku ;;
MINIX) os=MINIX ;;
AIX) os=AIX ;;
Expand Down Expand Up @@ -1301,7 +1304,7 @@ get_distro() {
distro=${distro/Microsoft }
;;

Solaris)
Solaris|illumos)
case $distro_shorthand in
on|tiny) distro=$(awk 'NR==1 {print $1,$3}' /etc/release) ;;
*) distro=$(awk 'NR==1 {print $1,$2,$3}' /etc/release) ;;
Expand Down Expand Up @@ -1332,7 +1335,7 @@ get_distro() {

# Get OS architecture.
case $os in
Solaris|AIX|Haiku|IRIX|FreeMiNT|BSD)
Solaris|illumos|AIX|Haiku|IRIX|FreeMiNT|BSD)
machine_arch=$(uname -p)
;;

Expand Down Expand Up @@ -1577,7 +1580,7 @@ get_model() {
model=${model/Model}
;;

Solaris)
Solaris|illumos)
model=$(prtconf -b | awk -F':' '/banner-name/ {printf $2}')
;;

Expand Down Expand Up @@ -1616,7 +1619,18 @@ get_title() {
user=${USER:-$(id -un || printf %s "${HOME/*\/}")}

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%.*}
Expand Down Expand Up @@ -1681,9 +1695,11 @@ get_uptime() {
s=$((now - boot))
;;

Solaris)
s=$(kstat -p unix:0:system_misc:snaptime | awk '{print $2}')
s=${s/.*}
Solaris|illumos)
boot=$(kstat -p unix:0:system_misc:boot_time | awk '{print $2}')
now=$(date +%s)

s=$((now - boot))
;;

AIX|IRIX)
Expand Down Expand Up @@ -1783,7 +1799,7 @@ get_packages() {
}

case $os in
Linux|BSD|"iPhone OS"|Solaris)
Linux|BSD|"iPhone OS"|Solaris|illumos)
# Package Manager Programs.
has kiss && tot kiss l
has cpt-list && tot cpt-list
Expand Down Expand Up @@ -1876,6 +1892,10 @@ get_packages() {
((packages == 0)) &&
has pkg && tot pkg list
;;

illumos-*)
has pkg && tot pkg list
;;
esac

# List these last as they accompany regular package managers.
Expand Down Expand Up @@ -2729,7 +2749,7 @@ END
esac
;;

"Solaris")
"Solaris" | "illumos")
# Get CPU name.
cpu="$(psrinfo -pv)"
cpu="${cpu//*$'\n'}"
Expand Down Expand Up @@ -3161,10 +3181,10 @@ get_memory() {
esac
;;

"Solaris" | "AIX")
"Solaris" | "illumos" | "AIX")
hw_pagesize="$(pagesize)"
case $os in
"Solaris")
"Solaris" | "illumos")
pages_total="$(kstat -p unix:0:system_pages:pagestotal | awk '{print $2}')"
pages_free="$(kstat -p unix:0:system_pages:pagesfree | awk '{print $2}')"
;;
Expand Down Expand Up @@ -4504,7 +4524,7 @@ get_battery() {

get_local_ip() {
case $os in
"Linux" | "BSD" | "Solaris" | "AIX" | "IRIX")
"Linux" | "BSD" | "Solaris" | "illumos" | "AIX" | "IRIX")
if [[ "${local_ip_interface[0]}" == "auto" ]]; then
local_ip="$(ip route get 1 | awk -F'src' '{print $2; exit}')"
local_ip="${local_ip/uid*}"
Expand Down Expand Up @@ -10545,6 +10565,22 @@ Q@@@@@ggg@@f@ @@@@@@L
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")
set_colors 3 7 6 1 8
read -rd '' ascii_data <<'EOF'
Expand Down

0 comments on commit 59b9dc6

Please sign in to comment.