switch to a build process

This commit is contained in:
abbie 2024-11-12 17:53:59 +00:00
parent 2d212cfd10
commit e7b1f334ba
Signed by: threeoh6000
GPG key ID: 801FE4AD456E922C
11 changed files with 220 additions and 216 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
abbiefetch

View file

@ -1,216 +0,0 @@
#!/bin/sh
system_type="unknown"
subtype="none"
username="(user)"
hostname="(none)"
hashostname=0
hasawk=0
haslspci=0
hasglxinfo=0
hassed=0
command -v hostname >>/dev/null
if [ "$?" -eq 0 ]; then
hashostname=1
fi
command -v awk >>/dev/null
if [ "$?" -eq 0 ]; then
hasawk=1
fi
command -v lspci >>/dev/null
if [ "$?" -eq 0 ]; then
haslspci=1
fi
command -v glxinfo >>/dev/null
if [ "$?" -eq 0 ]; then
hasglxinfo=1
fi
command -v sed >>/dev/null
if [ "$?" -eq 0 ]; then
hassed=1
fi
if [ "$(uname -s)" = "Linux" ] && [ "$system_type" = "unknown" ]; then
system_type="linux"
command -v chumby_version >>/dev/null
if [ "$?" -eq 0 ] && [ "$subtype" = "none" ]; then
subtype="chumby"
fi
command -v raspi-config >>/dev/null
if [ "$?" -eq 0 ] && [ "$subtype" = "none" ]; then
subtype="rpi"
fi
command -v pveversion >>/dev/null
if [ "$?" -eq 0 ] && [ "$subtype" = "none" ]; then
subtype="proxmox"
fi
fi
if [ "$(uname -s)" = "OpenBSD" ] && [ "$system_type" = "unknown" ]; then
system_type="openbsd"
fi
if [ "$(uname -s)" = "FreeBSD" ] && [ "$system_type" = "unknown" ]; then
system_type="freebsd"
fi
if [ "$(uname -s)" = "NetBSD" ] && [ "$system_type" = "unknown" ]; then
system_type="netbsd"
fi
if [ "$(uname -s)" = "Haiku" ] && [ "$system_type" = "unknown" ]; then
system_type="haiku"
fi
if [ "$hashostname" -eq 1 ]; then
hostname="$(hostname)"
elif [ -n "$(cat /etc/hostname)" ]; then
hostname="$(cat /etc/hostname)"
fi
if [ -n "$(whoami)" ]; then
username="$(whoami)"
fi
if [ "$hasawk" -eq 1 ] && [ $system_type = "openbsd" ] && [ -z "$processor" ]; then
processor="$(sysctl hw.model | awk -F "=" '{print $2}')"
fi
if [ "$hasawk" -eq 1 ] && [ $system_type = "freebsd" ] && [ -z "$processor" ]; then
processor="$(sysctl hw.model | awk -F ": " '{print $2}')"
fi
if [ "$hasawk" -eq 1 ] && [ $system_type = "netbsd" ] && [ -z "$processor" ]; then
processor="$(sysctl machdep.cpu_brand | awk -F " = " '{print $2}')"
fi
if [ "$hasawk" -eq 1 ] && [ $system_type = "haiku" ] && [ -z "$processor" ]; then
processor="$(sysinfo | grep "CPU #0" | awk -F "\"" '{ print $2 }')"
fi
if [ "$hasawk" -eq 1 ] && [ $system_type = "linux" ] && [ -z "$processor" ]; then
if [ -n "$(cat /proc/cpuinfo | grep "model name" | head -n 1 | awk -F ": " '{print $2}')" ]; then
processor="$(cat /proc/cpuinfo | grep "model name" | head -n 1 | awk -F ": " '{print $2}')"
elif [ -n "$(cat /proc/cpuinfo | grep -v "cpuid" | grep -v "Hz" | grep -v "cpu number" | grep -v "cpu regs" | grep "cpu" | head -n 1 | awk -F ": " '{print $2}')" ]; then
processor="$(cat /proc/cpuinfo | grep -v "cpuid" | grep -v "Hz" | grep -v "cpu number" | grep -v "cpu regs" | grep "cpu" | head -n 1 | awk -F ": " '{print $2}')"
elif [ -n "$(cat /proc/cpuinfo | grep "Hardware" | head -n 1 | awk -F ": " '{print $2}')" ] && [ $subtype = "chumby" -o $subtype = "rpi" ]; then
processor="$(cat /proc/cpuinfo | grep "Hardware" | head -n 1 | awk -F ": " '{print $2}')"
elif [ -n "$(cat /proc/cpuinfo | grep "family" | head -n 1 | awk -F ": " '{print $2}')" ]; then
processor="$(cat /proc/cpuinfo | grep "family" | head -n 1 | awk -F ": " '{print $2}')"
elif [ -n "$(cat /proc/cpuinfo | grep "Processor" | head -n 1 | awk -F ": " '{print $2}')" ]; then
processor="$(cat /proc/cpuinfo | grep "Processor" | head -n 1 | awk -F ": " '{print $2}')"
fi
fi
if [ "$hassed" -eq 1 ] && [ "$hasawk" -eq 1 ] && [ -n "$processor" ]; then
if [ -n "$(echo $processor | awk -F "@" '{print $1}' | sed "s/Processor//g" | sed "s/CPU//g" | sed "s/(R)//g" | sed "s/(r)//g" | sed "s/(TM)//g" | sed "s/(tm)//g" | tr -s " ")" ]; then
processor="$(echo $processor | awk -F "@" '{print $1}' | sed "s/Processor//g" | sed "s/CPU//g" | sed "s/(R)//g" | sed "s/(r)//g" | sed "s/(TM)//g" | sed "s/(tm)//g" | tr -s " ")"
fi
fi
if [ -n "$(uname -r)" ] && [ -z "$kernel" ]; then
kernel="$(uname -s) $(uname -r)"
fi
if [ -n "$(uname -s)" ] && [ -z "$kernel" ]; then
kernel="$(uname -s)"
fi
if [ "$hasglxinfo" -eq 1 ] && [ "$hasawk" -eq 1 ] && [ -z "$graphics" ]; then
if [ -n "$(glxinfo 2>/dev/null | grep "OpenGL renderer string" | awk -F ": " '{print $2}' | awk -F "(" '{print $1}')" ]; then
graphics="$(glxinfo 2>/dev/null | grep "OpenGL renderer string" | awk -F ": " '{print $2}' | awk -F "(" '{print $1}')"
fi
fi
if [ "$haslspci" -eq 1 ] && [ "$hasawk" -eq 1 ] && [ -z "$graphics" ]; then
if [ -n "$(lspci | grep "VGA compatible controller" | awk -F "controller: " '{print $2}')" ]; then
graphics="$(lspci | grep "VGA compatible controller" | awk -F "controller: " '{print $2}')"
fi
fi
if [ -f /etc/lsb-release ] && [ $system_type = "linux" ]; then
if [ "$hasawk" -eq 1 ] && [ -z "$distro" ]; then
if [ -n "$(cat /etc/lsb-release | grep DISTRIB_DESCRIPTION | awk -F "\"" '{print $2}') $(cat /etc/lsb-release | grep DISTRIB_RELEASE | awk -F "\"" '{print $2}')" ] && [ "$(cat /etc/lsb-release | grep DISTRIB_RELEASE | awk -F "\"" '{print $2}')" != "rolling" ]; then
distro="$(cat /etc/lsb-release | grep DISTRIB_DESCRIPTION | awk -F "\"" '{print $2}') $(cat /etc/lsb-release | grep DISTRIB_RELEASE | awk -F "\"" '{print $2}')"
elif [ -n "$(cat /etc/lsb-release | grep DISTRIB_DESCRIPTION | awk -F "\"" '{print $2}')" ]; then
distro="$(cat /etc/lsb-release | grep DISTRIB_DESCRIPTION | awk -F "\"" '{print $2}')"
fi
fi
fi
if [ -f /etc/os-release ] && [ $system_type = "linux" ]; then
if [ "$hasawk" -eq 1 ] && [ -z "$distro" ]; then
if [ -n "$(cat /etc/os-release | grep PRETTY_NAME | awk -F "\"" '{print $2}')" ]; then
distro="$(cat /etc/os-release | grep PRETTY_NAME | awk -F "\"" '{print $2}')"
elif [ -n "$(cat /etc/os-release | grep NAME | awk -F "\"" '{print $2}')" ]; then
distro="$(cat /etc/os-release | grep NAME | awk -F "\"" '{print $2}')"
fi
fi
fi
if [ $subtype = "chumby" ]; then
distro="Chumby firmware $(chumby_version -s)"
if [ "$hasawk" -eq 1 ]; then
if [ "$(chumby_version -h | awk -F "." '{print $1}')" = "3" ]; then
machine="Chumby Classic"
elif [ "$(chumby_version -h | awk -F "." '{print $1}')" = "10" ]; then
machine="Chumby One"
elif [ "$(chumby_version -h | awk -F "." '{print $1}')" = "7" ]; then
machine="Insignia Infocast 3.5\""
else
machine="Chumby-enabled device"
fi
fi
fi
if [ $subtype = "proxmox" ]; then
if [ "$hasawk" -eq 1 ]; then
if [ -n "$(pveversion | awk -F "/" '{ print $2 }')" ]; then
distro="Proxmox VE $(pveversion | awk -F "/" '{ print $2 }')"
fi
fi
fi
if [ $system_type = "openbsd" ]; then
if [ "$hasawk" -eq 1 ]; then
distro="revision $(sysctl kern.osrevision | awk -F "=" '{print $2}')"
machine="$(sysctl hw.vendor | awk -F "=" '{print $2}') $(sysctl hw.product | awk -F "=" '{print $2}')"
fi
fi
if [ $system_type = "freebsd" ]; then
if [ "$hasawk" -eq 1 ]; then
distro="revision $(sysctl kern.osrevision | awk -F ": " '{print $2}')"
fi
machine="$(kenv smbios.system.maker) $(kenv smbios.system.product)"
fi
if [ $system_type = "netbsd" ]; then
if [ "$hasawk" -eq 1 ]; then
distro="revision $(sysctl kern.osrevision | awk -F " = " '{print $2}')"
machine="$(sysctl machdep.dmi.system-vendor | awk -F " = " '{print $2}') $(sysctl machdep.dmi.system-product | awk -F " = " '{print $2}')"
fi
fi
if [ $system_type = "haiku" ]; then
distro="$(uname -v)"
fi
if [ $system_type = "linux" ] && [ -z "$machine" ]; then
if [ -f "/sys/devices/virtual/dmi/id/product_name" ]; then
machine="$(cat /sys/devices/virtual/dmi/id/product_name)"
fi
if [ -f "/sys/devices/virtual/dmi/id/sys_vendor" ]; then
machine="$(cat /sys/devices/virtual/dmi/id/sys_vendor) $machine"
fi
fi
if [ "$subtype" = "none" ]; then
echo "$username@$hostname ($system_type)"
else
echo "$username@$hostname ($system_type/$subtype)"
fi
echo
if [ -n "$processor" ]; then
echo "cpu: $processor"
fi
if [ -n "$graphics" ]; then
echo "gpu: $graphics"
fi
if [ -n "$kernel" ]; then
echo "krn: $kernel"
fi
if [ -n "$distro" ]; then
echo "sys: $distro"
fi
if [ -n "$machine" ]; then
echo "mac: $machine"
fi

10
build.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
cat probing.1 | tee -p abbiefetch
cat system_detection.2 | tee -ap abbiefetch
cat hostname_username.3 | tee -ap abbiefetch
cat processor_detection.4 | tee -ap abbiefetch
cat kernel_info.5 | tee -ap abbiefetch
cat gpu_detection.6 | tee -ap abbiefetch
cat distro_machine_detection.7 | tee -ap abbiefetch
cat display_results.8 | tee -ap abbiefetch
chmod +x abbiefetch

21
display_results.8 Normal file
View file

@ -0,0 +1,21 @@
if [ "$subtype" = "none" ]; then
echo "$username@$hostname ($system_type)"
else
echo "$username@$hostname ($system_type/$subtype)"
fi
echo
if [ -n "$processor" ]; then
echo "cpu: $processor"
fi
if [ -n "$graphics" ]; then
echo "gpu: $graphics"
fi
if [ -n "$kernel" ]; then
echo "krn: $kernel"
fi
if [ -n "$distro" ]; then
echo "sys: $distro"
fi
if [ -n "$machine" ]; then
echo "mac: $machine"
fi

View file

@ -0,0 +1,69 @@
if [ -f /etc/lsb-release ] && [ $system_type = "linux" ]; then
if [ "$hasawk" -eq 1 ] && [ -z "$distro" ]; then
if [ -n "$(cat /etc/lsb-release | grep DISTRIB_DESCRIPTION | awk -F "\"" '{print $2}') $(cat /etc/lsb-release | grep DISTRIB_RELEASE | awk -F "\"" '{print $2}')" ] && [ "$(cat /etc/lsb-release | grep DISTRIB_RELEASE | awk -F "\"" '{print $2}')" != "rolling" ]; then
distro="$(cat /etc/lsb-release | grep DISTRIB_DESCRIPTION | awk -F "\"" '{print $2}') $(cat /etc/lsb-release | grep DISTRIB_RELEASE | awk -F "\"" '{print $2}')"
elif [ -n "$(cat /etc/lsb-release | grep DISTRIB_DESCRIPTION | awk -F "\"" '{print $2}')" ]; then
distro="$(cat /etc/lsb-release | grep DISTRIB_DESCRIPTION | awk -F "\"" '{print $2}')"
fi
fi
fi
if [ -f /etc/os-release ] && [ $system_type = "linux" ]; then
if [ "$hasawk" -eq 1 ] && [ -z "$distro" ]; then
if [ -n "$(cat /etc/os-release | grep PRETTY_NAME | awk -F "\"" '{print $2}')" ]; then
distro="$(cat /etc/os-release | grep PRETTY_NAME | awk -F "\"" '{print $2}')"
elif [ -n "$(cat /etc/os-release | grep NAME | awk -F "\"" '{print $2}')" ]; then
distro="$(cat /etc/os-release | grep NAME | awk -F "\"" '{print $2}')"
fi
fi
fi
if [ $subtype = "chumby" ]; then
distro="Chumby firmware $(chumby_version -s)"
if [ "$hasawk" -eq 1 ]; then
if [ "$(chumby_version -h | awk -F "." '{print $1}')" = "3" ]; then
machine="Chumby Classic"
elif [ "$(chumby_version -h | awk -F "." '{print $1}')" = "10" ]; then
machine="Chumby One"
elif [ "$(chumby_version -h | awk -F "." '{print $1}')" = "7" ]; then
machine="Insignia Infocast 3.5\""
else
machine="Chumby-enabled device"
fi
fi
fi
if [ $subtype = "proxmox" ]; then
if [ "$hasawk" -eq 1 ]; then
if [ -n "$(pveversion | awk -F "/" '{ print $2 }')" ]; then
distro="Proxmox VE $(pveversion | awk -F "/" '{ print $2 }')"
fi
fi
fi
if [ $system_type = "openbsd" ]; then
if [ "$hasawk" -eq 1 ]; then
distro="revision $(sysctl kern.osrevision | awk -F "=" '{print $2}')"
machine="$(sysctl hw.vendor | awk -F "=" '{print $2}') $(sysctl hw.product | awk -F "=" '{print $2}')"
fi
fi
if [ $system_type = "freebsd" ]; then
if [ "$hasawk" -eq 1 ]; then
distro="revision $(sysctl kern.osrevision | awk -F ": " '{print $2}')"
fi
machine="$(kenv smbios.system.maker) $(kenv smbios.system.product)"
fi
if [ $system_type = "netbsd" ]; then
if [ "$hasawk" -eq 1 ]; then
distro="revision $(sysctl kern.osrevision | awk -F " = " '{print $2}')"
machine="$(sysctl machdep.dmi.system-vendor | awk -F " = " '{print $2}') $(sysctl machdep.dmi.system-product | awk -F " = " '{print $2}')"
fi
fi
if [ $system_type = "haiku" ]; then
distro="$(uname -v)"
fi
if [ $system_type = "linux" ] && [ -z "$machine" ]; then
if [ -f "/sys/devices/virtual/dmi/id/product_name" ]; then
machine="$(cat /sys/devices/virtual/dmi/id/product_name)"
fi
if [ -f "/sys/devices/virtual/dmi/id/sys_vendor" ]; then
machine="$(cat /sys/devices/virtual/dmi/id/sys_vendor) $machine"
fi
fi

10
gpu_detection.6 Normal file
View file

@ -0,0 +1,10 @@
if [ "$hasglxinfo" -eq 1 ] && [ "$hasawk" -eq 1 ] && [ -z "$graphics" ]; then
if [ -n "$(glxinfo 2>/dev/null | grep "OpenGL renderer string" | awk -F ": " '{print $2}' | awk -F "(" '{print $1}')" ]; then
graphics="$(glxinfo 2>/dev/null | grep "OpenGL renderer string" | awk -F ": " '{print $2}' | awk -F "(" '{print $1}')"
fi
fi
if [ "$haslspci" -eq 1 ] && [ "$hasawk" -eq 1 ] && [ -z "$graphics" ]; then
if [ -n "$(lspci | grep "VGA compatible controller" | awk -F "controller: " '{print $2}')" ]; then
graphics="$(lspci | grep "VGA compatible controller" | awk -F "controller: " '{print $2}')"
fi
fi

9
hostname_username.3 Normal file
View file

@ -0,0 +1,9 @@
if [ "$hashostname" -eq 1 ]; then
hostname="$(hostname)"
elif [ -n "$(cat /etc/hostname)" ]; then
hostname="$(cat /etc/hostname)"
fi
if [ -n "$(whoami)" ]; then
username="$(whoami)"
fi

6
kernel_info.5 Normal file
View file

@ -0,0 +1,6 @@
if [ -n "$(uname -r)" ] && [ -z "$kernel" ]; then
kernel="$(uname -s) $(uname -r)"
fi
if [ -n "$(uname -s)" ] && [ -z "$kernel" ]; then
kernel="$(uname -s)"
fi

37
probing.1 Normal file
View file

@ -0,0 +1,37 @@
#!/bin/sh
system_type="unknown"
subtype="none"
username="(user)"
hostname="(none)"
hashostname=0
hasawk=0
haslspci=0
hasglxinfo=0
hassed=0
command -v hostname >>/dev/null
if [ "$?" -eq 0 ]; then
hashostname=1
fi
command -v awk >>/dev/null
if [ "$?" -eq 0 ]; then
hasawk=1
fi
command -v lspci >>/dev/null
if [ "$?" -eq 0 ]; then
haslspci=1
fi
command -v glxinfo >>/dev/null
if [ "$?" -eq 0 ]; then
hasglxinfo=1
fi
command -v sed >>/dev/null
if [ "$?" -eq 0 ]; then
hassed=1
fi

30
processor_detection.4 Normal file
View file

@ -0,0 +1,30 @@
if [ "$hasawk" -eq 1 ] && [ $system_type = "openbsd" ] && [ -z "$processor" ]; then
processor="$(sysctl hw.model | awk -F "=" '{print $2}')"
fi
if [ "$hasawk" -eq 1 ] && [ $system_type = "freebsd" ] && [ -z "$processor" ]; then
processor="$(sysctl hw.model | awk -F ": " '{print $2}')"
fi
if [ "$hasawk" -eq 1 ] && [ $system_type = "netbsd" ] && [ -z "$processor" ]; then
processor="$(sysctl machdep.cpu_brand | awk -F " = " '{print $2}')"
fi
if [ "$hasawk" -eq 1 ] && [ $system_type = "haiku" ] && [ -z "$processor" ]; then
processor="$(sysinfo | grep "CPU #0" | awk -F "\"" '{ print $2 }')"
fi
if [ "$hasawk" -eq 1 ] && [ $system_type = "linux" ] && [ -z "$processor" ]; then
if [ -n "$(cat /proc/cpuinfo | grep "model name" | head -n 1 | awk -F ": " '{print $2}')" ]; then
processor="$(cat /proc/cpuinfo | grep "model name" | head -n 1 | awk -F ": " '{print $2}')"
elif [ -n "$(cat /proc/cpuinfo | grep -v "cpuid" | grep -v "Hz" | grep -v "cpu number" | grep -v "cpu regs" | grep "cpu" | head -n 1 | awk -F ": " '{print $2}')" ]; then
processor="$(cat /proc/cpuinfo | grep -v "cpuid" | grep -v "Hz" | grep -v "cpu number" | grep -v "cpu regs" | grep "cpu" | head -n 1 | awk -F ": " '{print $2}')"
elif [ -n "$(cat /proc/cpuinfo | grep "Hardware" | head -n 1 | awk -F ": " '{print $2}')" ] && [ $subtype = "chumby" -o $subtype = "rpi" ]; then
processor="$(cat /proc/cpuinfo | grep "Hardware" | head -n 1 | awk -F ": " '{print $2}')"
elif [ -n "$(cat /proc/cpuinfo | grep "family" | head -n 1 | awk -F ": " '{print $2}')" ]; then
processor="$(cat /proc/cpuinfo | grep "family" | head -n 1 | awk -F ": " '{print $2}')"
elif [ -n "$(cat /proc/cpuinfo | grep "Processor" | head -n 1 | awk -F ": " '{print $2}')" ]; then
processor="$(cat /proc/cpuinfo | grep "Processor" | head -n 1 | awk -F ": " '{print $2}')"
fi
fi
if [ "$hassed" -eq 1 ] && [ "$hasawk" -eq 1 ] && [ -n "$processor" ]; then
if [ -n "$(echo $processor | awk -F "@" '{print $1}' | sed "s/Processor//g" | sed "s/CPU//g" | sed "s/(R)//g" | sed "s/(r)//g" | sed "s/(TM)//g" | sed "s/(tm)//g" | tr -s " ")" ]; then
processor="$(echo $processor | awk -F "@" '{print $1}' | sed "s/Processor//g" | sed "s/CPU//g" | sed "s/(R)//g" | sed "s/(r)//g" | sed "s/(TM)//g" | sed "s/(tm)//g" | tr -s " ")"
fi
fi

27
system_detection.2 Normal file
View file

@ -0,0 +1,27 @@
if [ "$(uname -s)" = "Linux" ] && [ "$system_type" = "unknown" ]; then
system_type="linux"
command -v chumby_version >>/dev/null
if [ "$?" -eq 0 ] && [ "$subtype" = "none" ]; then
subtype="chumby"
fi
command -v raspi-config >>/dev/null
if [ "$?" -eq 0 ] && [ "$subtype" = "none" ]; then
subtype="rpi"
fi
command -v pveversion >>/dev/null
if [ "$?" -eq 0 ] && [ "$subtype" = "none" ]; then
subtype="proxmox"
fi
fi
if [ "$(uname -s)" = "OpenBSD" ] && [ "$system_type" = "unknown" ]; then
system_type="openbsd"
fi
if [ "$(uname -s)" = "FreeBSD" ] && [ "$system_type" = "unknown" ]; then
system_type="freebsd"
fi
if [ "$(uname -s)" = "NetBSD" ] && [ "$system_type" = "unknown" ]; then
system_type="netbsd"
fi
if [ "$(uname -s)" = "Haiku" ] && [ "$system_type" = "unknown" ]; then
system_type="haiku"
fi