# TinyCore Grub Config


set this_isopath="${isodev}${isopath}/tinycore"

# abuse for to check for existence
for isofile in $this_isopath/*.iso; do
	if [ ! -e "$isofile" ]; then break; fi

	echo "Found TinyCores in ${this_isopath}"

submenu "TinyCore Linux >" "${this_isopath}" --class tinycore {
this_isopath=$2

for isofile in ${this_isopath}/*Core*.iso; do
	if [ ! -e "$isofile" ]; then break; fi

	regexp \
		--set 1:isoname \
		--set 2:variant \
		--set 3:version \
		"^.*/((.*Core[^-]*)-(.+)\.iso)\$" "${isofile}"

	menuentry "${variant} ${version}" "${isofile}" "${isoname}" --class tinycore {
		set isofile=$2
		set isoname=$3

		regexp \
			--set 1:isodev \
			--set 2:isofile \
			"^(\(.*\))?(.*)\$" "${isofile}"

		echo "Using ${isoname}..."
		loopback loop "${isodev}${isofile}"
		# ideas to add for CorePlus: loglevel=3 cde showapps desktop=flwm_topside
		linux (loop)/boot/vmlinuz
		initrd (loop)/boot/core.gz
	}
done

}

# kill for loop
break
done
