#! /bin/sh

cfgdir=${XDG_CONFIG_DIR:-$HOME/.config}
prefix=/usr/share/help
suffix=gnome-help/figures/gnome-yelp-intro.webm
full_locale=$LANG
locale=`echo $full_locale | sed -e 's/\..*//'`
lang=`echo $locale | sed -e 's/_.*//'`

rm -f $cfgdir/run-welcome-tour

# Don't do anything if yelp isn't installed
yelp_path=$(which yelp 2>/dev/null)
if test -z "${yelp_path}"; then
    exit
fi

if [ ! -d $cfgdir/yelp ]; then
        mkdir $cfgdir/yelp
        cat <<EOF >>$cfgdir/yelp/yelp.cfg
[documents/help%3Agnome-help]
geometry=(1024, 709)
EOF
fi

for name in $locale $lang 'C'; do
        if test -f "$prefix/$name/$suffix" ; then
                intro_path="$prefix/$name/$suffix"
                break;
        fi
done

/usr/libexec/gnome-initial-setup-player $intro_path &
yelp help:gnome-help/getting-started
