"use strict";
/**
 * penguins-eggs
 * krill modules: mlfs.ts
 * author: Piero Proietti
 * email: piero.proietti@gmail.com
 * license: MIT
 * https://stackoverflow.com/questions/23876782/how-do-i-split-a-typescript-class-into-multiple-files
 */
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../../lib/utils");
/**
* mkfs
*/
async function mkfs() {
    const result = true;
    if (this.efi) {
        await (0, utils_1.exec)(`mkdosfs -F 32 -I ${this.devices.efi.name} ${this.toNull}`, this.echo);
    }
    if (this.devices.boot.name !== 'none') {
        if (this.devices.boot.fsType === undefined) {
            this.devices.boot.fsType = 'ext2';
            this.devices.boot.mountPoint = '/boot';
        }
        await (0, utils_1.exec)(`mke2fs -Ft ${this.devices.boot.fsType} ${this.devices.boot.name} ${this.toNull}`, this.echo);
    }
    if (this.devices.root.name !== 'none') {
        await (0, utils_1.exec)(`mke2fs -Ft ${this.devices.root.fsType} ${this.devices.root.name} ${this.toNull}`, this.echo);
    }
    if (this.devices.data.name !== 'none') {
        await (0, utils_1.exec)(`mke2fs -Ft ${this.devices.data.fsType} ${this.devices.data.name} ${this.toNull}`, this.echo);
    }
    if (this.devices.swap.name !== 'none') {
        await (0, utils_1.exec)(`mkswap ${this.devices.swap.name} ${this.toNull}`, this.echo);
    }
    return result;
}
exports.default = mkfs;
