Skip to content

Commit

Permalink
Merge pull request #227 from Automattic/refactor-vip-go-mu-plugins
Browse files Browse the repository at this point in the history
refactor(vip-go-mu-plugins): better support for various base images
  • Loading branch information
sjinks authored Jun 2, 2024
2 parents 7c10c57 + 13ec824 commit 56eb733
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
2 changes: 1 addition & 1 deletion features/src/vip-go-mu-plugins/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "vip-go-mu-plugins",
"name": "VIP Go MU Plugins",
"version": "2.0.2",
"version": "2.1.0",
"description": "Installs VIP Go MU Plugins into the Dev Environment",
"options": {
"enabled": {
Expand Down
47 changes: 46 additions & 1 deletion features/src/vip-go-mu-plugins/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,52 @@ fi
if [ "${ENABLED}" != "false" ]; then
echo '(*) Installing VIP Go mu-plugins...'

mkdir -p /wp/wp-content/mu-plugins
PACKAGES=""
if ! hash git >/dev/null 2>&1; then
PACKAGES="${PACKAGES} git"
fi

if ! hash update-ca-certificates >/dev/null 2>&1; then
PACKAGES="${PACKAGES} ca-certificates"
fi

if ! hash rsync >/dev/null 2>&1; then
PACKAGES="${PACKAGES} rsync"
fi

# shellcheck source=/dev/null
. /etc/os-release
: "${ID:=}"
: "${ID_LIKE:=${ID}}"

case "${ID_LIKE}" in
"debian")
export DEBIAN_FRONTEND=noninteractive
if [ -n "${PACKAGES}" ]; then
apt-get update
# shellcheck disable=SC2086
apt-get install -y --no-install-recommends ${PACKAGES}
update-rc.d -f rsync remove
apt-get clean
rm -rf /var/lib/apt/lists/*
fi
;;

"alpine")
if [ -n "${PACKAGES}" ]; then
# shellcheck disable=SC2086
apk add --no-cache ${PACKAGES}
fi
;;

*)
echo "Unsupported distribution: ${ID_LIKE}"
exit 1
;;
esac

install -D -d -m 0755 -o "${_REMOTE_USER}" -g "${_REMOTE_USER}" /wp/wp-content/mu-plugins

git clone --depth=1 --recurse-submodules --shallow-submodules https://github.com/Automattic/vip-go-mu-plugins.git /tmp/mu-plugins --branch "${BRANCH}" --single-branch -j4
git clone --depth=1 https://github.com/Automattic/vip-go-mu-plugins-ext.git /tmp/mu-plugins-ext --single-branch
if [ "${DEVELOPMENT_MODE}" != 'true' ]; then
Expand Down

0 comments on commit 56eb733

Please sign in to comment.