diff --git a/build_par_file.sh b/build_par_file.sh new file mode 100644 index 0000000000000000000000000000000000000000..9ec8bb3cff4efc4cc4d19c7b4c403c174c5fcf69 --- /dev/null +++ b/build_par_file.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# Script to bundle Perl-Module with Script +# by Andreas Romeyke @ SLUB Dresden +REQUIRED_PERL_MODULE=PAR::Packer +WHAT_TO_BUNDLE=bin/slubsipbuilderbagit.pl +BUNDLE_NAME=slubsipbuilder_bundled.pl +BUNDLE_LOG=bundle.log +echo -n "Checking if required module exists… " +# test if module exists +perl -M${REQUIRED_PERL_MODULE} -e ";" > /dev/null 2>&1 +if [[ $? -ne 0 ]]; then + echo "failed! :(" + echo "you need to install perl module ${REQUIRED_PERL_MODULE}"; + echo "HINT: 'cpanm ${REQUIRED_PERL_MODULE}' could help"; + exit 1; +else + echo "fine :)" +fi +echo -n "Trying to bundle… " +# -c .... check dependencies via 'perl -c ...' +# -P .... build a Perl-script bundle +# -o .... output as +pp -c -P -o ${BUNDLE_NAME} ${WHAT_TO_BUNDLE} > ${BUNDLE_LOG} 2>&1 +if [[ $? -eq 0 ]]; then + echo "fine :)" + echo "Successfully build bundles in ${BUNDLE_NAME}" + rm -f ${BUNDLE_LOG} +else + echo "failed! :'(" + echo "Something was wrong in bundling to ${BUNDLE_NAME}" + echo "Check ${BUNDLE_LOG} for details" +fi +