🧹 cleanup

This commit is contained in:
Vladislav Nepogodin 2023-02-25 12:17:18 +04:00
parent 6f088ea460
commit e452bdce71
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
2 changed files with 7 additions and 2 deletions

View File

@ -1026,7 +1026,7 @@ pacman -S --noconfirm --needed grub efibootmgr dosfstools
sed -e '/GRUB_SAVEDEFAULT/ s/^#*/#/' -i /etc/default/grub
# we need to tell grub where the zfs root is)";
const auto& mountpoint_source = utils::exec(fmt::format(FMT_COMPILE("findmnt -ln -o SOURCE {}"), mountpoint));
const auto& mountpoint_source = utils::get_mountpoint_source(mountpoint);
const auto& zroot_var = fmt::format(FMT_COMPILE("zroot=\"zfs={} rw\""), mountpoint_source);
constexpr auto bash_codepart2 = R"(
@ -1299,7 +1299,7 @@ pacman -S --noconfirm --needed grub os-prober
sed -e '/GRUB_SAVEDEFAULT/ s/^#*/#/' -i /etc/default/grub
# we need to tell grub where the zfs root is)";
const auto& mountpoint_source = utils::exec(fmt::format(FMT_COMPILE("findmnt -ln -o SOURCE {}"), mountpoint));
const auto& mountpoint_source = utils::get_mountpoint_source(mountpoint);
const auto& zroot_var = fmt::format(FMT_COMPILE("zroot=\"zfs={} rw\""), mountpoint_source);
constexpr auto bash_codepart2 = R"(
@ -1399,6 +1399,10 @@ std::string get_mountpoint_fs(const std::string_view& mountpoint) noexcept {
return utils::exec(fmt::format(FMT_COMPILE("findmnt -ln -o FSTYPE \"{}\""), mountpoint));
}
std::string get_mountpoint_source(const std::string_view& mountpoint) noexcept {
return utils::exec(fmt::format(FMT_COMPILE("findmnt -ln -o SOURCE \"{}\""), mountpoint));
}
std::string list_containing_crypt() noexcept {
return utils::exec("blkid | awk '/TYPE=\"crypto_LUKS\"/{print $1}' | sed 's/.$//'");
}

View File

@ -36,6 +36,7 @@ void set_root_password(const std::string_view& password) noexcept;
[[nodiscard]] bool check_base() noexcept;
[[nodiscard]] auto list_mounted() noexcept -> std::string;
[[nodiscard]] auto get_mountpoint_fs(const std::string_view& mountpoint) noexcept -> std::string;
[[nodiscard]] auto get_mountpoint_source(const std::string_view& mountpoint) noexcept -> std::string;
[[nodiscard]] auto list_containing_crypt() noexcept -> std::string;
[[nodiscard]] auto list_non_crypt() noexcept -> std::string;
void lvm_detect(std::optional<std::function<void()>> func_callback = std::nullopt) noexcept;