Package your Electron app into a self-contained operating system (suitable for virtual machines/ live CDs)
npm install electron-iso-packagerThe average output file size is around ~125mb, so it's even less than an .exe bundle.
Under the hood, this script calls electron-packager to obtain a linux32 packaged version of your app and then puts the result inside a remastered version of Tinycore Linux, a slim linux distro, with only the bare necessary to run Electron + a window manager (openbox) and a minimal terminal.
Check REMASTER.md for a complete list of included packages.
Screenshot (Activity monitor example, running on Virtualbox):
!screenshot
bash
apt install coreutils zutils cpio genisoimage p7zip-full # Install dependencies
`Then run (NO root permissions needed anymore):
(keep in mind that the first time, npx will download Tinycore, so it may stuck for some minutes)
`bash
npx electron-iso-packager [postscript] [customiso.iso]Examples:
npx electron-iso-packager ./ MyApp
npx electron-iso-packager ./ MyApp "read -n 1" # Wait keypress before packaging iso
`
Where
is the base directory of the application source (same as electron-packager).
After a while, it will spawn a file called appname.iso inside your current directory. Enjoy!
You may specify a linux command as third argument, it will be executed after electron-packager has finished but before .iso is created, giving you the possibility to edit the electron-iso folder, where your app files are stored before compression. It also allows you to edit electron-iso/files/home/tc/app/autostart.sh to change boot options as explained below. You can also set a custom iso file as the base of your system instead of the default one (check the remaster guide).
No further customization is supported yet, but some options will be added soon. Feel free to open a [github issue]() if you think something important is missing.Autostart
After electron-packager has finished, a file called autostart.sh is added to the result. This is the file responsable of launching your app after boot.
You can replace it using a postscript command, for example:
`bash
electron-iso-packager ./ MyApp "cp customAutostart.sh ./electron-iso/home/tc/app/autostart.sh"
`
Default autostart:
`bash
#!/bin/shAutostart electron-app
/home/tc/app/electron-iso --no-sandbox &Default tinycore desktop .xsession
"$DESKTOP" 2>/tmp/wm_errors &
export WM_PID=$!
hsetroot -add "#0E5CA8" -add "#87C6C9" -gradient 0 -center /usr/local/share/pixmaps/logo.png # Change to set custom background
[ -x $HOME/.mouse_config ] && $HOME/.mouse_config &
[ $(which "$ICONS".sh) ] && ${ICONS}.sh &
[ -d "/usr/local/etc/X.d" ] && find "/usr/local/etc/X.d" -type f -o -type l -print | while read F; do . "$F"; done
[ -d "$HOME/.X.d" ] && find "$HOME/.X.d" -type f -print | while read F; do . "$F"; done
``As said before, aterm package is included, so you if you want, you can just right-click the desktop and install new packages at runtime or install the os on a persistent disk.
If your goal is to obtain persistency, you may also be interested in tinycore boot codes as explained here.