#!/bin/sh                                                                                                                                                                                                    
  
en_US=`locale -a | grep en_US*`
fr_FR=`locale -a | grep fr_FR*`
de_DE=`locale -a | grep de_DE*`

if [ -z "$en_US" ]
then
        echo "Warning: The en_US* locales is needed to run the intl.tests, please add it."
fi

if [ -z "$fr_FR" ]
then
        echo "Warning: The fr_FR* locales is needed to run the intl.tests, please add it."
fi

if [ -z "$de_DE" ]
then
        echo "Warning: The de_DE* locales is needed to run the intl.tests, please add it."
fi

grep sysadmin /etc/passwd
if [ "X$?" = "X0" ]; then
    test_user=sysadmin
else
    test_user=test
    useradd test
fi

chown -R ${test_user} tests
#setpriv --reuid ${test_id} --rgid ${test_gid} --clear-groups --reset-env $(dirname "$0")/run-bash-ptests
sudo -u ${test_user} /bin/bash -c "$(dirname "$0")/run-bash-ptests"
chown -R root:root tests

if [ "X${test_user}" = "Xtest" ]; then
    userdel -r ${test_user}
fi
