#!/bin/ash -efu
#
# mki-copy-syslinux
#
# This file is part of mkimage
# Copyright (C) 2008  Michael A. Kangin <mak@rsmu.ru>
# Copyright (C) 2008-2009  Alexey Gladkov <gladkov.alexey@gmail.com>
#
# This file is covered by the GNU General Public License,
# which should be included with mkimage as the file COPYING.
#

. "${0%/*}"/mki-sh-functions

pkgs="${PACKAGES_REQUIRED_COPY_SYSLINUX:-}"

verbose "has started executing."

[ -d "$chroot" ] ||
	fatal "$dir: not look like a work directory of hasher."

mki-install $pkgs ||
	fatal "faild to install packages: $pkgs."

[ -f "$chroot/.image/syslinux/syslinux.cfg" ] ||
	message 'Warning: /.image/syslinux/syslinux.cfg: not found.'

run_chrooted "$chroot" <<EOF
#!/bin/sh -efu
mkdir $verbose -p -- /.image/syslinux/alt0
cp $verbose -aLf /boot/vmlinuz /.image/syslinux/alt0/vmlinuz
[ ! -f /boot/full.cz ] ||
	cp $verbose -aLf /boot/full.cz /.image/syslinux/alt0/full.cz
EOF
