[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

adding an hd-media buildtool



Hi to the list, we recently adopted simple-cdd as a building mule for
lot of preseeded isos we'll have to maintain, it's very easy and makes
us happy \o/

Recently we need the same capabilities those preseeded disks have, but
in form of usb keychain bootable thing, so today i cooked the really
simple buildtool i attach : it nest the right iso, shifting on usbkey
the preseed logic.

once dropped in tools/build, you can --build-tools hd-media if you
already have a generated iso from current settings.

Suggestions or feedback are very welcome, regards :)
--
ale
cdimage="${OUT}/${CDNAME}-${DEBVERSION}-$(echo $ARCHES | tr ' ' '-')-CD-1.iso"

build_dir=${simple_cdd_temp}/hd-media
output_file=${build_dir}/image.bin
# TODO cache ?
media_root=http://ftp.ch.debian.org/debian/dists/etch/main/installer-i386/current/images/hd-media

mangleSyslinuxCFG() {
	opt=$1
	case "$opt" in
		init)
			filename=$2
			cat > $filename <<EOF
DEFAULT install
#TODO insert all possible kernels options for hdmedia "stock" vmlinuz
LABEL install
  kernel /linux
  append $KERNEL_PARAMS initrd=/initrd.gz
LABEL interactive
  kernel /linux
  append $KERNEL_PARAMS preseed/interactive=true initrd=/initrd.gz

TIMEOUT $BOOT_TIMEOUT
PROMPT 1
EOF
			;;

	esac
}

echo will nest $cdimage ...

# clean workspace
rm -fr $build_dir && mkdir $build_dir

# fetch hd-media stuff from internet
for f in vmlinuz initrd.gz
do
	wget ${media_root}/$f -O ${build_dir}/$f
done

# copy preseeding stuff
mkdir ${build_dir}/simple-cdd
cp $package_files $preseed_files ${build_dir}/simple-cdd

# create a basic syslinux.cfg
mangleSyslinuxCFG init ${build_dir}/syslinux.cfg

# TODO should be ok, it waste some space though
# it links the image for space evaluation purposes
ln -sf $cdimage $build_dir
size=`du -D -c -B1000 ${build_dir}/* | tail -n1 | cut -f1`

/sbin/mkfs.msdos -i f00baba1 -n "hd-media" -C $output_file $size

# files ...
mcopy -i$output_file ${build_dir}/vmlinuz      ::linux
mcopy -i$output_file ${build_dir}/initrd.gz    ::initrd.gz
mcopy -i$output_file $cdimage                  ::vobe.iso
mcopy -i$output_file ${build_dir}/syslinux.cfg ::syslinux.cfg

# directories ...
mcopy -s -i$output_file ${build_dir}/simple-cdd ::simple-cdd

syslinux $output_file

mv $output_file "${OUT}/${CDNAME}-${DEBVERSION}-$(echo $ARCHES | tr ' ' '-')-usb.bin"

Reply to: