Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Added for OmniOS illumos distribution #2196

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 44 additions & 14 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,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 @@ -1187,7 +1190,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 @@ -1218,7 +1221,7 @@ get_distro() {

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

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

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

Expand Down Expand Up @@ -1382,8 +1385,13 @@ get_model() {
get_title() {
user=${USER:-$(id -un || printf %s "${HOME/*\/}")}

case $title_fqdn in
on) hostname=$(hostname -f) ;;
case $os-$title_fqdn in
illumos-on|Solaris-on)
hostname=$(hostname)
domainname=$(domainname)
[[ -n "$domainname" ]] && hostname+=".$domainname"
;;
*-on) hostname=$(hostname -f) ;;
*) hostname=${HOSTNAME:-$(hostname)} ;;
esac
Comment on lines -1385 to 1396

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should change this to two case statements. I think it would make the logic clearer.

case $title_fqdn in
    on)
        case $os in
            illumos|Solaris)
                hostname=$(hostname)
                domainname=$(domainname)
                [[ -n "$domainname" ]] && hostname+=".$domainname"
            ;;
            *)
                hostname=$(hostname -f) 
            ;;
        esac
    ;;
    *)
        hostname=${HOSTNAME:-$(hostname)}
        hostname=${hostname%.*}
    ;;
esac


Expand Down Expand Up @@ -1445,9 +1453,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 @@ -1544,7 +1554,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 @@ -1629,6 +1639,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 @@ -2365,7 +2379,7 @@ get_cpu() {
esac
;;

"Solaris")
"Solaris" | "illumos")
# Get CPU name.
cpu="$(psrinfo -pv)"
cpu="${cpu//*$'\n'}"
Expand Down Expand Up @@ -2754,10 +2768,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 @@ -3849,7 +3863,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 @@ -9077,6 +9091,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