]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
feat(configure): autoconfigure configprofile
authorJo Zzsi <jozzsicsataban@gmail.com>
Sun, 10 Aug 2025 12:20:09 +0000 (08:20 -0400)
committerLaszlo <laszlo.gombos@gmail.com>
Fri, 15 Aug 2025 13:53:18 +0000 (09:53 -0400)
The original motivation of this PR was to set the openSUSE config
inside the openSUSE CI container.

This commit will autoconfigure those configprofiles that are
maintained upstream for fedora, debian and opensuse based distro's.

One notable change from this commit is that it would now allow testing
hostonly_cmdline=yes configuration which is currently untested
on the CI.

configure

index e7560a7cedd47622ef1dfe4505e85e501374952e..b01b5fae3eb41e7be83eb3121bbbbcdd6c578927 100755 (executable)
--- a/configure
+++ b/configure
@@ -22,8 +22,27 @@ fi
 CC="${CC:-cc}"
 PKG_CONFIG="${PKG_CONFIG:-pkg-config}"
 
-# set hostonly by default
-configprofile="${configprofile:-hostonly}"
+# set configprofile based on ID and ID_LIKE from os-release
+if [[ -f /etc/os-release ]]; then
+    . /etc/os-release
+elif [[ -f /usr/lib/os-release ]]; then
+    . /usr/lib/os-release
+fi
+
+case " $ID $ID_LIKE " in
+    *" debian "*)
+        configprofile=debian
+        ;;
+    *" fedora "*)
+        configprofile=fedora
+        ;;
+    *" suse "*)
+        configprofile=opensuse
+        ;;
+    *)
+        configprofile=hostonly
+        ;;
+esac
 
 # Little helper function for reading args from the commandline.
 # it automatically handles -a b and -a=b variants, and returns 1 if