3 Commits
2.6.3 ... 2.7.0

Author SHA1 Message Date
Clayton Craft
15c95f6b13 Add support for hooks-cleanup
The pmOS initramfs will execute scripts in this dir, so let's add a way
to install them in the archive!
2025-09-12 15:40:01 -07:00
Clayton Craft
bab4be1a89 misc/getfiles: fix zst fallback
The previous symlink recursion fix broke the fallback for zst by
returning early.

Fixes 7a07a16ecb

Part-of: https://gitlab.postmarketos.org/postmarketOS/postmarketos-mkinitfs/-/merge_requests/67
[ci:skip-build]: already built successfully in CI
2025-08-04 17:37:25 -07:00
Pablo Correa Gómez
1428f27b4a gitlab-ci: don't run CI-tron on tags
Fixes #49

Part-of: https://gitlab.postmarketos.org/postmarketOS/postmarketos-mkinitfs/-/merge_requests/66
[ci:skip-build]: already built successfully in CI
2025-08-04 17:36:01 -07:00
5 changed files with 33 additions and 9 deletions

View File

@@ -56,6 +56,9 @@ build:
variables: variables:
DEVICE_NAME: qemu-$CPU_ARCH DEVICE_NAME: qemu-$CPU_ARCH
KERNEL_VARIANT: lts KERNEL_VARIANT: lts
rules:
- if: '$CI_COMMIT_TAG != null'
when: never
.build-ci-tron-qemu: .build-ci-tron-qemu:
stage: hardware tests stage: hardware tests

View File

@@ -111,6 +111,8 @@ func main() {
hookfiles.New("/etc/mkinitfs/files"), hookfiles.New("/etc/mkinitfs/files"),
hookscripts.New("/usr/share/mkinitfs/hooks", "/hooks"), hookscripts.New("/usr/share/mkinitfs/hooks", "/hooks"),
hookscripts.New("/etc/mkinitfs/hooks", "/hooks"), hookscripts.New("/etc/mkinitfs/hooks", "/hooks"),
hookscripts.New("/usr/share/mkinitfs/hooks-cleanup", "/hooks-cleanup"),
hookscripts.New("/etc/mkinitfs/hooks-cleanup", "/hooks-cleanup"),
modules.New("/usr/share/mkinitfs/modules"), modules.New("/usr/share/mkinitfs/modules"),
modules.New("/etc/mkinitfs/modules"), modules.New("/etc/mkinitfs/modules"),
}) })

View File

@@ -134,7 +134,8 @@ create/manage. mkinitfs reads configuration from */usr/share/mkinitfs* first, an
skipped. skipped.
## /usr/share/mkinitfs/hooks, /etc/mkinitfs/hooks ## /usr/share/mkinitfs/hooks, /etc/mkinitfs/hooks
## /usr/share/mkinitfs/hooks-extra*, /etc/mkinitfs/hooks-extra ## /usr/share/mkinitfs/hooks-cleanup, /etc/mkinitfs/hooks-cleanup
## /usr/share/mkinitfs/hooks-extra, /etc/mkinitfs/hooks-extra
Any files listed under these directories are copied as-is into the Any files listed under these directories are copied as-is into the
relevant archives. Hooks are generally script files, but how they are relevant archives. Hooks are generally script files, but how they are

View File

@@ -47,14 +47,14 @@ func getFile(file string, required bool) (files []string, err error) {
// 2) set file to dereferenced target // 2) set file to dereferenced target
// 4) continue this function to either walk it if the target is a dir or add the // 4) continue this function to either walk it if the target is a dir or add the
// target to the list of files // target to the list of files
if s, err := os.Lstat(file); err != nil { if s, err := os.Lstat(file); err == nil {
return files, err if s.Mode()&fs.ModeSymlink != 0 {
} else if s.Mode()&fs.ModeSymlink != 0 { files = append(files, file)
files = append(files, file) if target, err := filepath.EvalSymlinks(file); err != nil {
if target, err := filepath.EvalSymlinks(file); err != nil { return files, err
return files, err } else {
} else { file = target
file = target }
} }
} }

View File

@@ -107,6 +107,24 @@ func TestGetFile(t *testing.T) {
}, },
required: true, required: true,
}, },
{
name: "zst compressed file fallback",
setup: func(tmpDir string) (string, []string, error) {
// Create a .zst file but NOT the original file
zstFile := filepath.Join(tmpDir, "firmware.bin.zst")
if err := os.WriteFile(zstFile, []byte("compressed content"), 0644); err != nil {
return "", nil, err
}
// Request the original file (without .zst extension)
originalFile := filepath.Join(tmpDir, "firmware.bin")
// Expected: should find and return the .zst version
expected := []string{zstFile}
return originalFile, expected, nil
},
required: true,
},
} }
for _, st := range subtests { for _, st := range subtests {