Open the .app in Script Editor. It's pure AppleScript, albeit with some do shell scripts.
> [...list of macOS installer apps...]
> Mac users can download theses files from the App Store.
This isn't really accurate. It's not possible to find and download macOS releases older than the current release. The only exception I was able to find a few months ago is if you've already downloaded them once previously while signed into the App Store on a different machine. I believe in that case an old release can be downloaded on a new machine from the Purchased list after signing in under the same account.
EDIT: formatting; clarification
I create bootable media, e.g. USB sticks or SD cards, for PCs and RPis and I can thus run "diskless"; no disk access is required and the full system fits in RAM.
I can insert the media into any available PC and use the computer, without disturbing anything on its HDD.
This can also be very useful for emergencies where a computer with a HDD will not boot due to some problem with what is on the drive.
Is this flexibilty possible with today's MacIntosh?
The media I create require no network to boot. They only require 1. a computer with an appropriate USB or SD card slot that can boot from USB or SD card, respectively, and 2. sufficient RAM to hold the system.
This sort of usage is what I am curious about on the MacIntosh.
You can install Clover on a USB plus your install media, boot off it and get to the installer. This should get you most of the way there.
I first needed a script like this one when I moved a couple of mac minis to ESXi so I could squeeze extra build VMs onto them. The easiest way to get an image onto ESXi without using a bootp server or something is an iso; it doesn't handle app bundles the way Fusion does.
You can skip a lot of the convert/copy/asr steps by just using the hdiutil -srcfolder command, targeted to the createinstallmedia DMG, in conjunction with your target format. (This can be reproduced in Disk Utility as well, by the way.) As far as I can tell, you need about 3 commands here, and not a 189 line bash program with functions.
As mentioned elsewhere, Disk Maker X is the way to go. Thanks for sharing your work though, even if it's a bit over-built.
The easiest way to install OS X on ESXi is from an iso. My scripts for creating these isos are not as nice as this one. (I use ESXi because I find I can get one or two more build VMs per Mini this way.)
I'd never heard of Disk Maker X before, but at a glance it does not look like it can emit an iso.
As for why hackers use MacOS, eh, it’s just a tool. It does some things better than Linux or Windows, and some things worse. It’s UNIX abilities are pretty decent. At this point operating systems are sufficiently advanced tha I don’t know why we’re arguing about them, from a technical perspective. From a OSS Vs proprietary tech I get it
I can think of a small handful of corner cases (making iso's for e.g. virtualbox, whose OSX support is extremely minimal), but nothing that most users, or even developers, would run into on a day-to-day basis.