Skip to content

Commit

Permalink
Merge pull request #196 from Automattic/refactor-mc
Browse files Browse the repository at this point in the history
refactor(mc): support Debian and Ubuntu
  • Loading branch information
sjinks authored May 30, 2024
2 parents 071b7f9 + ae784c0 commit d0256c3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
9 changes: 3 additions & 6 deletions features/src/mc/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
"id": "mc",
"name": "Midnight Commander",
"description": "Installs Midnight Commander into the Dev Environment",
"version": "1.0.2",
"version": "1.1.0",
"options": {
"enabled": {
"type": "boolean",
"default": false,
"default": true,
"description": "Install Midnight Commander"
}
},
"installsAfter": [
"ghcr.io/automattic/vip-codespaces/base"
]
}
}
29 changes: 25 additions & 4 deletions features/src/mc/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,31 @@ if [ "$(id -u || true)" -ne 0 ]; then
exit 1
fi

: "${ENABLED:=}"

if [ "${ENABLED}" = "true" ]; then
if [ "${ENABLED:-}" = "true" ]; then
echo '(*) Installing Midnight Commander...'
apk add --no-cache mc

# shellcheck source=/dev/null
. /etc/os-release

: "${ID:=}"
: "${ID_LIKE:=${ID}}"

case "${ID_LIKE}" in
"debian")
apt-get update
apt-get install -y --no-install-recommends mc
apt-get clean
rm -rf /var/lib/apt/lists/*
;;

"alpine")
apk add --no-cache mc
;;

*)
echo "(!) Unsupported distribution: ${ID}"
exit 1
esac

echo 'Done!'
fi

0 comments on commit d0256c3

Please sign in to comment.