refactored firefox build-file

master
and94x 2 years ago
parent 7428f4a66b
commit 7fce2733dd

@ -1,21 +1,38 @@
#!/bin/bash #!/usr/bin/bash
PWD=$(pwd) printf " _ _____ \r\n"
BASE_DIR=${PWD}/base printf " ___| |_ __ _ _ __ ___ _ __ ___/__ \/ \ /\ \r\n"
MANIFEST_DIR=${PWD}/firefox printf "/ __| __/ _\` | '_ \` _ \| '_ \` _ \ / /\/\ \ / / \r\n"
OUTPUT_DIR=${PWD}/out/artifacts/firefox printf "\__ \ || (_| | | | | | | | | | | / / \ V / \r\n"
printf "|___/\__\__,_|_| |_| |_|_| |_| |_\/ \_/ \r\n"
# Define paths
BASE_DIR=base
MANIFEST_DIR=firefox
OUTPUT_DIR=out/artifacts/firefox
OUTPUT_FILE=${OUTPUT_DIR}/extension.zip OUTPUT_FILE=${OUTPUT_DIR}/extension.zip
echo $BASE_DIR printf "Base dir: \t%s\r\n" "$BASE_DIR"
echo $MANIFEST_DIR printf "Manifest dir: \t%s\r\n" "$MANIFEST_DIR"
printf "Output dir: \t%s\r\n" "$OUTPUT_DIR"
printf "\r\n"
mkdir -p ${OUTPUT_DIR} # Create output directory, if not existing
[ ! -d "${OUTPUT_DIR}" ] && mkdir -p "${OUTPUT_DIR}"
# check if file exists before removing # Remove previous build, if existing
[ -f ${OUTPUT_FILE} ] && rm -f ${OUTPUT_FILE} [ -f ${OUTPUT_FILE} ] && rm -f ${OUTPUT_FILE}
pushd ${BASE_DIR} # Add base components to zip
zip -r ${OUTPUT_FILE} * pushd ${BASE_DIR} 1> /dev/null || exit
popd zip -r ../${OUTPUT_FILE} * 1> /dev/null
pushd ${MANIFEST_DIR} popd 1> /dev/null || exit
zip ${OUTPUT_FILE} manifest.json
popd # Add firefox manifest to zip
pushd ${MANIFEST_DIR} 1> /dev/null || exit
zip ../${OUTPUT_FILE} manifest.json 1> /dev/null
popd 1> /dev/null || exit
# Feedback
[ -f ${OUTPUT_FILE} ] && echo "✔ Successfully created $(file ${OUTPUT_FILE})"
[ ! -f ${OUTPUT_FILE} ] && echo "❌ Failed to build extension. See output printed above for more details."

Loading…
Cancel
Save