Hello all,
I figured I'd pop these up here. I made some very simple bash scripts that help to automate the process of remastering TC. I tend to add these scripts into /home when I remaster the TC install so that I'll always have them for use. I've also included some instruction for adding TCZ files and modifying the OS once it's been unpacked.
######Remastering the core.gz file:######
Boot into a pre-existing tiny-core image.
Once booted run fdisk -l to find the /dev/ that contains the OS partition which you just booted from.
ls /mnt to see the pre-existing mount points present in the OS
To mount the drive:
-sudo mount /dev/sdX1 /mnt/sdX1
-After the unpack script has been added to the remaster it will mount this for you if utilized. (Won't be an option the first time)
navigate to the core.gz file location
##Unpacking the OS##
-Use the attached Tiny_Core_Unpack.bash script to automate the unpack
Manual Steps:
-mkdir /tmp/extract1
-cd /tmp/extract1
-zcat /mnt/sdX1/boot/core.gz | sudo cpio -i -H newc -d
--NOTE: This will expand all the contents of core.gz (which is a cpio file) into the /tmp/extract1 directory
--This makes /tmp/extract1 the new root or "/" directory for remastered copy of tinycore that is being built.
--Add scripts, files, libraries and modify system config files in /tmp/extract1/ in order to change what will become the remastered tiny core version.
##Adding libraries##
If the /tmp/tce/optional directory doesn't already exist then create it:
-mkdir tmp/tce
-mkdir tmp/tce/optional
--Note that the target tmp directory here is actually "/tmp/extract1/tmp/tce/optional" since we are working with the files that will be loaded onto the remaster.
---The extracted core.gz from the original boot USB resides within /tmp/extract1
NOW any .tcz files can be copied into /tmp/extract1/tmp/tce/optional
-Once this location is zipped back into the new core.gz file they will be available for use
The next step is to modify the opt/bootsync.sh file so that the tcz file is loaded at OS boot so that the package can be used immediately
so:
vi /tmp/extract1/opt/bootsync.sh
At the bottom of this file add:
su tc -c "tce-load -i ntfs-3g.tcz"
-Substitute in whatever .tcz package is meant to be loaded at boot (whatever TCZ is being added to the image)
Also, add any scripts or files to the unpacked core prior to repacking. Example:
-cp /mnt/sdb1/Tiny_Core_Pack.bash /tmp/extract1/home/Tiny_Core_Pack.bash
--After re-packing this script will be available for use in /home/Tiny_Core_Pack.bash
When done the modified directory needs to be re-packed:
##Repacking the core.gz file for remaster##
-use the attached Tiny_Core_Pack.bash to automate this. Be sure to pass in /tmp/extract1 as an argument as this is the directory which will be repacked into the new core.gz file.
--Ex: Tiny_Core_Pack.bash /tmp/extract1
--This script will locate the tinycore flash drive, find the original core.gz file, back it up and then copy the new core.gz to the proper location.
--If the script is utilized then do not worry about the steps following this point.
Manual Steps:
cd /tmp/extract1
sudo find | sudo cpio -o -H newc | gzip -2 > ../tinycore.gz
-This will create a ../tinycore.gz file in the /tmp/extract1 directory.
IT IS VERY IMPORTANT TO WRITE THIS FILE TO THE MOUNTED USB DRIVE
-At this point the new gz file exists only in memory
-It must be written to the mounted disk in order to be saved and utilized
cp /tmp/extract/tinycore.gz /mnt/sdx/
Now the file will be written to the USB flash drive and the system can be shutdown.
Take this remastered core.gz file and replace the core.gz file on the drive that was just used.
-Advise keeping a backup of the core file prior to replacement in case the changes end up breaking the OS.
-This drive will now have the ability (at boot) to utilize any tools that were loaded into it during the remaster.
I hope this proves to be useful to someone! I'm not sure if I'm following doctrine correctly here, but this has helped me shape my TC install into what I want. Took me a bit of time to figure out the OS configs and automate the unpack / pack process.