distro/rhel85: sort mounts

Previously, /boot/efi mount was specified before /. This obviously doesn't
work because we need to mount / firstly.

This commit adds explicit ordering of the mounts.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2021-07-20 10:40:33 +02:00 committed by Ondřej Budai
parent c656972f25
commit 57e8ca0e5f

View file

@ -3,6 +3,7 @@ package rhel85
import (
"fmt"
"path/filepath"
"sort"
"github.com/google/uuid"
@ -427,6 +428,15 @@ func copyFSTreeOptions(inputName, inputPipeline string, pt *disk.PartitionTable,
mounts[i] = *mount
}
// sort the mounts, using < should just work because:
// - a parent directory should be always before its children:
// / < /boot
// - the order of siblings doesn't matter
sort.Slice(mounts, func(i, j int) bool {
return mounts[i].Target < mounts[j].Target
})
stageMounts := osbuild.CopyStageMounts(mounts)
stageDevices := osbuild.CopyStageDevices(devices)