Skip to content

Commit

Permalink
feat(dracut-install): support ZSTD-compressed firmware with .zst suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
nabijaczleweli authored and johannbg committed Jun 9, 2022
1 parent 95aeed8 commit 9d8387e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/install/dracut-install.c
Original file line number Diff line number Diff line change
Expand Up @@ -1371,18 +1371,20 @@ static int install_all(int argc, char **argv)

static int install_firmware_fullpath(const char *fwpath)
{
const char *fw;
_cleanup_free_ char *fwpath_xz = NULL;
fw = fwpath;
const char *fw = fwpath;
_cleanup_free_ char *fwpath_compressed = NULL;
struct stat sb;
int ret;
if (stat(fwpath, &sb) != 0) {
_asprintf(&fwpath_xz, "%s.xz", fwpath);
if (stat(fwpath_xz, &sb) != 0) {
log_debug("stat(%s) != 0", fwpath);
return 1;
_asprintf(&fwpath_compressed, "%s.zst", fwpath);
if (access(fwpath_compressed, F_OK) != 0) {
strcpy(fwpath_compressed + strlen(fwpath) + 1, "xz");
if (access(fwpath_compressed, F_OK) != 0) {
log_debug("stat(%s) != 0", fwpath);
return 1;
}
}
fw = fwpath_xz;
fw = fwpath_compressed;
}
ret = dracut_install(fw, fw, false, false, true);
if (ret == 0) {
Expand Down

0 comments on commit 9d8387e

Please sign in to comment.