# SliTaz package receipt.

PACKED_SIZE="1.7M"
UNPACKED_SIZE="2.4M"
PACKAGE="linux-sound"
VERSION="3.16.55"
CATEGORY="base-system"
SHORT_DESC="The Linux kernel sound modules."
MAINTAINER="devel@slitaz.org"
LICENSE="GPL2"
DEPENDS="linux"
WANTED="linux"
WEB_SITE="https://www.kernel.org/"

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    local path
    path=lib/modules/$VERSION-slitaz/kernel
    mkdir -p $fs/$path
    export src install
    $wanted_stuff/list_modules.sh sound | while read module; do
    	dir=$path/$(dirname $module)
    	[ -d $fs/$dir ] || mkdir -p $fs/$dir
        cp -a $install/$path/$module $fs/$dir
    done
    
    # Firmware
	mkdir $fs/lib/firmware
	for i in ess korg sun yamaha; do
		cp -a $install/lib/firmware/$i $fs/lib/firmware
	done

    for i in $(cat $wanted_stuff/modules.list); do
        if [ -f $fs/$path/$i ]; then
			rm -f $fs/$path/$i
		fi
    done

}

# Post install/remove commands for Tazpkg.
post_install()
{
	chroot "$root/" depmod -a $VERSION-slitaz
}

post_remove()
{
	chroot "$root/" depmod -a $VERSION-slitaz
}

