Skip to content

Commit

Permalink
👷 disk: refactor zfs pool property set using gucc
Browse files Browse the repository at this point in the history
  • Loading branch information
vnepogodin committed Jan 5, 2025
1 parent e8e2f6b commit ccaa6fd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/disk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ bool zfs_auto_pres(const std::string_view& partition, const std::string_view& zf
return false;
}

#ifdef NDEVENV
// next create the datasets including their parents
const std::vector<gucc::fs::ZfsDataset> default_zfs_datasets{
gucc::fs::ZfsDataset{.zpath = fmt::format(FMT_COMPILE("{}/ROOT"), zfs_zpool_name), .mountpoint = "none"s},
Expand All @@ -222,12 +223,19 @@ bool zfs_auto_pres(const std::string_view& partition, const std::string_view& zf
};
if (!gucc::fs::zfs_create_datasets(default_zfs_datasets)) {
spdlog::error("Failed to create zfs datasets automatically");
return false;
}

#ifdef NDEVENV
// set the rootfs
gucc::utils::exec(fmt::format(FMT_COMPILE("zpool set bootfs={0}/ROOT/cos/root {0} 2>>/tmp/cachyos-install.log"), zfs_zpool_name), true);
const auto& zpool_property = fmt::format(FMT_COMPILE("bootfs={}/ROOT/cos/root"), zfs_zpool_name);
if (!gucc::fs::zpool_set_property(zpool_property, zfs_zpool_name)) {
spdlog::error("Failed to set zfs pool property");
return false;
}
#else
spdlog::info("Created ZFS automatically");
#endif

return true;
}

Expand Down

0 comments on commit ccaa6fd

Please sign in to comment.