Skip to content

Commit 6e54c73

Browse files
committed
feat: add AlmaLinux and Rocky Linux support
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
1 parent 1e58d4d commit 6e54c73

File tree

11 files changed

+42
-17
lines changed

11 files changed

+42
-17
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ jobs:
5959
- alpine
6060
- centos
6161
- quay.io/centos/centos:stream
62+
- almalinux
63+
- rockylinux
6264

6365
steps:
6466
- name: Free Disk Space (Ubuntu)
@@ -112,6 +114,8 @@ jobs:
112114
- debian:13
113115
- centos:8
114116
- quay.io/centos/centos:stream10
117+
- almalinux:10
118+
- rockylinux:9
115119
steps:
116120
- name: Free Disk Space (Ubuntu)
117121
uses: linka-cloud/free-disk-space@main

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Working and tested:
3434
Luks support is available only on Debian buster+
3535
- [x] Alpine
3636
- [x] CentOS (8+)
37+
- [x] Rocky Linux
38+
- [x] AlmaLinux
3739

3840
Unsupported:
3941

builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ func (b *builder) cmdline(_ context.Context) string {
471471
switch b.osRelease.ID {
472472
case ReleaseAlpine:
473473
return b.config.Cmdline(RootUUID(b.rootUUID), "root=/dev/mapper/root", "cryptdm=root", "cryptroot=UUID="+b.cryptUUID, b.cmdLineExtra)
474-
case ReleaseCentOS:
474+
case ReleaseCentOS, ReleaseRocky, ReleaseAlmaLinux:
475475
return b.config.Cmdline(RootUUID(b.rootUUID), "rd.luks.name=UUID="+b.rootUUID+" rd.luks.uuid="+b.cryptUUID+" rd.luks.crypttab=0", b.cmdLineExtra)
476476
default:
477477
// for some versions of debian, the cryptopts parameter MUST contain all the following: target,source,key,opts...

config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (r OSRelease) Config() (Config, error) {
8080
return configDebian, nil
8181
case ReleaseAlpine:
8282
return configAlpine, nil
83-
case ReleaseCentOS:
83+
case ReleaseCentOS, ReleaseRocky, ReleaseAlmaLinux:
8484
return configCentOS, nil
8585
default:
8686
return Config{}, fmt.Errorf("%s: distribution not supported", r.ID)

config_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ func TestConfig(t *testing.T) {
137137
image: "quay.io/centos/centos:stream10",
138138
config: configCentOS,
139139
},
140+
{
141+
image: "almalinux:10",
142+
config: configCentOS,
143+
},
144+
{
145+
image: "rockylinux:9",
146+
config: configCentOS,
147+
},
140148
}
141149
exec.SetDebug(true)
142150

dockerfile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func NewDockerfile(release OSRelease, img, password string, networkManager Netwo
102102
if networkManager == NetworkManagerNetplan {
103103
return d, fmt.Errorf("netplan is not supported on alpine")
104104
}
105-
case ReleaseCentOS:
105+
case ReleaseCentOS, ReleaseRocky, ReleaseAlmaLinux:
106106
d.tmpl = centOSDockerfileTemplate
107107
net = NetworkManagerNone
108108
if networkManager != "" && networkManager != NetworkManagerNone {
@@ -112,7 +112,7 @@ func NewDockerfile(release OSRelease, img, password string, networkManager Netwo
112112
return Dockerfile{}, fmt.Errorf("unsupported distribution: %s", release.ID)
113113
}
114114
if d.NetworkManager == "" {
115-
if release.ID != ReleaseCentOS {
115+
if release.ID != ReleaseCentOS && release.ID != ReleaseRocky && release.ID != ReleaseAlmaLinux {
116116
logrus.Warnf("no network manager specified, using distribution defaults: %s", net)
117117
}
118118
d.NetworkManager = net

e2e/e2e_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ var (
5454
{name: "debian:13", luks: "Please unlock disk root:"},
5555
{name: "centos:8", luks: "Please enter passphrase for disk"},
5656
{name: "quay.io/centos/centos:stream10", luks: "Please enter passphrase for disk"},
57+
{name: "almalinux:10", luks: "Please enter passphrase for disk"},
58+
{name: "rockylinux:9", luks: "Please enter passphrase for disk"},
5759
}
5860
imgNames = func() []string {
5961
var imgs []string
@@ -118,7 +120,7 @@ imgs:
118120

119121
defer os.RemoveAll(dir)
120122
for _, img := range testImgs {
121-
if strings.Contains(img.name, "centos") && tt.efi {
123+
if (strings.Contains(img.name, "centos") || strings.Contains(img.name, "almalinux") || strings.Contains(img.name, "rocky")) && tt.efi {
122124
t.Skip("efi not supported for CentOS")
123125
}
124126
t.Run(img.name, func(t *testing.T) {

grub.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ func (g grubProvider) New(c Config, r OSRelease, arch string) (Bootloader, error
6161
if arch != "x86_64" {
6262
return nil, fmt.Errorf("grub is only supported for amd64")
6363
}
64-
if r.ID == ReleaseCentOS {
65-
return nil, fmt.Errorf("grub (efi) is not supported for CentOS, use grub-bios instead")
64+
if r.ID == ReleaseCentOS || r.ID == ReleaseRocky || r.ID == ReleaseAlmaLinux {
65+
return nil, fmt.Errorf("grub (efi) is not supported for CentOS / Rocky / AlmaLinux, use grub-bios instead")
6666
}
6767
return grub{grubCommon: newGrubCommon(c, r)}, nil
6868
}

grub_efi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ type grubEFIProvider struct {
5656
}
5757

5858
func (g grubEFIProvider) New(c Config, r OSRelease, arch string) (Bootloader, error) {
59-
if r.ID == ReleaseCentOS {
59+
if r.ID == ReleaseCentOS || r.ID == ReleaseRocky || r.ID == ReleaseAlmaLinux {
6060
return nil, fmt.Errorf("grub-efi is not supported for CentOS, use grub-bios instead")
6161
}
6262
return grubEFI{grubCommon: newGrubCommon(c, r), arch: arch}, nil

os_release.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ import (
2626
)
2727

2828
const (
29-
ReleaseUbuntu Release = "ubuntu"
30-
ReleaseDebian Release = "debian"
31-
ReleaseAlpine Release = "alpine"
32-
ReleaseCentOS Release = "centos"
33-
ReleaseRHEL Release = "rhel"
34-
ReleaseKali Release = "kali"
29+
ReleaseUbuntu Release = "ubuntu"
30+
ReleaseDebian Release = "debian"
31+
ReleaseAlpine Release = "alpine"
32+
ReleaseCentOS Release = "centos"
33+
ReleaseRHEL Release = "rhel"
34+
ReleaseKali Release = "kali"
35+
ReleaseRocky Release = "rocky"
36+
ReleaseAlmaLinux Release = "almalinux"
3537
)
3638

3739
type Release string
@@ -48,6 +50,10 @@ func (r Release) Supported() bool {
4850
return true
4951
case ReleaseCentOS:
5052
return true
53+
case ReleaseRocky:
54+
return true
55+
case ReleaseAlmaLinux:
56+
return true
5157
case ReleaseRHEL:
5258
return false
5359
default:
@@ -79,6 +85,10 @@ func (r OSRelease) SupportsLUKS() bool {
7985
return true
8086
case ReleaseCentOS:
8187
return true
88+
case ReleaseRocky:
89+
return true
90+
case ReleaseAlmaLinux:
91+
return true
8292
case ReleaseAlpine:
8393
return true
8494
case ReleaseRHEL:

0 commit comments

Comments
 (0)