generated from devcontainers/feature-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- @format --> | ||
|
||
# Utils Feature | ||
|
||
This feature installs the PHP Extension Community Library (PECL) in the dev container. PECL is a repository for PHP extensions. | ||
|
||
More information about PECL can be found on the [PECL website](https://pecl.php.net/). | ||
|
||
## Example Usage | ||
|
||
```json | ||
"features": { | ||
"ghcr.io/tomgrv/devcontainer-features/pecl:1": { | ||
"extension": "zip" | ||
} | ||
} | ||
``` | ||
|
||
## Options | ||
|
||
| Options Id | Description | Type | Default Value | | ||
| ---------- | ------------------------------------- | ------ | ------------- | | ||
| version | The version of GitVersion to install. | string | latest | | ||
|
||
## Contributing | ||
|
||
If you have a feature that you would like to add to this repository, please open an issue or submit a pull request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
### Init directories | ||
export source=$(dirname $(readlink -f $(ps -o comm= $PPID))) | ||
export feature=$(basename $source | sed 's/_.*$//') | ||
export target=${1:-/usr/local/share}/$feature | ||
|
||
### Logs | ||
echo "Activating feature <$feature>" | ||
echo "from <$source>" | ||
echo "to <$target>" | ||
|
||
### Makes sure the target directory exists | ||
mkdir -p $target | ||
|
||
### Install specific utils | ||
find $source \( -name "_*" -o -name "install-*.sh" \) -type f -exec cp {} $target \; | ||
find $target -type f -name "install-*.sh" -exec chmod +x {} \; -exec ln -s {} /usr/bin/ \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "Common Utils", | ||
"version": "1.0.0", | ||
"description": "Common utils for tomgrv/devcontainer-features", | ||
"dependsOn": { | ||
"ghcr.io/devcontainers/features/common-utils": "lts" | ||
}, | ||
"id": "tomgrv-common-utils", | ||
"installsAfter": [ | ||
"ghcr.io/devcontainers/features/common-utils" | ||
], | ||
"options": { | ||
"utils": { | ||
"type": "string", | ||
"default": "jq dos2unix", | ||
"description": "utilities to install" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
### Options | ||
UTILS="${UTILS:-"jq dos2unix"}" | ||
|
||
### Install utils | ||
for bin in $UTILS; do | ||
if [ -n "$(command -v $bin)" ]; then | ||
echo "$bin is installed." | ||
elif [ -f /etc/alpine-release ]; then | ||
apk update | ||
apk add $bin | ||
elif [ $(uname) = "Linux" ] || [ $(uname) = "Darwin" ]; then | ||
sudo apt-get update | ||
sudo apt-get install -y $bin | ||
else | ||
echo "Please install $bin." | ||
exit 1 | ||
fi | ||
done | ||
|
||
|