void BootConfig::on_install_clicked() { qDebug() << "do things"; ui->tabWidget->setCurrentIndex(1); thread = new DoInstall(); connect(thread,SIGNAL(start_install()),this,SLOT(start_install())); thread->device_path = ui->target->currentText(); thread->hostWindow = this; thread->start(); }
ret_code_t fumi_block_install(void) { SaHpiBankNumT banknum; if ( get_banknum( &banknum) != HPI_SHELL_OK ) { return HPI_SHELL_PARM_ERROR; } return start_install( Domain->sessionId, fumi_block_env.rptid, fumi_block_env.fuminum, banknum ); }
void DoInstall::run() { if (testing) device_path = "/dev/vda"; parted::Device dev(device_path); if (!dev.open()) { qDebug() << "unable to open disk"; } PartitionState state = do_test1(dev.dev, label_type::gpt); if (!dev.close()) { qDebug() << "unable to close disk"; } partition_drives(state); hostWindow->mounts.clear(); hostWindow->mounts.append(installer::MountPoint(state.root_path,"/mnt")); hostWindow->mounts.append(installer::MountPoint(state.boot_path,"/mnt/boot")); hostWindow->installer = new LibInstaller; if (!hostWindow->installer->mountPaths(hostWindow->mounts)) { qDebug() << "failed to mount all paths"; abort(); } QProcess::execute("nixos-generate-config --root /mnt"); QFile config("/mnt/etc/nixos/configuration.nix"); config.open(QFile::WriteOnly); QString cfg = QString("{ lib, config, pkgs, ...}:\n" "{\n" " imports = [\n" " ./hardware-configuration.nix\n" " <nixpkgs/nixos/modules/testing/test-instrumentation.nix>\n" " ];\n" " users.mutableUsers = false;\n" " boot.loader.grub.device = \"/dev/vda\";\n" "}"); QByteArray bytes = cfg.toLocal8Bit(); config.write(bytes.data(),bytes.size()); config.close(); emit start_install(); }