SDB:SUSE 和 openSUSE 产品版本输出

跳转到:导航搜索

SUSE 和 openSUSE 产品版本输出

SUSE 和 openSUSE 产品版本输出。本文将对希望在其软件中添加 SUSE 和 openSUSE 发行版兼容性的第三方软件开发者有所帮助。


序言

如您所知,软件分发可以通过二进制包(基于 RPM基于 DEB)、源代码以及开发者安装脚本(例如 install.sh)提供,从而简化了用户的生活。

但是,对于此类安装脚本,一个问题变得实际——如何以及从哪里开始开箱即用地提供 openSUSE/SUSE 支持?


说明

Q

- How to check the SUSE OS version to install software correctly via my installation script?

A

- Check SUSE OS version via its standard features. For example, by parsing different information fields in /usr/lib/os-release file. And this is the most obvious way. See also SDB:Find_openSUSE_version.

Q

- But there are huge pile of different SUSE product versions?! Should I install all of them to find out information I need?

A

- Well... in general way -- yes! But do not worry here: we've prepared the brief summarizing list to make your work easy. :)

Q

- Can I use lsb-release and/or lsb_release output variations as an alternative?

A

- You shouldn't any more. The lsb-release package is NOT installed by default in SUSE/openSUSE. You should install it manually with zypper install lsb-release command if you really want to use it.

Also keep in mind, that zypper install lsb-release command won't work for SUSE's cloud-specific projects: openSUSE Tumbleweed Kubic and SUSE CaaSP because of read-only root filesystem partition (/).

在文章 lsb-release -a/lsb_release -a (-a 表示 全部) 中给出了。

有关特定的 lsb-release/lsb_release 选项,请参阅 man lsb-release 信息。

Q

- Can I use /etc/SuSE-release output as an alternative?

A

- No, because /etc/SuSE-release is has been removed since the release of openSUSE Leap & SLE 15

openSUSE Leap

cat /usr/lib/os-release

NAME="openSUSE Leap"
VERSION="15.0"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.0"
PRETTY_NAME="openSUSE Leap 15.0"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.0"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://opensuse.net.cn/"

openSUSE Tumbleweed

cat /usr/lib/os-release

NAME="openSUSE Tumbleweed"
# VERSION="20250716"
ID="opensuse-tumbleweed"
ID_LIKE="opensuse suse"
VERSION_ID="20250716"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
# CPE 2.3 format, boo#1217921
CPE_NAME="cpe:2.3:o:opensuse:tumbleweed:20250716:*:*:*:*:*:*:*"
#CPE 2.2 format
#CPE_NAME="cpe:/o:opensuse:tumbleweed:20250716"
BUG_REPORT_URL="https://bugzilla.opensuse.org"
SUPPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://opensuse.net.cn"
DOCUMENTATION_URL="https://en.opensuse.net.cn/Portal:Tumbleweed"
LOGO="distributor-logo-Tumbleweed"

如您所见,VERSION_ID= 字段与 openSUSE Tumbleweed 快照的日期相匹配。

openSUSE Tumbleweed Kubic

cat /usr/lib/os-release

NAME="openSUSE Tumbleweed Kubic"
# VERSION="20180320"
ID="opensuse-tumbleweed-kubic"
ID_LIKE="suse opensuse"
VERSION_ID="20180320"
PRETTY_NAME="openSUSE Tumbleweed Kubic"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:tumbleweed-kubic:20180320"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://opensuse.net.cn"

如您所见,VERSION_ID= 字段表示 openSUSE Tumbleweed Kubic 快照的日期。

SUSE Linux Enterprise Server (SLES)

cat /usr/lib/os-release

NAME="SLES"
VERSION="12-SP3"
VERSION_ID="12.3"
PRETTY_NAME="SUSE Linux Enterprise Server 12 SP3"
ID="sles"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:12:sp3"

SUSE Linux Enterprise Desktop (SLED)

cat /usr/lib/os-release

NAME="SLED"
VERSION="12-SP3"
VERSION_ID="12.3"
PRETTY_NAME="SUSE Linux Enterprise Desktop 12 SP3"
ID="sled"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sled:12:sp3"

如您所见,唯一的区别在于 NAME=ID= 字段中的 SLED/sled 代替 SLES/sles。所有其他内容与 SLES 输出相同。

SUSE Container as a Service Platform (SUSE CaaSP)

cat /usr/lib/os-release

NAME="CAASP"
VERSION="2.0"
VERSION_ID="2.0"
PRETTY_NAME="SUSE Container as a Service Platform 2.0"
ID="caasp"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:caasp:2.0"

摘要

我们希望此列表能帮助您将 SUSE 产品支持添加到您的软件安装脚本中。感谢您并祝您使用 SUSE 的体验愉快!