How multicd.sh works

Each plugin has its own file in the plugins folder. I'll take feather.sh, the plugin for Feather Linux, as an example.

#!/bin/sh
set -e
#Feather Linux plugin for multicd.sh
#version 5.0.1
#Copyright (c) 2009 maybeway36
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in
#all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#THE SOFTWARE.

This section contains the "set -e" command that tells the script to quit on errors, the name and version of the plugin, and the MIT license.

if [ $1 = scan ];then
	if [ -f feather.iso ];then
		echo "Feather"
	fi

multicd.sh calls this section near the beginning of the script. Each plugin will scan to see if its respective ISO is in the folder and should be included. For some plugins, it might be more complicated, i.e. if two CDs can't be on the same disc.

elif [ $1 = copy ];then
	if [ -f feather.iso ];then
		echo "Copying Feather..."
		if [ ! -d feather ];then
			mkdir feather
		fi
		if grep -q "`pwd`/feather" /etc/mtab ; then
			umount feather
		fi
		mount -o loop feather.iso feather/
		mkdir multicd-working/FEATHER
		cp -R feather/KNOPPIX/* multicd-working/FEATHER/ #Compressed filesystem
		mkdir multicd-working/boot/feather
		cp feather/boot/isolinux/linux24 multicd-working/boot/feather/linux24
		cp feather/boot/isolinux/minirt24.gz multicd-working/boot/feather/minirt24.gz
		umount feather
		rmdir feather
	fi

This is the copy section, called in the middle of multicd.sh. First, the plugin sees if the ISO is there (again - it doesn't remember), then it makes a mountpoint for the ISO image, makes sure nothing's mounted there, then mounts it.
After mounting, the necessary components are copied into multicd's working directory. In the case of Feather Linux, this means the KNOPPIX folder (which is renamed to FEATHER so it doesn't conflict with the actual Knoppix,) the kernel, and the initrd file. Once this is done, the mountpoint is unmounted and removed.
Each ISO will have different files that need to be copied. This will oftentimes be a kernel, an initrd, and a file or folder with a compressed filesystem image (like Ubuntu's casper.)

elif [ $1 = writecfg ];then
if [ -f feather.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
LABEL feather
MENU LABEL ^Feather Linux
KERNEL /boot/feather/linux24
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=/boot/feather/minirt24.gz knoppix_dir=FEATHER nomce quiet BOOT_IMAGE=knoppix
LABEL feather-toram
MENU LABEL Feather Linux (load to RAM)
KERNEL /boot/feather/linux24
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=/boot/feather/minirt24.gz knoppix_dir=FEATHER nomce quiet toram BOOT_IMAGE=knoppix
LABEL feather-2
MENU LABEL Feather Linux (boot to command line)
KERNEL /boot/feather/linux24
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=/boot/feather/minirt24.gz knoppix_dir=FEATHER nomce quiet 2 BOOT_IMAGE=knoppix
EOF
fi

The third part of the plugin script is called right before the multicd.iso image is made. This section adds the distro's ISOLINUX commands to the new isolinux.cfg. It checks if the ISO is there (yet again,) and if it is, it appends text to isolinux.cfg.
Check the isolinux.cfg of the original ISO to see what to put here. Keep in mind that if the files aren't in the same place as they are on the orininal CD, you'll have to change some things (like "/boot/feather" instead of "/boot/isolinux" or adding "knoppix_dir=FEATHER" above.)

else
	echo "Usage: $0 {scan|copy|writecfg}"
	echo "Use only from within multicd.sh or a compatible script!"
	echo "Don't use this plugin script on its own!"
fi

The end is always the same. If the script is not called with one of the three arguments multicd.sh uses (i.e. if a user calls it seperately), the script tells the user that the script can't be used on its own.

Home