From eb8e6fd3a42e600b8a9a87a4f6c0c18e8a0acf59 Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Thu, 18 Sep 2025 08:21:19 +0200 Subject: [PATCH] Detect SmartOS SmartOS is an Illumos distribution, however its configuration differs quite a bit from regular Solaris (more of an "appliance"-style configuration). So we consider it a different operating system. --- explorer/cpu_cores | 3 +++ explorer/cpu_sockets | 3 +++ explorer/os | 11 +++++++++++ explorer/os_version | 3 +++ type/__package/manifest | 2 +- 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/explorer/cpu_cores b/explorer/cpu_cores index d83dfcb8f..88b1c4af8 100755 --- a/explorer/cpu_cores +++ b/explorer/cpu_cores @@ -40,6 +40,9 @@ in /sbin/sysctl -n hw.ncpuonline 2>/dev/null | grep . \ || /sbin/sysctl -n hw.ncpu ;; + (smartos) + sysinfo -p | sed -n -e 's/^CPU_Core_Count=//p' + ;; (freebsd) sysctl -n hw.ncpu ;; diff --git a/explorer/cpu_sockets b/explorer/cpu_sockets index 39f98b265..21025d5ac 100755 --- a/explorer/cpu_sockets +++ b/explorer/cpu_sockets @@ -30,6 +30,9 @@ in ;; (netbsd) ;; + (smartos) + sysinfo -p | sed -n -e 's/^CPU_Socket_Count=//p' + ;; (*) if test -r /proc/cpuinfo then diff --git a/explorer/os b/explorer/os index c6db3766a..521b870a3 100755 --- a/explorer/os +++ b/explorer/os @@ -232,6 +232,17 @@ fi ### Unices +if test -f /etc/release +then + case $(head -n 1 /etc/release) + in + (*' SmartOS '*) + echo smartos + exit 0 + ;; + esac +fi + # assume there is no tr on the client -> do lower case ourselves case $(uname -s) in diff --git a/explorer/os_version b/explorer/os_version index e384a130c..86a74459e 100755 --- a/explorer/os_version +++ b/explorer/os_version @@ -243,6 +243,9 @@ in rc_getvar /etc/lsb-release DISTRIB_RELEASE fi ;; + (smartos) + awk '1==NR {print $2}' /etc/release + ;; (*bsd|solaris) # NOTE: this section has to be at the bottom because of the wildcard. # The freebsd section above should take precedence. diff --git a/type/__package/manifest b/type/__package/manifest index c0c3428fb..6d4e5ad5a 100755 --- a/type/__package/manifest +++ b/type/__package/manifest @@ -48,7 +48,7 @@ else (gentoo) type='emerge' ;; (suse) type='zypper' ;; (openwrt) type='opkg' ;; - (netbsd) type='pkgsrc' ;; + (netbsd|smartos) type='pkgsrc' ;; (openbsd) type='pkg_openbsd' ;; (adelie|alpine|chimera) type='apk' ;; (*)