This script remasters a Tiny Core release by adding cpio archives or extensions. Usage is simply:
qremaster [options] [ *.gz | *.tcz | file | dir ] bootcode=[value] input.iso output.iso
*.tcz collect into a cpio archive within /opt/tce directory.
*.gz add .gz file to initrd= line of syslinux.cfg.
file add a file into a cpio archive.
dir add a directory into a cpio archive.
-a Extract extensions into a cpio archive (scatter install)
-d Download missing extensions
-f FILE Force FILE to be added to cpio archive
-H Create hybrid iso image
-i Place /tce in root of iso image instead of /opt/tce
-p Do not display prompt
-t timeout Set prompt timeout (units of 1/10 sec or 0 to disable)
-V LABEL Use LABEL when creating iso image (default: custom)
qremaster -H -V MCX Xlibs.gz Xprogs.gz Xvesa.gz dropbear.tcz /opt/bootlocal.sh syslog= waitusb=7 microcore_current.iso tinycore.iso
will combine microcore, the X elements, the dropbear extension, the bootlocal.sh file, and the "syslog waitusb=7" bootcodes into a new, hybrid tinycore.iso image with MCX as the label. The above example completes in less than 100ms on my system!
Arguments may be in any order. Wildcards may be used. If an extension is not found in the current directory then the TCE directory (from /opt/.tce_dir) will be searched. The first ".iso" argument specified will be used as the input filename and the last ".iso" argument specified will be the used as the output filename. You cannot use the same pathname for both to avoid accidental overwrites. Should this be desired, it can be implemented by commenting the appropriate line in the script. The list of bootcodes passed to this script is considered authoritative, even if none are specified. If syslinux.cfg in the input image already contains bootcodes, they must occur before "quiet" or they will not be transferred to the output image.
The script adds cpio archives by copying them to /boot in the iso and putting the filenames in syslinux.cfg. The extensions are added by creating a cpio archive with all of the extensions in /opt/tce. If an extension has dependencies, they will be added automatically. The script is idempotent, meaning that trying to remaster a previously-remastered iso in the same way will not change the image.
The mkisofs-tools extension must be loaded. The syslinux extension is required if the -H option is used. The squashfs-tools-4.x extension is required if the -a option is used. The features of this script are limited to keep it quick and simple while addressing some of the common use cases, but suggestions are welcome.
EDIT: Rewrote option processing to use case statement and added -t, -H, and -V options
FIX: Copy .md5.txt and recursively add dependencies in .dep.
FIX: Broken permissions on / when adding extensions.
EDIT: Removed option to put /tce on iso image
FIX: Error when remastering 3.7.1
EDIT: Add -a, -d, -i, -p, and -t options.