21361: Detect more Red Hat-family distros in installer
authorBrett Smith <brett.smith@curii.com>
Mon, 29 Jan 2024 04:33:49 +0000 (23:33 -0500)
committerBrett Smith <brett.smith@curii.com>
Wed, 31 Jan 2024 22:22:25 +0000 (17:22 -0500)
To support Rocky, Alma, etc.

Arvados-DCO-1.1-Signed-off-by: Brett Smith <brett.smith@curii.com>

lib/install/deps.go

index 439289b58887efef1874c7adcb71c103b4ec0862..f4597d81626614a402559c4913273c18b8cc4b08 100644 (file)
@@ -249,7 +249,7 @@ func (inst *installCommand) RunCommand(prog string, args []string, stdin io.Read
                        pkgs = append(pkgs, "g++", "libcurl4", "libcurl4-openssl-dev")
                case osv.Debian || osv.Ubuntu:
                        pkgs = append(pkgs, "g++", "libcurl3", "libcurl3-openssl-dev")
-               case osv.Centos:
+               case osv.RedHat:
                        pkgs = append(pkgs, "gcc", "gcc-c++", "libcurl-devel", "postgresql-devel")
                }
                cmd := exec.CommandContext(ctx, "apt-get")
@@ -793,7 +793,7 @@ rsync -a --delete-after "$tmp/build/" "$dst/"
 type osversion struct {
        Debian bool
        Ubuntu bool
-       Centos bool
+       RedHat bool
        Major  int
 }
 
@@ -831,10 +831,24 @@ func identifyOS() (osversion, error) {
                osv.Ubuntu = true
        case "debian":
                osv.Debian = true
-       case "centos":
-               osv.Centos = true
        default:
-               return osv, fmt.Errorf("unsupported ID in /etc/os-release: %q", kv["ID"])
+               id_like_match := false
+               for _, id_like := range strings.Split(kv["ID_LIKE"], " ") {
+                       switch id_like {
+                       case "debian":
+                               osv.Debian = true
+                               id_like_match = true
+                       case "rhel":
+                               osv.RedHat = true
+                               id_like_match = true
+                       }
+                       if id_like_match {
+                               break
+                       }
+               }
+               if !id_like_match {
+                       return osv, fmt.Errorf("no supported ID found in /etc/os-release")
+               }
        }
        vstr := kv["VERSION_ID"]
        if i := strings.Index(vstr, "."); i > 0 {
@@ -895,7 +909,7 @@ func prodpkgs(osv osversion) []string {
                return append(pkgs,
                        "mime-support", // keep-web
                )
-       } else if osv.Centos {
+       } else if osv.RedHat {
                return append(pkgs,
                        "fuse-libs", // services/fuse
                        "mailcap",   // keep-web