Tiny Core Linux
General TC => Programming & Scripting - Unofficial => Topic started by: danielibarnes on January 19, 2011, 03:04:02 PM
-
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.
Options:
-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)
For example:
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.
FIX: Add /etc/sysconfig/tcedir as location of TCE directory
FIX: Autodetect /opt/tce (ver < 4.2) vs. /tmp/builtin (ver >= 4.2)
FIX: Process boot options properly in 4.x
-
Sweet! Thanks, I plan to test this out soon!
-
EDIT: Added feature allowing files and directories to be added. Use the new -f parameter to add a file with a .gz, .tcz, or .iso extension in order to avoid special processing as a cpio archive, extension, or .iso image.
NOTE: Two cpio archives are created:
1) opt_tce.gz, which contains extensions, and
2) remaster.gz, which contains any additional files or directories.
-
1) Download the required extensions:
tce-load -w open-vm-tools
tce-load -w ethtool
2) Download the current release of Micro Core:
wget http://distro.ibiblio.org/tinycorelinux/3.x/release/microcore-current.iso
3) Add the folllowing line to your /opt/bootsync.sh file:
/usr/local/etc/init.d/open-vm-tools start
4) Execute qremaster:
sh qremaster open-vm-tools.tcz ethtool.tcz /opt/bootsync.sh blacklist=pcnet32 microcore-current.iso microcore-vm.iso
You can easily add other extensions to this and create your own custom appliances:
- Time server: gpsd + ntpd + serial-2.6.33.3-tinycore
- Subversion server: svn
- Gateway/Router: iptables + dnsmasq
- Software Development: compiletc + automake + coreutils + ...
You can also add bootcodes to further customize your appliance:
- Time Zone: tz=...
- Enable all six virtual terminals: multivt
- Start various daemons at boot: syslog cron
include various files and directories to create a specific environment:
- Dropbear host keys: /etc/dropbear/dropbear*
- Authorized keys: /home/tc/.ssh/authorized_keys
- User information: /etc/passwd /etc/shadow
-
1) Download the required extensions:
tce-load -w open-vm-tools-x
tce-load -w ethtool
2) Download the current release of Tiny Core:
wget http://distro.ibiblio.org/tinycorelinux/3.x/release/tinycore-current.iso
3) Add the folllowing line to your /opt/bootsync.sh file:
/usr/local/etc/init.d/open-vm-tools-x start
4) Execute qremaster (this will create a 50MB image):
sh qremaster open-vm-tools-x.tcz ethtool.tcz /opt/bootsync.sh blacklist=pcnet32 tinycore-current.iso tinycore-vm.iso
You can easily add other extensions to this and create your own custom appliances:
- Web browser: minefield + flash10
- Gaming: alsa + dosbox + mupen64plus + nestopia + stella + snes9x + vice + visualboyadvance + zsnes
You can also add bootcodes to further customize your appliance:
- Alternate window manager: desktop=evilwm
- Do not run wbar: noicons
- Background image: bkg=
include various files and directories to create a specific environment:
- X configuration: /etc/X11/xorg.conf
- Background images: /opt/backgrounds
- ALSA volumes: /etc/asound.state
-
Thanks for this good work.
I found this "-a Extract extensions into a cpio archive (scatter install)", and found "unsquashfs -f $x &> /dev/null" in script for this.
And, I read ezremaster code( remaster.sh installapp(){} ), for the similar function, it use "mount packagename.tcz /path/mountpoint" mode and has the extra code to deal with "/usr/local/tce.installed/packagename" custom startup scripts. see: wiki.tinycorelinux.net/wiki:remastering_with_ezremaster
I have a question: is there any problem when lacking dealing with that custom startup script by just copy the extracted file into cpio archive?
-
Thanks for this good work.
I found this "-a Extract extensions into a cpio archive (scatter install)", and found "unsquashfs -f $x &> /dev/null" in script for this.
And, I read ezremaster code( remaster.sh installapp(){} ), for the similar function, it use "mount packagename.tcz /path/mountpoint" mode and has the extra code to deal with "/usr/local/tce.installed/packagename" custom startup scripts. see: wiki.tinycorelinux.net/wiki:remastering_with_ezremaster
I have a question: is there any problem when lacking dealing with that custom startup script by just copy the extracted file into cpio archive?
For many (most?) extensions you need to somehow handle running the startup script for them to work, but of course it is extension dependant. Another thing I ran in to is some extensions won't work unless you extract them in the correct order (based on dependencies, i.e. if you are extracting firefox.tcz it should be the last file extracted after all of the dependencies have been extracted).
-
Awsome tool dude !!!
Is just what I needed to create custom microcore iso's
Great work :)
-
Sorry for posting in this old topic but the script has to be changed when using it in the new version of tinycore.
http://forum.tinycorelinux.net/index.php/topic,15093.0.html