#!/bin/sh

gfxboot_datadir=/usr/share/gfxboot
bootlogo=$gfxboot_datadir'/@DESIGN@/bootlogo'

if [ ! -f "$bootlogo" ]; then
	echo "${0##*/} - SKIP: $bootlogo not found"
	ls -alR $gfxboot_datadir
	exit 0
fi
cd "$WORKDIR"
mkdir -p syslinux
cd syslinux
if [ -f /usr/lib/syslinux/gfxboot.com -o -f /usr/lib/syslinux/gfxboot.c32 ]
then
    cp /usr/lib/syslinux/gfxboot.com ./ ||:
    cp /usr/lib/syslinux/gfxboot.c32 ./ ||:
else
	echo "${0##*/} - SKIP: gfxboot.c32 or gfxboot.com not found"
	exit 0
fi

# unpack
cpio -iduV <"$bootlogo"

# pack
printf 'init\nlanguages\n' |
	cpio -oV >bootlogo
