WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Another remaster script  (Read 1975 times)

Offline newbean

  • WikiUser
  • *
  • Posts: 24
Another remaster script
« on: July 01, 2010, 06:04:53 PM »
I've been working on remastering TinyCore.
for the past week. Here's what I've sucessfully accomplished.
It should work for MicroCore also.

I put two scripts together:
The first one "LoadExt.sh is used to load-up
your extensions after a fresh Tiny Core boot.

Just list the extension names you want loaded
in your new iso by changing the myList variable
on the 1st code line, to suit your requirements.


I copied my two scripts on my usb port.  After a
fresh boot, I mounted the usb and copied them
over to /home/tc/

   cp /mnt/sda2/*.sh .

NOTE!. 
I found xfe.tcz would'nt run correctly.
It's a file directory manager, and because it runs off the CD,
xfe tries to get the directory tree from the CD and not from RAM,
causing xfe to crash.
However, that's only a theory.

But keep that in mind when installing file management extensions.

#! /bin/sh
# File:  LoadExt.sh
# Date:  June 25, 2010
# Author: John Adams
# Description:  Installs Tiny Core extensions
# using a list (mylist) of extension names.

# myList
# Change to suit your needs.
mylist="nano.tcz opera.tcz"


echo;
for ex in $mylist
do
  if [ -e "/tmp/tce/optional/$ex" ]; then
    echo "$ex already loaded!"
    echo "-------------------";echo
    continue;
  fi
  echo;
  echo "Loading:  $ex"
  echo "======================="
  while true; do
    tce-load -wi $ex;echo
    if  [ -e "/tmp/tce/optional/$ex" ]; then
       break;
    fi
    echo "***** Loading $ex . . . again *****";echo
  done
  echo "$ex is loaded";echo
done


After a fresh boot and after loading your extensions,
it's time to create the ISO image by running tc-isomaker.sh

tc-isomaker.sh will create necessary directories used to make
the iso image. After that it will install some additional extensions (which
won't be included in your new ISO Image) to make the iso image using
mkisofs-tools.tcz, to alter the image further using isomaster.tcz and
burn the image using brasero.tcz. 

tce-load -wi <extension.tcz> is used to load these extensions.
Sometimes tce-load does'nt complete the extension installation
successfully, so tc-isomaker.sh has a loop which will continue until
successfull.

Ctrl-C  will break the loop and stop the script.

RE: tc-isomaker.sh
The new iso will be copied to /home/tc/ but you can also
copy to another location (e.g. usb port) by pointing the
"copyTo"  variable to another location you want
your new ISO (TC-Remastered.iso) copied to.
Then run the script.


#! /bin/sh
# File:  tc-isomaker.sh
# Date:  June 27, 2010
# Author: John Adams
# Description: Remasters a Tiny Core ISO by
# including loaded extensions in the image.
#
# Excerpts from:  http://wiki.tinycorelinux.com/Integrating+Extensions
# with modifications.
#
# Directory where new "TC-remastered.iso" will also be copied to.
copyTo="/mnt/sda2"


alias cp="cp"
clear
echo -e "\n\n\n\n"

# Message
  echo -e " 1. Start with a freshly booted Tiny Core\n"
  echo -e " 2. Load the Tiny Core extensions you want in your ISO image.\n"
  echo -e "    IMPORTANT!   All extensions - MUST Be PRE-LOADED.\n\n\n"
  echo -e  "Proceed to create ISO image?  (Y/N)\n";
  read ans;

  if [ "$ans" == "N" -o "$ans" == "n" ]; then
     echo;echo;
     exit
  fi

#
# 1. Copy TC files
# 1.1. Unpacking from ISO
        # Copy iso image to /tmp folder
          echo "* Mounting Hard-Drive";echo
          sudo mount /dev/hda1 /mnt/hda1
          echo "* Copying  ISO to: /tmp/tinycore.iso";echo
          sudo cp -p /mnt/hda1/home/john/Downloads/tinycore_3.0alpha8.iso /tmp/tinycore.iso
          echo "* Removing /mnt/sda2/TC-remastered.iso";echo
          if [ -e /mnt/sda2/TC-remastered.iso ]; then
            sudo rm /mnt/sda2/TC-remastered.iso
          fi

      # Make necessary folders
        echo "* Makedir /mnt/tmp";echo
        sudo mkdir /mnt/tmp
        echo "* Makedir /tmp/newiso/tmp";echo
        sudo mkdir -p /tmp/newiso

      # Copy extension folder
        echo "* Copying: /tmp/tce/ To: /tmp/newiso/tmp/"
        sudo cp -a /tmp/tce /tmp/newiso/; echo

      # Mount and copy boot directory
        echo "* Mounting /tmp/tinycore.iso";echo
        sudo mount /tmp/tinycore.iso /mnt/tmp -o loop,ro
        echo "* Copying: /mnt/tmp/boot/ to: /tmp/newiso/";echo
        sudo cp -a /mnt/tmp/boot /tmp/newiso/
        echo "* Unmounting /mnt/tmp";echo
        sudo umount -d  /mnt/tmp

# 2. Create the ISO
      # Load mkisofs-tools
        echo;echo "Loading:  mkisofs-tools.tcz"
        echo      "===========================";echo
        tce-load -wi mkisofs-tools.tcz;echo

        echo "* Changing to /tmp";echo
        cd /tmp
        echo "* Executing mkisofs "
        echo "==================="
        sudo mkisofs -l -V TC-custom -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinuxboot.cat -o TC-remastered.iso newiso
        echo
        echo "* Removing /tmp/newiso directory";echo
        sudo rm -rf newiso;echo
        echo "* Removing /mnt/tmp directory";echo
        sudo rm -rf /mnt/tmp

# 3. Add Useful Extensions (not to be included in the new ISO image)
      mylist="xfe.tcz isomaster.tcz brasero.tcz"
      echo
      for ex in $mylist
      do
         if [ -e "/tmp/tce/optional/$ex" ]; then
            echo "$ex already loaded"
            echo "------------------";echo
            continue
         fi
         echo
         echo "Loading:  $ex"
         echo "======================="
         while true; do
            tce-load -wi $ex
            if [ -e "/tmp/tce/optional/$ex" ]; then
              break;
            fi
            echo "***** Loading $ex . . . again *****";echo
         done
         echo "$ex is loaded";echo
      done

echo "TC-remastered.iso is located at\n /home/tc"
echo "------------------------------------------"
echo

# Copy ISO image to /home/tc
echo "Copying: TC-remastered.iso To: /home/tc";echo
sudo cp -p /tmp/TC-remastered.iso /home/tc/

# Copy ISO Image to:
echo "Copying: TC-remastered.iso To: $copyTo";echo
sudo cp -p /tmp/TC-remastered.iso $copyTo/


Hope this helps
newbean