From 48936efa96ae17295be4e0a71be3294f0ec6aef8 Mon Sep 17 00:00:00 2001 From: Mathieu Deous Date: Mon, 2 May 2022 20:18:23 +0200 Subject: Make application go-install-able and create a docker image --- utils/magento2_whitelist.sh | 83 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100755 utils/magento2_whitelist.sh (limited to 'utils/magento2_whitelist.sh') diff --git a/utils/magento2_whitelist.sh b/utils/magento2_whitelist.sh new file mode 100755 index 0000000..bb742c8 --- /dev/null +++ b/utils/magento2_whitelist.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# Quit script if something goes wrong +set -o errexit -o nounset -o pipefail; + +SCRIPTDIR="$( dirname "$(readlink -f "$0")" )"; +OUTFILE="${SCRIPTDIR}/../whitelists/magento2.yar"; +TMPFILE="${OUTFILE}.new"; + +# First empty the target whitelist so we can completely generate a new one +cat <"${OUTFILE}"; +private rule Magento2 : ECommerce +{ + condition: + false +} +EOF + +# Create a temporary directory and make sure it is empty +GENTEMPDIR="$( mktemp -d --suffix="_gen_whitelist_m2" )"; + +# Composer access tokens +if [ ! -f "${HOME}/.composer/auth.json" ]; then + echo -e "\nYou have no '.composer/auth.json' in your home dir. We will create it from a template and open an editor."; + echo -e "Press [Enter] to continue. Press Ctrl-C if you wish to leave."; + read; + mkdir -p "${HOME}/.composer"; + cat <"${HOME}/.composer/auth.json" +{ + "INFO_GITHUB": "==== GET TOKEN: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ ====", + "github-oauth": { + "github.com": "---github-token-goes-here---" + }, + "INFO_MAGENTO": "==== GET TOKEN: https://devdocs.magento.com/guides/v2.0/install-gde/prereq/connect-auth.html ====", + "http-basic": { + "repo.magento.com": { + "username": "---public-key-goes-here---", + "password": "---private-key-goes-here---" + } + } +} +EOF + editor "${HOME}/.composer/auth.json"; +fi + +# Add header to whitelist tempfile +cat < "${OUTFILE}"; + +# Clean up +rm "${TMPFILE}"; +rm -rf "${GENTEMPDIR}"; -- cgit v1.3