Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Bezos committed Oct 23, 2024
1 parent d230b54 commit a2194b0
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,35 +35,37 @@ int create_root(const std::string& target_drive) {
return std::system(("mkfs.btrfs -L sovietlinux /dev/" + target_drive + "2").c_str());
}

int mount_root() {
const char* source = "LABEL=sovietlinux";
const char* target = "/mnt";
int mount_root(std::string target) {
std::string source_str = "/dev/" + target + "2";
const char* source = source_str.c_str();
const char* mount_point = "/mnt";
const char* filesystemtype = "btrfs";
const char* options = "compress=zstd:3";

if (mount(source, target, filesystemtype, 0, options) != 0) {
if (mount(source, mount_point, filesystemtype, 0, options) != 0) {
std::cerr << "Failed to mount: " << std::strerror(errno) << std::endl;
return -1;
}

std::cout << "Successfully mounted " << source << " at " << target
std::cout << "Successfully mounted " << source << " at " << mount_point
<< " with options: " << options << std::endl;

return 0;
}

int mount_boot() {
const char* source = "LABEL=SOVIET-EFI";
const char* target = "/mnt/efi";
int mount_boot(std::string target) {
std::string source_str = "/dev/" + target + "1";
const char* source = source_str.c_str();
const char* mount_point = "/mnt/efi";
const char* filesystemtype = "vfat";
const char* options = "defaults";

if (mount(source, target, filesystemtype, 0, options) != 0) {
if (mount(source, mount_point, filesystemtype, 0, options) != 0) {
std::cerr << "Failed to mount: " << std::strerror(errno) << std::endl;
return -1;
}

std::cout << "Successfully mounted " << source << " at " << target
std::cout << "Successfully mounted " << source << " at " << mount_point
<< " with options: " << options << std::endl;

return 0;
Expand All @@ -79,8 +81,8 @@ void install_soviet(const std::string& target_drive,
partition_drive(target_drive);
create_boot(target_drive);
create_root(target_drive);
mount_root();
mount_boot();
mount_root(target_drive);
mount_boot(target_drive);
copyFiles("/run/rootfsbase/", "/mnt");
deleteFilesInDir("/mnt/efi/EFI/Linux/");
setupSystemd();
Expand Down

0 comments on commit a2194b0

Please sign in to comment.