Update API test script to use 'sudo' if running as user and

needing to pkg install utils
This commit is contained in:
Kris Moore
2016-02-08 12:30:27 -05:00
parent 172962421c
commit 0300aab643

View File

@@ -17,9 +17,15 @@ DEFCLASS="lifepreserver"
# Set variable to call jsawk utility
JSAWK="./utils/jsawk -j js24"
if [ `id -u` != "0" ] ; then
pkgPre="sudo"
else
pkgPre=""
fi
which npm >/dev/null 2>/dev/null
if [ $? -ne 0 ] ; then
pkg install -y npm
$pkgPre pkg install -y npm
if [ $? -ne 0 ] ; then
echo "Requires npm!"
exit 1
@@ -28,7 +34,7 @@ fi
pkg info p5-JSON >/dev/null 2>/dev/null
if [ $? -ne 0 ] ; then
pkg install -y p5-JSON
$pkgPre pkg install -y p5-JSON
if [ $? -ne 0 ] ; then
echo "Requires p5-JSON!"
exit 1