Pino Toscano
2018-Oct-02 09:00 UTC
[Libguestfs] [supermin PATCH] rpm: generalize openSUSE support
It seems that all the newer versions of openSUSE have an 'opensuse-' prefix in their distro ID; hence, check for that prefix at once, keeping compatibility for the old "opensuse" ID. Followup of commit 0668b2d64abef0724219480a3d7fc16b8dd1e68f. --- src/ph_rpm.ml | 3 ++- tests/test-harder.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ph_rpm.ml b/src/ph_rpm.ml index 3caa38e..46b7f1f 100644 --- a/src/ph_rpm.ml +++ b/src/ph_rpm.ml @@ -40,7 +40,8 @@ let fedora_detect () let opensuse_detect () Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && Config.zypper <> "no" && - (List.mem (Os_release.get_id ()) [ "opensuse-leap"; "opensuse"; "sled"; "sles" ] || + (List.mem (Os_release.get_id ()) [ "sled"; "sles" ] || + string_prefix "opensuse" (Os_release.get_id ()) || try (stat "/etc/SuSE-release").st_kind = S_REG with Unix_error _ -> false) let mageia_detect () diff --git a/tests/test-harder.sh b/tests/test-harder.sh index 54362de..c827f13 100755 --- a/tests/test-harder.sh +++ b/tests/test-harder.sh @@ -29,7 +29,7 @@ if [ -f /etc/os-release ]; then distro=$(. /etc/os-release && echo $ID) case "$distro" in fedora|rhel|centos) distro=redhat ;; - opensuse-leap|opensuse|sled|sles) distro=suse ;; + opensuse*|sled|sles) distro=suse ;; ubuntu) distro=debian ;; esac elif [ -f /etc/arch-release ]; then -- 2.17.1
Richard W.M. Jones
2018-Oct-02 09:11 UTC
Re: [Libguestfs] [supermin PATCH] rpm: generalize openSUSE support
On Tue, Oct 02, 2018 at 11:00:38AM +0200, Pino Toscano wrote:> It seems that all the newer versions of openSUSE have an 'opensuse-' > prefix in their distro ID; hence, check for that prefix at once, keeping > compatibility for the old "opensuse" ID. > > Followup of commit 0668b2d64abef0724219480a3d7fc16b8dd1e68f. > --- > src/ph_rpm.ml | 3 ++- > tests/test-harder.sh | 2 +- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/src/ph_rpm.ml b/src/ph_rpm.ml > index 3caa38e..46b7f1f 100644 > --- a/src/ph_rpm.ml > +++ b/src/ph_rpm.ml > @@ -40,7 +40,8 @@ let fedora_detect () > let opensuse_detect () > Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && > Config.zypper <> "no" && > - (List.mem (Os_release.get_id ()) [ "opensuse-leap"; "opensuse"; "sled"; "sles" ] || > + (List.mem (Os_release.get_id ()) [ "sled"; "sles" ] || > + string_prefix "opensuse" (Os_release.get_id ()) || > try (stat "/etc/SuSE-release").st_kind = S_REG with Unix_error _ -> false) > > let mageia_detect () > diff --git a/tests/test-harder.sh b/tests/test-harder.sh > index 54362de..c827f13 100755 > --- a/tests/test-harder.sh > +++ b/tests/test-harder.sh > @@ -29,7 +29,7 @@ if [ -f /etc/os-release ]; then > distro=$(. /etc/os-release && echo $ID) > case "$distro" in > fedora|rhel|centos) distro=redhat ;; > - opensuse-leap|opensuse|sled|sles) distro=suse ;; > + opensuse*|sled|sles) distro=suse ;; > ubuntu) distro=debian ;; > esac > elif [ -f /etc/arch-release ]; then > -- > 2.17.1ACK Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Seemingly Similar Threads
- [supermin PATCH] rpm: support openSUSE Leap 15
- Re: [supermin PATCH] rpm: support openSUSE Leap 15
- [supermin][PATCH] os-release: use ID_LIKE as a fallback for SUSE detection
- [supermin][PATCH v2] os-release: use ID_LIKE as a fallback for SUSE detection
- [PATCH 0/2] supermin: use /etc/os-release