From f83835578c742b2083b624d646e325a4ab2afd57 Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Sat, 23 Oct 2021 22:44:25 +0100 Subject: [PATCH] token install script instead; try updating github action to match --- .github/workflows/php.yml | 14 ++++++------ install.sh | 45 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 install.sh diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 2fc727cc..20247193 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -14,6 +14,9 @@ jobs: php-version: 7.4 tools: composer + - name: run insall.sh + run: /bin/bash install.sh + - name: check composer run: composer validate @@ -24,9 +27,6 @@ jobs: - name: check formatting run: composer check-format - - name: setup templates_c - run: mkdir templates_c || true - - name: touch config.local.php run: touch config.local.php @@ -49,8 +49,8 @@ jobs: php-version: ${{ matrix.php-versions }} tools: composer - - name: setup templates_c - run: mkdir templates_c || true + - name: run insall.sh + run: /bin/bash install.sh - name: touch config.local.php run: touch config.local.php && php -v @@ -73,8 +73,8 @@ jobs: php-version: '7.4' tools: composer - - name: setup templates_c - run: mkdir templates_c || true + - name: run insall.sh + run: /bin/bash install.sh - name: touch config.local.php run: touch config.local.php && php -v diff --git a/install.sh b/install.sh new file mode 100644 index 00000000..4785fb32 --- /dev/null +++ b/install.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +set -eu + + +COMPOSER_URL=https://getcomposer.org/download/latest-stable/composer.phar + +cd "$(dirname "$0")" + +# Check for $(pwd)/composer.phar + +echo " * Checking for composer.phar " + +if [ ! -f composer.phar ]; then + + echo " * Trying to download composer.phar from $COMPOSER_URL " + # try and download it one way or another + if [ -x /usr/bin/wget ]; then + wget -q -O composer.phar $COMPOSER_URL + else + if [ -x /usr/bin/curl ]; then + curl -o composer.phar $COMPOSER_URL + else + echo " ** Could not find wget or curl; please download $COMPOSER_URL to pwd" >/dev/stderr + exit 1 + fi + fi +fi + +echo " * Running composer install --no-dev" + +php composer.phar install --prefer-dist -n --no-dev + + +if [ ! -d templates_c ]; then + + echo " * Warning: templates_c didn't exist. I have created it, but you might want to change the ownership and reduce permissions" + + # should really fix ownership to be that of the webserver; is there a nice way to discover which ? (www-data ?) + mkdir -p templates_c && chmod 777 templates_c +fi +echo +echo "Please continue configuration / setup within your web browser. " +echo "See also : https://github.com/postfixadmin/postfixadmin/blob/master/INSTALL.TXT#L58 " +echo