2017-06-16 19:11:54 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-06-28 13:57:58 +00:00
|
|
|
set -e
|
|
|
|
|
2017-06-16 20:21:12 +00:00
|
|
|
NPM_UNPACK_DIR=/tmp/npm-unpack
|
2017-06-16 19:11:54 +00:00
|
|
|
|
2017-09-05 19:33:36 +00:00
|
|
|
pwd
|
2017-09-06 19:45:11 +00:00
|
|
|
echo "--- Packing npm package into a tarball"
|
|
|
|
npm pack
|
2017-09-05 19:33:36 +00:00
|
|
|
|
2017-06-16 19:11:54 +00:00
|
|
|
AUTHELIA_PACKAGE=`ls | grep "authelia-\([0-9]\+.\)\{2\}[0-9]\+.tgz"`
|
2017-06-16 20:21:12 +00:00
|
|
|
echo "--- Authelia package is ${AUTHELIA_PACKAGE}"
|
2017-06-16 19:11:54 +00:00
|
|
|
|
2017-09-06 19:45:11 +00:00
|
|
|
echo "Files in tarball are:"
|
|
|
|
tar -ztvf ${AUTHELIA_PACKAGE}
|
|
|
|
|
2017-06-16 20:21:12 +00:00
|
|
|
echo "--- Copy package into "${NPM_UNPACK_DIR}" to test unpacking"
|
2017-06-16 19:11:54 +00:00
|
|
|
mkdir -p ${NPM_UNPACK_DIR}
|
|
|
|
cp ${AUTHELIA_PACKAGE} ${NPM_UNPACK_DIR}
|
|
|
|
|
|
|
|
pushd ${NPM_UNPACK_DIR}
|
|
|
|
|
2017-06-16 20:21:12 +00:00
|
|
|
echo "--- Test unpacking..."
|
2017-06-16 19:11:54 +00:00
|
|
|
npm install ${AUTHELIA_PACKAGE}
|
|
|
|
|
2017-06-16 20:21:12 +00:00
|
|
|
RET_CODE_INSTALL=$?
|
2017-06-16 19:11:54 +00:00
|
|
|
# echo ${RET_CODE}
|
|
|
|
|
2017-06-16 20:21:12 +00:00
|
|
|
# The binary must start and display the help menu
|
|
|
|
./node_modules/.bin/authelia | grep "No config file has been provided."
|
|
|
|
RET_CODE_RUN=$?
|
|
|
|
|
2017-06-16 19:11:54 +00:00
|
|
|
popd
|
|
|
|
|
2017-06-16 20:21:12 +00:00
|
|
|
if [ "$RET_CODE_INSTALL" != "0" ] || [ "$RET_CODE_RUN" != "0" ]
|
2017-06-16 19:11:54 +00:00
|
|
|
then
|
2017-06-16 20:21:12 +00:00
|
|
|
echo "--- Unpacking failed..."
|
2017-06-16 19:11:54 +00:00
|
|
|
exit 1
|
|
|
|
else
|
2017-06-16 20:21:12 +00:00
|
|
|
echo "+++ Unpacking succeeded"
|
2017-06-16 19:11:54 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|