penguins-eggs 10.0.57 → 10.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/.oclif.manifest.json +8 -1
  2. package/README.md +35 -34
  3. package/addons/eggs/theme/livecd/grub.main.full.cfg +0 -6
  4. package/assets/config.cfg +30 -0
  5. package/conf/distros/buster/calamares/calamares-modules/cleanup/cleanup.sh +8 -1
  6. package/conf/distros/buster/calamares/modules/partition.yml +159 -23
  7. package/conf/distros/buster/calamares/modules/removeuser.yml +1 -1
  8. package/conf/exclude.list.d/master.list +1 -0
  9. package/conf/krill.yaml +8 -0
  10. package/dist/classes/distro.js +1 -1
  11. package/dist/classes/incubation/incubator.d/alpine.js +1 -1
  12. package/dist/classes/incubation/incubator.d/bionic.js +1 -1
  13. package/dist/classes/incubation/incubator.d/buster.js +1 -1
  14. package/dist/classes/incubation/incubator.d/noble.js +1 -1
  15. package/dist/classes/incubation/incubator.d/openmamba.js +1 -1
  16. package/dist/classes/incubation/incubator.d/opensuse.js +1 -1
  17. package/dist/classes/incubation/incubator.d/rolling.js +1 -1
  18. package/dist/classes/ovary.d/bind-live-fs.d.ts +18 -0
  19. package/dist/classes/ovary.d/bind-live-fs.js +185 -0
  20. package/dist/classes/ovary.d/bind-vfs.d.ts +17 -0
  21. package/dist/classes/ovary.d/bind-vfs.js +37 -0
  22. package/dist/classes/ovary.d/create-xdg-autostart.d.ts +13 -0
  23. package/dist/classes/ovary.d/create-xdg-autostart.js +194 -0
  24. package/dist/classes/ovary.d/edit-live-fs.d.ts +19 -0
  25. package/dist/classes/ovary.d/edit-live-fs.js +249 -0
  26. package/dist/classes/ovary.d/fertilization.d.ts +12 -0
  27. package/dist/classes/ovary.d/fertilization.js +46 -0
  28. package/dist/classes/ovary.d/finished.d.ts +13 -0
  29. package/dist/classes/ovary.d/finished.js +41 -0
  30. package/dist/classes/ovary.d/initrd.d.ts +21 -0
  31. package/dist/classes/ovary.d/initrd.js +72 -0
  32. package/dist/classes/ovary.d/kernel-copy.d.ts +12 -0
  33. package/dist/classes/ovary.d/kernel-copy.js +36 -0
  34. package/dist/classes/ovary.d/live-create-structure.d.ts +12 -0
  35. package/dist/classes/ovary.d/live-create-structure.js +90 -0
  36. package/dist/classes/ovary.d/make-dot-disk.d.ts +12 -0
  37. package/dist/classes/ovary.d/make-dot-disk.js +40 -0
  38. package/dist/classes/ovary.d/make-efi.d.ts +12 -0
  39. package/dist/classes/ovary.d/make-efi.js +268 -0
  40. package/dist/classes/ovary.d/make-iso.d.ts +13 -0
  41. package/dist/classes/ovary.d/make-iso.js +45 -0
  42. package/dist/classes/ovary.d/make-squashfs.d.ts +18 -0
  43. package/dist/classes/ovary.d/make-squashfs.js +117 -0
  44. package/dist/classes/ovary.d/merged.d.ts +31 -0
  45. package/dist/classes/ovary.d/merged.js +87 -0
  46. package/dist/classes/ovary.d/produce.d.ts +23 -0
  47. package/dist/classes/ovary.d/produce.js +287 -0
  48. package/dist/classes/ovary.d/rexec.d.ts +13 -0
  49. package/dist/classes/ovary.d/rexec.js +34 -0
  50. package/dist/classes/ovary.d/syslinux.d.ts +12 -0
  51. package/dist/classes/ovary.d/syslinux.js +79 -0
  52. package/dist/classes/ovary.d/user-create-live.d.ts +14 -0
  53. package/dist/classes/ovary.d/user-create-live.js +86 -0
  54. package/dist/classes/ovary.d/users-remove.d.ts +9 -0
  55. package/dist/classes/ovary.d/users-remove.js +38 -0
  56. package/dist/classes/ovary.d/xorriso-commend.d.ts +14 -0
  57. package/dist/classes/ovary.d/xorriso-commend.js +119 -0
  58. package/dist/classes/ovary.d.ts +46 -167
  59. package/dist/classes/ovary.js +49 -1818
  60. package/dist/classes/pacman.d/archlinux.js +2 -1
  61. package/dist/classes/settings.d.ts +0 -1
  62. package/dist/classes/settings.js +2 -2
  63. package/dist/classes/utils.d.ts +6 -5
  64. package/dist/classes/utils.js +10 -16
  65. package/dist/commands/install.d.ts +1 -0
  66. package/dist/commands/install.js +7 -4
  67. package/dist/commands/kill.js +1 -1
  68. package/dist/commands/status.js +1 -1
  69. package/dist/commands/update.js +3 -3
  70. package/dist/interfaces/i-luks-passphrase.d.ts +11 -0
  71. package/dist/interfaces/i-luks-passphrase.js +8 -0
  72. package/dist/interfaces/index.d.ts +1 -0
  73. package/dist/{classes → krill/classes}/cfs.js +1 -1
  74. package/dist/krill/classes/krill_enums.d.ts +24 -0
  75. package/dist/krill/classes/krill_enums.js +26 -0
  76. package/dist/krill/classes/prepare.d/confirm.d.ts +5 -0
  77. package/dist/krill/classes/prepare.d/confirm.js +30 -0
  78. package/dist/krill/classes/prepare.d/keyboard.d.ts +14 -0
  79. package/dist/krill/classes/prepare.d/keyboard.js +62 -0
  80. package/dist/krill/classes/prepare.d/location.d.ts +17 -0
  81. package/dist/krill/classes/prepare.d/location.js +59 -0
  82. package/dist/krill/classes/prepare.d/network.d.ts +14 -0
  83. package/dist/krill/classes/prepare.d/network.js +68 -0
  84. package/dist/krill/classes/prepare.d/partitions.d.ts +14 -0
  85. package/dist/krill/classes/prepare.d/partitions.js +86 -0
  86. package/dist/krill/classes/prepare.d/summary.d.ts +15 -0
  87. package/dist/krill/classes/prepare.d/summary.js +69 -0
  88. package/dist/krill/classes/prepare.d/users.d.ts +6 -0
  89. package/dist/krill/classes/prepare.d/users.js +63 -0
  90. package/dist/krill/classes/prepare.d/welcome.d.ts +6 -0
  91. package/dist/krill/classes/prepare.d/welcome.js +30 -0
  92. package/dist/krill/{prepare.d.ts → classes/prepare.d.ts} +21 -35
  93. package/dist/krill/classes/prepare.js +314 -0
  94. package/dist/krill/{modules/add-user.js → classes/sequence.d/add_user.js} +1 -1
  95. package/dist/krill/{modules → classes/sequence.d}/bootloader.d.ts +1 -1
  96. package/dist/krill/{modules → classes/sequence.d}/bootloader.js +3 -3
  97. package/dist/krill/{modules/bootloader-config.js → classes/sequence.d/bootloader_config.js} +2 -2
  98. package/dist/krill/{modules/change-password.js → classes/sequence.d/change_password.js} +1 -1
  99. package/dist/krill/{modules/del-live-user.js → classes/sequence.d/del_live_user.js} +2 -2
  100. package/dist/krill/{modules → classes/sequence.d}/fstab.d.ts +1 -1
  101. package/dist/krill/{modules → classes/sequence.d}/fstab.js +75 -14
  102. package/dist/krill/{modules → classes/sequence.d}/grubcfg.d.ts +1 -1
  103. package/dist/krill/{modules → classes/sequence.d}/grubcfg.js +6 -2
  104. package/dist/krill/{modules → classes/sequence.d}/hostname.d.ts +1 -1
  105. package/dist/krill/{modules → classes/sequence.d}/initramfs.d.ts +1 -1
  106. package/dist/krill/{modules → classes/sequence.d}/initramfs.js +2 -2
  107. package/dist/krill/classes/sequence.d/initramfs_cfg.js +35 -0
  108. package/dist/krill/{modules → classes/sequence.d}/locale.d.ts +1 -1
  109. package/dist/krill/{modules → classes/sequence.d}/locale.js +2 -2
  110. package/dist/krill/{modules/m-keyboard.js → classes/sequence.d/m_keyboard.js} +2 -2
  111. package/dist/krill/{modules/machine-id.js → classes/sequence.d/machine_id.js} +2 -2
  112. package/dist/krill/{modules → classes/sequence.d}/mkfs.d.ts +1 -1
  113. package/dist/krill/{modules → classes/sequence.d}/mkfs.js +24 -2
  114. package/dist/krill/{modules/mount-fs.js → classes/sequence.d/mount_fs.js} +9 -3
  115. package/dist/krill/{modules/mount-vfs.js → classes/sequence.d/mount_vfs.js} +1 -1
  116. package/dist/krill/{modules/network-cfg.js → classes/sequence.d/network_cfg.js} +15 -6
  117. package/dist/krill/{modules → classes/sequence.d}/packages.d.ts +1 -1
  118. package/dist/krill/{modules → classes/sequence.d}/packages.js +3 -3
  119. package/dist/krill/{modules/partition.d.ts → classes/sequence.d/partition.d/bios_luks.d.ts} +4 -7
  120. package/dist/krill/classes/sequence.d/partition.d/bios_luks.js +73 -0
  121. package/dist/krill/classes/sequence.d/partition.d/bios_standard.d.ts +17 -0
  122. package/dist/krill/classes/sequence.d/partition.d/bios_standard.js +36 -0
  123. package/dist/krill/classes/sequence.d/partition.d/uefi_luks.d.ts +17 -0
  124. package/dist/krill/classes/sequence.d/partition.d/uefi_luks.js +78 -0
  125. package/dist/krill/classes/sequence.d/partition.d/uefi_standard.d.ts +10 -0
  126. package/dist/krill/classes/sequence.d/partition.d/uefi_standard.js +32 -0
  127. package/dist/krill/classes/sequence.d/partition.d.ts +14 -0
  128. package/dist/krill/classes/sequence.d/partition.js +84 -0
  129. package/dist/krill/{modules → classes/sequence.d}/umount.d.ts +1 -1
  130. package/dist/krill/{modules → classes/sequence.d}/umount.js +2 -2
  131. package/dist/krill/{modules → classes/sequence.d}/unpackfs.d.ts +1 -1
  132. package/dist/krill/{modules → classes/sequence.d}/unpackfs.js +2 -2
  133. package/dist/krill/{sequence.d.ts → classes/sequence.d.ts} +40 -58
  134. package/dist/krill/{sequence.js → classes/sequence.js} +43 -32
  135. package/dist/{components → krill/components}/information.js +3 -3
  136. package/dist/{components → krill/components}/keyboard.js +1 -1
  137. package/dist/{components → krill/components}/location.js +1 -1
  138. package/dist/{components → krill/components}/network.js +1 -1
  139. package/dist/{components → krill/components}/partitions.d.ts +4 -2
  140. package/dist/{components → krill/components}/partitions.js +36 -20
  141. package/dist/{components → krill/components}/summary.d.ts +2 -1
  142. package/dist/{components → krill/components}/summary.js +2 -6
  143. package/dist/{components → krill/components}/title.js +1 -1
  144. package/dist/{components → krill/components}/users.js +1 -1
  145. package/dist/{components → krill/components}/welcome.js +1 -1
  146. package/dist/{interfaces/i-krill.d.ts → krill/interfaces/i_krill.d.ts} +3 -1
  147. package/dist/{interfaces/i-krill-config.d.ts → krill/interfaces/i_krill_config.d.ts} +3 -1
  148. package/dist/krill/lib/get_luks_passphrase.d.ts +8 -0
  149. package/dist/krill/lib/get_luks_passphrase.js +40 -0
  150. package/dist/{lib → krill/lib}/kill_me_softly.js +2 -2
  151. package/dist/{lib → krill/lib}/select_filesystem_type.js +2 -9
  152. package/dist/{lib → krill/lib}/select_installation_device.js +10 -4
  153. package/dist/{lib → krill/lib}/select_installation_mode.d.ts +2 -1
  154. package/dist/{lib → krill/lib}/select_installation_mode.js +2 -1
  155. package/dist/{lib → krill/lib}/select_keyboard_layout.js +1 -1
  156. package/dist/{lib → krill/lib}/select_keyboard_model.js +1 -1
  157. package/dist/{lib → krill/lib}/select_keyboard_option.js +1 -1
  158. package/dist/{lib → krill/lib}/select_keyboard_variant.js +1 -1
  159. package/dist/{lib → krill/lib}/select_languages.js +1 -1
  160. package/dist/krill/lib/select_replaced_partition.d.ts +8 -0
  161. package/dist/krill/lib/select_replaced_partition.js +31 -0
  162. package/dist/{lib → krill/lib}/select_user_swap_choice.d.ts +2 -1
  163. package/dist/{lib → krill/lib}/select_user_swap_choice.js +4 -3
  164. package/dist/lib/utils.d.ts +8 -0
  165. package/dist/lib/utils.js +8 -0
  166. package/package.json +25 -24
  167. package/scripts/_eggs +7 -5
  168. package/scripts/eggs.bash +3 -3
  169. package/dist/krill/modules/initramfs-cfg.js +0 -22
  170. package/dist/krill/modules/partition.js +0 -345
  171. package/dist/krill/prepare.js +0 -626
  172. /package/dist/{index-old.d.ts → index_old.d.ts} +0 -0
  173. /package/dist/{index-old.js → index_old.js} +0 -0
  174. /package/dist/{classes → krill/classes}/cfs.d.ts +0 -0
  175. /package/dist/krill/{modules/add-user.d.ts → classes/sequence.d/add_user.d.ts} +0 -0
  176. /package/dist/krill/{modules/bootloader-config.d.ts → classes/sequence.d/bootloader_config.d.ts} +0 -0
  177. /package/dist/krill/{modules/change-password.d.ts → classes/sequence.d/change_password.d.ts} +0 -0
  178. /package/dist/krill/{modules/del-live-user.d.ts → classes/sequence.d/del_live_user.d.ts} +0 -0
  179. /package/dist/krill/{modules → classes/sequence.d}/hostname.js +0 -0
  180. /package/dist/krill/{modules/initramfs-cfg.d.ts → classes/sequence.d/initramfs_cfg.d.ts} +0 -0
  181. /package/dist/krill/{modules/locale-cfg.d.ts → classes/sequence.d/locale_cfg.d.ts} +0 -0
  182. /package/dist/krill/{modules/locale-cfg.js → classes/sequence.d/locale_cfg.js} +0 -0
  183. /package/dist/krill/{modules/m-keyboard.d.ts → classes/sequence.d/m_keyboard.d.ts} +0 -0
  184. /package/dist/krill/{modules/machine-id.d.ts → classes/sequence.d/machine_id.d.ts} +0 -0
  185. /package/dist/krill/{modules/mount-fs.d.ts → classes/sequence.d/mount_fs.d.ts} +0 -0
  186. /package/dist/krill/{modules/mount-vfs.d.ts → classes/sequence.d/mount_vfs.d.ts} +0 -0
  187. /package/dist/krill/{modules/network-cfg.d.ts → classes/sequence.d/network_cfg.d.ts} +0 -0
  188. /package/dist/krill/{modules/remove-installer-link.d.ts → classes/sequence.d/remove_installer_link.d.ts} +0 -0
  189. /package/dist/krill/{modules/remove-installer-link.js → classes/sequence.d/remove_installer_link.js} +0 -0
  190. /package/dist/{components → krill/components}/finished.d.ts +0 -0
  191. /package/dist/{components → krill/components}/finished.js +0 -0
  192. /package/dist/{components → krill/components}/information.d.ts +0 -0
  193. /package/dist/{components → krill/components}/install.d.ts +0 -0
  194. /package/dist/{components → krill/components}/install.js +0 -0
  195. /package/dist/{components → krill/components}/keyboard.d.ts +0 -0
  196. /package/dist/{components → krill/components}/location.d.ts +0 -0
  197. /package/dist/{components → krill/components}/network.d.ts +0 -0
  198. /package/dist/{components → krill/components}/steps.d.ts +0 -0
  199. /package/dist/{components → krill/components}/steps.js +0 -0
  200. /package/dist/{components → krill/components}/title.d.ts +0 -0
  201. /package/dist/{components → krill/components}/users.d.ts +0 -0
  202. /package/dist/{components → krill/components}/welcome.d.ts +0 -0
  203. /package/dist/{interfaces/i-krill.js → krill/interfaces/i_krill.js} +0 -0
  204. /package/dist/{interfaces/i-krill-config.js → krill/interfaces/i_krill_config.js} +0 -0
  205. /package/dist/{lib → krill/lib}/get_address.d.ts +0 -0
  206. /package/dist/{lib → krill/lib}/get_address.js +0 -0
  207. /package/dist/{lib → krill/lib}/get_dns.d.ts +0 -0
  208. /package/dist/{lib → krill/lib}/get_dns.js +0 -0
  209. /package/dist/{lib → krill/lib}/get_domain.d.ts +0 -0
  210. /package/dist/{lib → krill/lib}/get_domain.js +0 -0
  211. /package/dist/{lib → krill/lib}/get_gateway.d.ts +0 -0
  212. /package/dist/{lib → krill/lib}/get_gateway.js +0 -0
  213. /package/dist/{lib → krill/lib}/get_hostname.d.ts +0 -0
  214. /package/dist/{lib → krill/lib}/get_hostname.js +0 -0
  215. /package/dist/{lib → krill/lib}/get_netmask.d.ts +0 -0
  216. /package/dist/{lib → krill/lib}/get_netmask.js +0 -0
  217. /package/dist/{lib → krill/lib}/get_password.d.ts +0 -0
  218. /package/dist/{lib → krill/lib}/get_password.js +0 -0
  219. /package/dist/{lib → krill/lib}/get_userfullname.d.ts +0 -0
  220. /package/dist/{lib → krill/lib}/get_userfullname.js +0 -0
  221. /package/dist/{lib → krill/lib}/get_username.d.ts +0 -0
  222. /package/dist/{lib → krill/lib}/get_username.js +0 -0
  223. /package/dist/{lib → krill/lib}/kill_me_softly.d.ts +0 -0
  224. /package/dist/{lib → krill/lib}/select_address_type.d.ts +0 -0
  225. /package/dist/{lib → krill/lib}/select_address_type.js +0 -0
  226. /package/dist/{lib → krill/lib}/select_filesystem_type.d.ts +0 -0
  227. /package/dist/{lib → krill/lib}/select_installation_device.d.ts +0 -0
  228. /package/dist/{lib → krill/lib}/select_interface.d.ts +0 -0
  229. /package/dist/{lib → krill/lib}/select_interface.js +0 -0
  230. /package/dist/{lib → krill/lib}/select_keyboard_layout.d.ts +0 -0
  231. /package/dist/{lib → krill/lib}/select_keyboard_model.d.ts +0 -0
  232. /package/dist/{lib → krill/lib}/select_keyboard_option.d.ts +0 -0
  233. /package/dist/{lib → krill/lib}/select_keyboard_variant.d.ts +0 -0
  234. /package/dist/{lib → krill/lib}/select_languages.d.ts +0 -0
  235. /package/dist/{lib → krill/lib}/select_regions.d.ts +0 -0
  236. /package/dist/{lib → krill/lib}/select_regions.js +0 -0
  237. /package/dist/{lib → krill/lib}/select_zones.d.ts +0 -0
  238. /package/dist/{lib → krill/lib}/select_zones.js +0 -0
@@ -0,0 +1,287 @@
1
+ /**
2
+ * ./src/classes/ovary.d/produce.ts
3
+ * penguins-eggs v.10.0.0 / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
7
+ */
8
+ import chalk from 'chalk';
9
+ import mustache from 'mustache';
10
+ // packages
11
+ import fs from 'node:fs';
12
+ import shx from 'shelljs';
13
+ import path from 'path';
14
+ // libraries
15
+ import { exec } from '../../lib/utils.js';
16
+ import Bleach from './../bleach.js';
17
+ import { displaymanager } from './../incubation/fisherman-helper/displaymanager.js';
18
+ import Incubator from './../incubation/incubator.js';
19
+ import Pacman from './../pacman.js';
20
+ import Diversions from './../diversions.js';
21
+ // classes
22
+ import Utils from './../utils.js';
23
+ import Repo from './../yolk.js';
24
+ // _dirname
25
+ const __dirname = path.dirname(new URL(import.meta.url).pathname);
26
+ /**
27
+ * produce
28
+ * @param clone
29
+ * @param cryptedclone
30
+ * @param scriptOnly
31
+ * @param yolkRenew
32
+ * @param release
33
+ * @param myAddons
34
+ * @param nointeractive
35
+ * @param noicons
36
+ * @param unsecure
37
+ * @param verbose
38
+ */
39
+ export async function produce(clone = false, cryptedclone = false, scriptOnly = false, yolkRenew = false, release = false, myAddons, myLinks, excludes, nointeractive = false, noicons = false, unsecure = false, verbose = false) {
40
+ this.verbose = verbose;
41
+ this.echo = Utils.setEcho(verbose);
42
+ if (this.verbose) {
43
+ this.toNull = ' > /dev/null 2>&1';
44
+ }
45
+ this.clone = clone;
46
+ this.cryptedclone = cryptedclone;
47
+ const luksName = 'luks-volume';
48
+ const luksFile = `/tmp/${luksName}`;
49
+ if (this.familyId === 'debian' && Utils.uefiArch() === 'amd64') {
50
+ const yolk = new Repo();
51
+ if (!yolk.exists()) {
52
+ Utils.warning('creating yolk');
53
+ await yolk.create(verbose);
54
+ }
55
+ else if (yolkRenew) {
56
+ Utils.warning('refreshing yolk');
57
+ await yolk.erase();
58
+ await yolk.create(verbose);
59
+ }
60
+ else {
61
+ Utils.warning('using preesixent yolk');
62
+ }
63
+ }
64
+ if (!fs.existsSync(this.settings.config.snapshot_dir)) {
65
+ shx.mkdir('-p', this.settings.config.snapshot_dir);
66
+ }
67
+ if (Utils.isLive()) {
68
+ console.log(chalk.red('>>> eggs: This is a live system! An egg cannot be produced from an egg!'));
69
+ }
70
+ else {
71
+ await this.liveCreateStructure();
72
+ // Carica calamares sono se le icone sono accettate
73
+ if (!noicons && // se VOGLIO le icone
74
+ !nointeractive &&
75
+ this.settings.distro.isCalamaresAvailable &&
76
+ Pacman.isInstalledGui() &&
77
+ this.settings.config.force_installer &&
78
+ !Pacman.calamaresExists()) {
79
+ console.log('Installing ' + chalk.bgGray('calamares') + ' due force_installer=yes.');
80
+ await Pacman.calamaresInstall(verbose);
81
+ const bleach = new Bleach();
82
+ await bleach.clean(verbose);
83
+ }
84
+ if (cryptedclone) {
85
+ /**
86
+ * cryptedclone
87
+ */
88
+ console.log("eggs will SAVE users and users' data ENCRYPTED");
89
+ /*
90
+ const users = await this.usersFill()
91
+ for (const user of users) {
92
+ if (user.saveIt) {
93
+ let utype = 'user '
94
+ if (Number.parseInt(user.uid) < 1000) {
95
+ utype = 'service'
96
+ }
97
+ //console.log(`- ${utype}: ${user.login.padEnd(16)} \thome: ${user.home}`)
98
+ if (user.login !== 'root') {
99
+ this.addRemoveExclusion(true, user.home)
100
+ }
101
+ }
102
+ }
103
+ */
104
+ }
105
+ else if (this.clone) {
106
+ /**
107
+ * clone
108
+ *
109
+ * users tend to set user_opt as
110
+ * real user when create a clone,
111
+ * this is WRONG here we correct
112
+ */
113
+ this.settings.config.user_opt = 'live'; // patch for humans
114
+ this.settings.config.user_opt_passwd = 'evolution';
115
+ this.settings.config.root_passwd = 'evolution';
116
+ Utils.warning("eggs will SAVE users and users' data UNCRYPTED on the live");
117
+ }
118
+ else {
119
+ /**
120
+ * normal
121
+ */
122
+ Utils.warning("eggs will REMOVE users and users' data from live");
123
+ }
124
+ /**
125
+ * exclude.list
126
+ */
127
+ if (!excludes.static && !fs.existsSync('/etc/penguins-eggs/exclude.list')) {
128
+ const excludeListTemplateDir = '/etc/penguins-eggs.d/exclude.list.d/';
129
+ const excludeListTemplate = excludeListTemplateDir + 'master.list';
130
+ if (!fs.existsSync(excludeListTemplate)) {
131
+ Utils.warning('Cannot find: ' + excludeListTemplate);
132
+ process.exit(1);
133
+ }
134
+ let excludeUsr = '';
135
+ let excludeVar = '';
136
+ let excludeHomes = '';
137
+ let excludeHome = '';
138
+ if (excludes.usr) {
139
+ excludeUsr = fs.readFileSync(`${excludeListTemplateDir}usr.list`, 'utf8');
140
+ }
141
+ if (excludes.var) {
142
+ excludeVar = fs.readFileSync(`${excludeListTemplateDir}var.list`, 'utf8');
143
+ }
144
+ if (excludes.homes) {
145
+ excludeHomes = fs.readFileSync(`${excludeListTemplateDir}homes.list`, 'utf8');
146
+ }
147
+ if (excludes.home) {
148
+ excludeHome = `home/${await Utils.getPrimaryUser()}/*`;
149
+ }
150
+ const view = {
151
+ home_list: excludeHome,
152
+ homes_list: excludeHomes,
153
+ usr_list: excludeUsr,
154
+ var_list: excludeVar
155
+ };
156
+ const template = fs.readFileSync(excludeListTemplate, 'utf8');
157
+ fs.writeFileSync(this.settings.config.snapshot_excludes, mustache.render(template, view));
158
+ }
159
+ /**
160
+ * NOTE: reCreate = false
161
+ *
162
+ * reCreate = false is just for develop
163
+ * put reCreate = true in release
164
+ */
165
+ const reCreate = true;
166
+ let mksquashfsCmd = '';
167
+ if (reCreate) {
168
+ // start pre-clone
169
+ /**
170
+ * installer
171
+ */
172
+ this.incubator = new Incubator(this.settings.remix, this.settings.distro, this.settings.config.user_opt, this.theme, this.clone, verbose);
173
+ await this.incubator.config(release);
174
+ await this.syslinux(this.theme);
175
+ //await this.isolinux(this.theme)
176
+ await this.kernelCopy();
177
+ /**
178
+ * differents initfs for different families
179
+ */
180
+ if (this.familyId === 'alpine') {
181
+ await this.initrdAlpine();
182
+ }
183
+ else if (this.familyId === 'archlinux') {
184
+ await this.initrdArch();
185
+ }
186
+ else if (this.familyId === 'debian') {
187
+ await this.initrdDebian();
188
+ }
189
+ else if (this.familyId === 'aldos' ||
190
+ this.familyId === 'fedora' ||
191
+ this.familyId === 'openmamba' ||
192
+ this.familyId === 'opensuse' ||
193
+ this.familyId === 'voidlinux') {
194
+ await this.initrdDracut();
195
+ }
196
+ if (this.settings.config.make_efi) {
197
+ await this.makeEfi(this.theme);
198
+ }
199
+ await this.bindLiveFs();
200
+ if (!this.clone) {
201
+ /**
202
+ * ANCHE per cryptedclone
203
+ */
204
+ await this.usersRemove();
205
+ await this.userCreateLive();
206
+ if (Pacman.isInstalledGui()) {
207
+ await this.createXdgAutostart(this.settings.config.theme, myAddons, myLinks, noicons);
208
+ /**
209
+ * GUI installed but NOT Desktop Manager: just create motd and issue
210
+ */
211
+ if (displaymanager().length > 0) {
212
+ this.cliAutologin.addIssue(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
213
+ this.cliAutologin.addMotd(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
214
+ }
215
+ }
216
+ else {
217
+ this.cliAutologin.add(this.settings.distro.distroId, this.settings.distro.codenameId, this.settings.config.user_opt, this.settings.config.user_opt_passwd, this.settings.config.root_passwd, this.settings.work_dir.merged);
218
+ }
219
+ }
220
+ await this.editLiveFs(clone, cryptedclone);
221
+ mksquashfsCmd = await this.makeSquashfs(scriptOnly, unsecure);
222
+ await this.uBindLiveFs(); // Lo smonto prima della fase di backup
223
+ }
224
+ if (cryptedclone) {
225
+ let synctoCmd = `eggs syncto -f ${luksFile}`;
226
+ if (excludes.home) {
227
+ synctoCmd += ' --excludes'; // from Marco, usa home.list
228
+ }
229
+ await exec(synctoCmd, Utils.setEcho(true));
230
+ Utils.warning(`moving ${luksFile} in ${this.nest}iso/live`);
231
+ await exec(`mv ${luksFile} ${this.nest}iso/live`, this.echo);
232
+ }
233
+ const mkIsofsCmd = (await this.xorrisoCommand(clone, cryptedclone)).replaceAll(/\s\s+/g, ' ');
234
+ this.makeDotDisk(this.volid, mksquashfsCmd, mkIsofsCmd);
235
+ /**
236
+ * AntiX/MX LINUX
237
+ */
238
+ if (fs.existsSync('/etc/antix-version')) {
239
+ let uname = (await exec('uname -r', { capture: true })).data;
240
+ uname = uname.replaceAll('\n', '');
241
+ let content = '';
242
+ content = '#!/usr/bin/env bash';
243
+ content += 'mkdir /live/bin -p\n';
244
+ content += '## \n';
245
+ content += '# cp /usr/lib/penguins-eggs/scripts/non-live-cmdline /live/bin -p\n';
246
+ content += '# chmod +x /live/bin/non-live-cmdline\n';
247
+ content += '## \n';
248
+ content += 'mkdir /live/boot-dev/antiX -p\n';
249
+ content += 'ln -s /run/live/medium/live/filesystem.squashfs /live/boot-dev/antiX/linuxfs\n';
250
+ content += `ln -s /run/live/medium/live/initrd.img-${uname} /live/boot-dev/antiX/initrd.gz\n`;
251
+ content += `ln -s /run/live/medium/live/vmlinuz-${uname} /live/boot-dev/antiX/vmlinuz\n`;
252
+ content += `# md5sum /live/boot-dev/antiX/linuxfs > /live/boot-dev/antiX/linuxfs.md5\n`;
253
+ content += `# md5sum /live/boot-dev/antiX/initrd.gz > /live/boot-dev/antiX/initrd.gz.md5\n`;
254
+ content += `# md5sum /live/boot-dev/antiX/vmlinuz > /live/boot-dev/antiX/vmlinuz.md5\n`;
255
+ content += `# /live/aufs -> /run/live/rootfs/filesystem.squashfs\n`;
256
+ content += 'ln -s /run/live/rootfs/filesystem.squashfs /live/aufs\n';
257
+ content += `# use: minstall -no-media-check\n`;
258
+ content += 'minstall --no-media-check\n';
259
+ const file = `${this.settings.iso_work}antix-mx-installer`;
260
+ fs.writeFileSync(file, content);
261
+ await exec(`chmod +x ${file}`);
262
+ }
263
+ /**
264
+ * patch to emulate miso/archiso on archilinux family
265
+ */
266
+ if (this.familyId === 'archlinux') {
267
+ let pathName = `arch/x86_64/airootfs`;
268
+ let hashCmd = 'sha512sum';
269
+ let hashExt = '.sha512';
270
+ if (Diversions.isManjaroBased(this.settings.distro.distroId)) {
271
+ pathName = `manjaro/x86_64/livefs`;
272
+ hashCmd = `md5sum`;
273
+ hashExt = '.md5';
274
+ }
275
+ await exec(`mkdir ${this.settings.iso_work}${pathName}/x86_64 -p`, this.echo);
276
+ fs.linkSync(`${this.settings.iso_work}live/filesystem.squashfs`, `${this.settings.iso_work}${pathName}.sfs`);
277
+ }
278
+ /**
279
+ * patch per aldos
280
+ if (this.familyId === 'aldos') {
281
+ await exec(`mkdir ${this.settings.iso_work}LiveOS -p`, this.echo)
282
+ fs.linkSync(`${this.settings.iso_work}live/filesystem.squashfs`, `${this.settings.iso_work}LiveOS/squashfs.img`)
283
+ }
284
+ */
285
+ await this.makeIso(mkIsofsCmd, scriptOnly);
286
+ }
287
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ./src/classes/ovary.d/initrd-arch.ts
3
+ * penguins-eggs v.10.0.0 / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
7
+ */
8
+ /**
9
+ *
10
+ * @param cmd
11
+ * @param echo
12
+ */
13
+ export default function rexec(cmd: string, verbose?: boolean): Promise<string>;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * ./src/classes/ovary.d/initrd-arch.ts
3
+ * penguins-eggs v.10.0.0 / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
7
+ */
8
+ // packages
9
+ import path from 'node:path';
10
+ import chalk from 'chalk';
11
+ // classes
12
+ import { exec } from '../../lib/utils.js';
13
+ import Utils from '../utils.js';
14
+ // _dirname
15
+ const __dirname = path.dirname(new URL(import.meta.url).pathname);
16
+ /**
17
+ *
18
+ * @param cmd
19
+ * @param echo
20
+ */
21
+ export default async function rexec(cmd, verbose = false) {
22
+ if (verbose) {
23
+ console.log(`Ovary: rexec(${cmd})`);
24
+ }
25
+ const echo = Utils.setEcho(verbose);
26
+ /**
27
+ * skip umount errors
28
+ */
29
+ const check = await exec(cmd, echo);
30
+ if (!cmd.startsWith('umount') && check.code !== 0) {
31
+ console.log(`eggs >>> error on command: ` + chalk.cyan(cmd) + ', code: ' + chalk.cyan(check.code));
32
+ }
33
+ return cmd;
34
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * ./src/classes/ovary.d/produce.ts
3
+ * penguins-eggs v.10.0.0 / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
7
+ */
8
+ import Ovary from './../ovary.js';
9
+ /**
10
+ * syslinux: da syspath
11
+ */
12
+ export declare function syslinux(this: Ovary, theme?: string): Promise<void>;
@@ -0,0 +1,79 @@
1
+ /**
2
+ * ./src/classes/ovary.d/produce.ts
3
+ * penguins-eggs v.10.0.0 / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
7
+ */
8
+ import mustache from 'mustache';
9
+ // packages
10
+ import fs from 'node:fs';
11
+ import path from 'node:path';
12
+ // backup
13
+ // interfaces
14
+ // libraries
15
+ import { exec } from '../../lib/utils.js';
16
+ import Diversions from './../diversions.js';
17
+ import Utils from './../utils.js';
18
+ // _dirname
19
+ const __dirname = path.dirname(new URL(import.meta.url).pathname);
20
+ /**
21
+ * syslinux: da syspath
22
+ */
23
+ export async function syslinux(theme = 'eggs') {
24
+ let syspath = path.resolve(__dirname, `../../../syslinux`);
25
+ await exec(`cp ${syspath}/chain.c32 ${this.settings.iso_work}/isolinux/`, this.echo);
26
+ await exec(`cp ${syspath}/isohdpfx.bin ${this.settings.iso_work}/isolinux/`, this.echo);
27
+ // just fo x64 arch
28
+ await exec(`cp ${syspath}/isolinux.bin ${this.settings.iso_work}/isolinux/`, this.echo);
29
+ await exec(`cp ${syspath}/ldlinux.c32 ${this.settings.iso_work}/isolinux/`, this.echo);
30
+ await exec(`cp ${syspath}/libcom32.c32 ${this.settings.iso_work}/isolinux/`, this.echo);
31
+ await exec(`cp ${syspath}/libutil.c32 ${this.settings.iso_work}/isolinux/`, this.echo);
32
+ await exec(`cp ${syspath}/vesamenu.c32 ${this.settings.iso_work}/isolinux/`, this.echo);
33
+ const isolinuxThemeDest = this.settings.iso_work + 'isolinux/isolinux.theme.cfg';
34
+ let isolinuxThemeSrc = path.resolve(__dirname, `../../../addons/${theme}/theme/livecd/isolinux.theme.cfg`);
35
+ if (this.theme.includes('/')) {
36
+ isolinuxThemeSrc = `${theme}/theme/livecd/isolinux.theme.cfg`;
37
+ }
38
+ if (!fs.existsSync(isolinuxThemeSrc)) {
39
+ Utils.warning('Cannot find: ' + isolinuxThemeSrc);
40
+ process.exit();
41
+ }
42
+ fs.copyFileSync(isolinuxThemeSrc, isolinuxThemeDest);
43
+ /**
44
+ * isolinux.cfg from isolinux.main.cfg
45
+ */
46
+ const isolinuxDest = `${this.settings.iso_work}/isolinux/isolinux.cfg`;
47
+ this.settings.iso_work + 'isolinux/isolinux.cfg';
48
+ let isolinuxTemplate = `${theme}/theme/livecd/isolinux.main.cfg`;
49
+ if (!fs.existsSync(isolinuxTemplate)) {
50
+ isolinuxTemplate = path.resolve(__dirname, '../../../addons/eggs/theme/livecd/isolinux.main.cfg');
51
+ }
52
+ if (!fs.existsSync(isolinuxTemplate)) {
53
+ Utils.warning('Cannot find: ' + isolinuxTemplate);
54
+ process.exit();
55
+ }
56
+ const kernel_parameters = Diversions.kernelParameters(this.familyId, this.volid); // this.kernelParameters()
57
+ const template = fs.readFileSync(isolinuxTemplate, 'utf8');
58
+ const view = {
59
+ fullname: this.settings.remix.fullname.toUpperCase(),
60
+ initrdImg: `/live${this.settings.initrdImg}`,
61
+ kernel: Utils.kernelVersion(),
62
+ kernel_parameters,
63
+ vmlinuz: `/live${this.settings.vmlinuz}`
64
+ };
65
+ fs.writeFileSync(isolinuxDest, mustache.render(template, view));
66
+ /**
67
+ * splash
68
+ */
69
+ const splashDest = `${this.settings.iso_work}/isolinux/splash.png`;
70
+ let splashSrc = path.resolve(__dirname, `../../../addons/${theme}/theme/livecd/splash.png`);
71
+ if (this.theme.includes('/')) {
72
+ splashSrc = path.resolve(`${theme}/theme/livecd/splash.png`);
73
+ }
74
+ if (!fs.existsSync(splashSrc)) {
75
+ Utils.warning('Cannot find: ' + splashSrc);
76
+ process.exit();
77
+ }
78
+ fs.copyFileSync(splashSrc, splashDest);
79
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * ./src/classes/ovary.d/create-user-live.ts
3
+ * penguins-eggs v.10.0.0 / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
7
+ */
8
+ import Ovary from '../ovary.js';
9
+ /**
10
+ * list degli utenti: grep -E 1[0-9]{3} /etc/passwd | sed s/:/\ / | awk '{print $1}'
11
+ * create la home per user_opt
12
+ * @param verbose
13
+ */
14
+ export declare function userCreateLive(this: Ovary): Promise<void>;
@@ -0,0 +1,86 @@
1
+ /**
2
+ * ./src/classes/ovary.d/create-user-live.ts
3
+ * penguins-eggs v.10.0.0 / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
7
+ */
8
+ // packages
9
+ import fs from 'fs';
10
+ import path from 'node:path';
11
+ import yaml from 'js-yaml';
12
+ // functions
13
+ import rexec from './rexec.js';
14
+ // _dirname
15
+ const __dirname = path.dirname(new URL(import.meta.url).pathname);
16
+ /**
17
+ * list degli utenti: grep -E 1[0-9]{3} /etc/passwd | sed s/:/\ / | awk '{print $1}'
18
+ * create la home per user_opt
19
+ * @param verbose
20
+ */
21
+ export async function userCreateLive() {
22
+ if (this.verbose) {
23
+ console.log('Ovary: userCreateLive');
24
+ }
25
+ const cmds = [];
26
+ cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' rm /home/' + this.settings.config.user_opt + ' -rf', this.verbose));
27
+ cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' mkdir /home/' + this.settings.config.user_opt, this.verbose));
28
+ // Create user using useradd
29
+ cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' useradd ' + this.settings.config.user_opt + ' --home-dir /home/' + this.settings.config.user_opt + ' --shell /bin/bash ', this.verbose));
30
+ // live password
31
+ cmds.push(await rexec('echo ' + this.settings.config.user_opt + ':' + this.settings.config.user_opt_passwd + ' | chroot ' + this.settings.work_dir.merged + ' chpasswd', this.verbose));
32
+ // root password
33
+ cmds.push(await rexec(' echo root:' + this.settings.config.root_passwd + ' | chroot ' + this.settings.work_dir.merged + ' chpasswd', this.verbose));
34
+ // Alpine naked don't have /etc/skel
35
+ if (fs.existsSync('/etc/skel')) {
36
+ cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' cp /etc/skel/. /home/' + this.settings.config.user_opt + ' -R', this.verbose));
37
+ }
38
+ // da problemi con il mount sshfs
39
+ cmds.push(await rexec('chroot ' + this.settings.work_dir.merged + ' chown ' + this.settings.config.user_opt + ':users' + ' /home/' + this.settings.config.user_opt + ' -R', this.verbose));
40
+ switch (this.familyId) {
41
+ case 'debian': {
42
+ cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG sudo ${this.settings.config.user_opt}`, this.verbose));
43
+ break;
44
+ }
45
+ case 'alpine': {
46
+ cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG cdrom ${this.settings.config.user_opt}`, this.verbose));
47
+ cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG games ${this.settings.config.user_opt}`, this.verbose));
48
+ cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG input ${this.settings.config.user_opt}`, this.verbose));
49
+ cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG users ${this.settings.config.user_opt}`, this.verbose));
50
+ cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG video ${this.settings.config.user_opt}`, this.verbose));
51
+ cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG wheel ${this.settings.config.user_opt}`, this.verbose));
52
+ break;
53
+ }
54
+ case 'archlinux': {
55
+ cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} gpasswd -a ${this.settings.config.user_opt} wheel`, this.verbose));
56
+ // check or create group: autologin
57
+ cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} getent group autologin || chroot ${this.settings.work_dir.merged} groupadd autologin`, this.verbose));
58
+ cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} gpasswd -a ${this.settings.config.user_opt} autologin`, this.verbose));
59
+ break;
60
+ }
61
+ case 'fedora': {
62
+ cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG wheel ${this.settings.config.user_opt}`, this.verbose));
63
+ break;
64
+ }
65
+ case 'openmamba': {
66
+ cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG sysadmin ${this.settings.config.user_opt}`, this.verbose));
67
+ cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG autologin ${this.settings.config.user_opt}`, this.verbose));
68
+ break;
69
+ }
70
+ // No default
71
+ }
72
+ /**
73
+ * educaandos and others themes
74
+ * users.yml
75
+ */
76
+ let usersConf = path.resolve(__dirname, `../../addons/${this.theme}/theme/calamares/users.yml`);
77
+ if (this.theme.includes('/')) {
78
+ usersConf = `${this.theme}/theme/calamares/modules/users.yml`;
79
+ }
80
+ if (fs.existsSync(usersConf)) {
81
+ const o = yaml.load(fs.readFileSync(usersConf, 'utf8'));
82
+ for (const group of o.defaultGroups) {
83
+ cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} usermod -aG ${group} ${this.settings.config.user_opt}`, this.verbose));
84
+ }
85
+ }
86
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * ./src/classes/ovary.d/users-remove.ts
3
+ * penguins-eggs v.10.0.0 / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
7
+ */
8
+ import Ovary from './../ovary.js';
9
+ export declare function usersRemove(this: Ovary): Promise<void>;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * ./src/classes/ovary.d/users-remove.ts
3
+ * penguins-eggs v.10.0.0 / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
7
+ */
8
+ // packages
9
+ import path from 'node:path';
10
+ // backup
11
+ // interfaces
12
+ // libraries
13
+ import { exec } from '../../lib/utils.js';
14
+ import rexec from './rexec.js';
15
+ import Diversions from './../diversions.js';
16
+ // _dirname
17
+ const __dirname = path.dirname(new URL(import.meta.url).pathname);
18
+ //async cleanUsersAccounts() {
19
+ export async function usersRemove() {
20
+ if (this.verbose) {
21
+ console.log('Ovary: cleanUsersAccounts');
22
+ }
23
+ /**
24
+ * delete all user in chroot
25
+ */
26
+ const cmds = [];
27
+ const cmd = `chroot ${this.settings.work_dir.merged} getent passwd {1000..60000} |awk -F: '{print $1}'`;
28
+ const result = await exec(cmd, {
29
+ capture: true,
30
+ echo: this.verbose,
31
+ ignore: false
32
+ });
33
+ const users = result.data.split('\n');
34
+ let deluser = Diversions.deluser(this.familyId);
35
+ for (let i = 0; i < users.length - 1; i++) {
36
+ cmds.push(await rexec(`chroot ${this.settings.work_dir.merged} ${deluser} ${users[i]}`, this.verbose));
37
+ }
38
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * ./src/classes/xorriso-command.ts
3
+ * penguins-eggs v.10.0.0 / ecmascript 2020
4
+ * author: Piero Proietti
5
+ * email: piero.proietti@gmail.com
6
+ * license: MIT
7
+ */
8
+ import Ovary from '../ovary.js';
9
+ /**
10
+ *
11
+ * @param cryptedclone
12
+ * @returns cmd 4 mkiso
13
+ */
14
+ export declare function xorrisoCommand(this: Ovary, clone?: boolean, cryptedclone?: boolean): Promise<string>;