瀏覽代碼

Merge branch 'markshust:master' into feature/remove-network-cmd

dk4software 1 年之前
父節點
當前提交
091c33a97c
共有 6 個文件被更改,包括 32 次插入9 次删除
  1. 5 5
      README.md
  2. 3 0
      compose/bin/copyfromcontainer
  3. 21 0
      compose/bin/magento-version
  4. 1 0
      compose/bin/setup-install
  5. 1 3
      compose/bin/setup-integration-tests
  6. 1 1
      lib/onelinesetup

+ 5 - 5
README.md

@@ -131,10 +131,10 @@ mkdir -p ~/Sites/magento
 cd $_
 cd $_
 
 
 # Run this automated one-liner from the directory you want to install your project.
 # Run this automated one-liner from the directory you want to install your project.
-curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento.test 2.4.6 community
+curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento.test 2.4.6-p2 community
 ```
 ```
 
 
-The `magento.test` above defines the hostname to use, and the `2.4.6` defines the Magento version to install. Note that since we need a write to `/etc/hosts` for DNS resolution, you will be prompted for your system password during setup.
+The `magento.test` above defines the hostname to use, and the `2.4.6-p2` defines the Magento version to install. Note that since we need a write to `/etc/hosts` for DNS resolution, you will be prompted for your system password during setup.
 
 
 After the one-liner above completes running, you should be able to access your site at `https://magento.test`.
 After the one-liner above completes running, you should be able to access your site at `https://magento.test`.
 
 
@@ -162,10 +162,10 @@ cd $_
 curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash
 curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash
 
 
 # Download the version of Magento you want to use with:
 # Download the version of Magento you want to use with:
-bin/download 2.4.6 community
+bin/download 2.4.6-p2 community
 # You can specify the version and type (community, enterprise, mageos, mageos-nightly, mageos-mirror, mageos-hypernode-mirror, or mageos-maxcluster-mirror).
 # You can specify the version and type (community, enterprise, mageos, mageos-nightly, mageos-mirror, mageos-hypernode-mirror, or mageos-maxcluster-mirror).
 # The mageos type is an alias for mageos-mirror.
 # The mageos type is an alias for mageos-mirror.
-# If no arguments are passed, "2.4.6" and "community" are the default values used.
+# If no arguments are passed, "2.4.6-p2" and "community" are the default values used.
 
 
 # or for Magento core development:
 # or for Magento core development:
 # bin/start --no-dev
 # bin/start --no-dev
@@ -279,7 +279,7 @@ It is recommended to keep your root docker config files in one repository, and y
 - `bin/dev-urn-catalog-generate`: Generate URN's for PhpStorm and remap paths to local host. Restart PhpStorm after running this command.
 - `bin/dev-urn-catalog-generate`: Generate URN's for PhpStorm and remap paths to local host. Restart PhpStorm after running this command.
 - `bin/devconsole`: Alias for `bin/n98-magerun2 dev:console`
 - `bin/devconsole`: Alias for `bin/n98-magerun2 dev:console`
 - `bin/docker-compose`: Support V1 (`docker-compose`) and V2 (`docker compose`) docker compose command, and use custom configuration files, such as `compose.yml` and `compose.dev.yml`
 - `bin/docker-compose`: Support V1 (`docker-compose`) and V2 (`docker compose`) docker compose command, and use custom configuration files, such as `compose.yml` and `compose.dev.yml`
-- `bin/download`: Download specific Magento version from Composer to the container, with optional arguments of the version (2.4.6 [default]) and type ("community" [default], "enterprise", or "mageos"). Ex. `bin/download 2.4.6 enterprise`
+- `bin/download`: Download specific Magento version from Composer to the container, with optional arguments of the version (2.4.6-p2 [default]) and type ("community" [default], "enterprise", or "mageos"). Ex. `bin/download 2.4.6-p2 enterprise`
 - `bin/debug-cli`: Enable Xdebug for bin/magento, with an optional argument of the IDE key. Defaults to PHPSTORM Ex. `bin/debug-cli enable PHPSTORM`
 - `bin/debug-cli`: Enable Xdebug for bin/magento, with an optional argument of the IDE key. Defaults to PHPSTORM Ex. `bin/debug-cli enable PHPSTORM`
 - `bin/fixowns`: This will fix filesystem ownerships within the container.
 - `bin/fixowns`: This will fix filesystem ownerships within the container.
 - `bin/fixperms`: This will fix filesystem permissions within the container.
 - `bin/fixperms`: This will fix filesystem permissions within the container.

+ 3 - 0
compose/bin/copyfromcontainer

@@ -2,6 +2,9 @@
 [ -z "$1" ] && echo "Please specify a directory or file to copy from container (ex. vendor, --all)" && exit
 [ -z "$1" ] && echo "Please specify a directory or file to copy from container (ex. vendor, --all)" && exit
 
 
 REAL_SRC=$(cd -P "src" && pwd)
 REAL_SRC=$(cd -P "src" && pwd)
+if [ ! -d "$REAL_SRC" ]; then
+  mkdir -p "$REAL_SRC"
+fi
 if [ "$1" == "--all" ]; then
 if [ "$1" == "--all" ]; then
   docker cp "$(bin/docker-compose ps -q phpfpm|awk '{print $1}')":/var/www/html/./ "$REAL_SRC/"
   docker cp "$(bin/docker-compose ps -q phpfpm|awk '{print $1}')":/var/www/html/./ "$REAL_SRC/"
   echo "Completed copying all files from container to host"
   echo "Completed copying all files from container to host"

+ 21 - 0
compose/bin/magento-version

@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+# Method 1: Using bin/magento --version
+version=$(bin/magento --version --no-ansi 2> /dev/null | cut -d" " -f 3)
+
+if [[ -z "$version" ]]; then
+    # Method 2: Using grep in composer.lock
+    version=$(grep -A 1 "magento/magento2-base" ./src/composer.lock | grep "version" | awk -F "\"" '{print $4}')
+fi
+
+if [[ -z "$version" ]]; then
+    # Method 3: Using bin/yq in composer.json
+    version=$(bin/yq -oj '.version' ./src/composer.json | sed 's/"//g')
+fi
+
+# If version is still not obtained, output error message
+if [[ -z "$version" ]]; then
+    echo "Failed to retrieve Magento version."
+else
+    echo "$version"
+fi

+ 1 - 0
compose/bin/setup-install

@@ -53,4 +53,5 @@ bin/clinotty bin/magento setup:install \
   --opensearch-port="$OPENSEARCH_PORT" \
   --opensearch-port="$OPENSEARCH_PORT" \
   --search-engine=opensearch \
   --search-engine=opensearch \
   --use-rewrites=1 \
   --use-rewrites=1 \
+  --cleanup-database \
   --no-interaction
   --no-interaction

+ 1 - 3
compose/bin/setup-integration-tests

@@ -13,9 +13,7 @@ bin/clinotty mysql -h"${MYSQL_INTEGRATION_HOST}" -uroot -p"${MYSQL_ROOT_PASSWORD
     -e "GRANT ALL PRIVILEGES ON ${MYSQL_INTEGRATION_DATABASE}.* TO '${MYSQL_INTEGRATION_USER}'@'%';FLUSH PRIVILEGES;"
     -e "GRANT ALL PRIVILEGES ON ${MYSQL_INTEGRATION_DATABASE}.* TO '${MYSQL_INTEGRATION_USER}'@'%';FLUSH PRIVILEGES;"
 
 
 if [[ ! -f "src/${MYSQL_INTEGRATION_CONFIG}" ]]; then
 if [[ ! -f "src/${MYSQL_INTEGRATION_CONFIG}" ]]; then
-  MAGENTO_VERSION=$(bin/magento --version --no-ansi | cut -d" " -f 3)
-  IFS=. read -r -a MAGENTO_VERSION_SEGMENTS <<< "${MAGENTO_VERSION}"
-  MAGENTO_MAJOR="${MAGENTO_VERSION_SEGMENTS[0]}.${MAGENTO_VERSION_SEGMENTS[1]}"
+  MAGENTO_MAJOR=$(bin/magento-version | cut -d'.' -f1,2)
   cp template/"${MYSQL_INTEGRATION_CONFIG}"."${MAGENTO_MAJOR}".dist src/${MYSQL_INTEGRATION_CONFIG}
   cp template/"${MYSQL_INTEGRATION_CONFIG}"."${MAGENTO_MAJOR}".dist src/${MYSQL_INTEGRATION_CONFIG}
 fi
 fi
 
 

+ 1 - 1
lib/onelinesetup

@@ -2,7 +2,7 @@
 set -o errexit
 set -o errexit
 
 
 DOMAIN=${1:-magento.test}
 DOMAIN=${1:-magento.test}
-VERSION=${2:-2.4.6}
+VERSION=${2:-2.4.6-p2}
 EDITION=${3:-community}
 EDITION=${3:-community}
 
 
 curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash
 curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash