#!/bin/sh
#============================================================================#
# Install asterisk extra sounds                                              #
#============================================================================#
# (C) Denis Smirnov <mithraen@freesource.info>          http://mithraen.ru/  #
#============================================================================#
lang=$1
codec=$2
buildroot=$3

sound_dir=/usr/share/asterisk/sounds/$lang

mkdir -p $buildroot/$sound_dir
cp -a ./ $buildroot/$sound_dir/

find -type f \
    | grep -v sounds.list \
    | grep -vP '^.\/(CREDITS|LICENSE|CHANGES)' \
	| grep -vP '\.txt$' \
    | sed 's!\.\/\(.*\)!'$sound_dir'/\1!' \
    > sounds.list

find -mindepth 1 -type d \
    | sed 's!\.\/\(.*\)!%dir '$sound_dir'/\1!' \
	>> sounds.list

find -type f \
    | grep -P '^.\/(CREDITS|LICENSE|CHANGES)' \
    | sed 's!\.\/\(.*\)!%doc \1\n%exclude '$sound_dir'/\1!' \
	>> sounds.list

find -type f \
    | grep -P '\.txt$' \
    | sed 's!\.\/\(.*\)!%doc \1\n%exclude '$sound_dir'/\1!' \
	>> sounds.list
