UNPKG

penguins-eggs

Version:

A remaster system tool, compatible with Arch, Debian, Devuan, Ubuntu and others

41 lines (40 loc) 1.26 kB
/** * ./src/classes/ovary.d/produce.ts * penguins-eggs v.10.0.0 / ecmascript 2020 * author: Piero Proietti * email: piero.proietti@gmail.com * license: MIT */ // packages import fs from 'node:fs'; import shx from 'shelljs'; import path from 'path'; // interfaces // libraries // classes import Utils from './../utils.js'; // _dirname const __dirname = path.dirname(new URL(import.meta.url).pathname); /** * makeDotDisk */ export function makeDotDisk(info = '', mksquashfs = '', mkisofs = '') { if (this.verbose) { console.log('Ovary: makeDotDisk'); } const dotDisk = this.settings.iso_work + '.disk'; if (fs.existsSync(dotDisk)) { shx.rm('-rf', dotDisk); } shx.mkdir('-p', dotDisk); let text = `# Created at: ${Utils.formatDate(new Date())}\n`; text += `# penguins_eggs v. ${Utils.getPackageVersion()}\n`; // .disk/info fs.writeFileSync(dotDisk + '/info', text, 'utf-8'); shx.mkdir('-p', path.join(dotDisk, 'id')); fs.writeFileSync(path.join(dotDisk, '/id', this.uuid), this.uuid, 'utf-8'); // .disk/mksquashfs fs.writeFileSync(dotDisk + '/mksquashfs', text + mksquashfs, 'utf-8'); // .disk/mkisofs fs.writeFileSync(dotDisk + '/mkisofs', text + mkisofs, 'utf-8'); }