-
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
1 parent
6c4b582
commit b45d167
Showing
34 changed files
with
2,287 additions
and
25 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,26 @@ | ||
## OS Support | ||
|
||
This Feature should work on recent versions of Debian/Ubuntu, RedHat Enterprise Linux, Fedora, RockyLinux, and Alpine Linux. | ||
|
||
## Using with dev container images | ||
|
||
This Feature is used in many of the [dev container images](https://github.com/search?q=repo%3Adevcontainers%2Fimages+%22ghcr.io%2Fdevcontainers%2Ffeatures%2Fcommon-utils%22&type=code), as a result | ||
these images have already allocated UID & GID 1000. Attempting to add this Feature with UID 1000 and/or GID 1000 on top of such a dev container image will result in an error when building the dev container. | ||
|
||
## Customizing the command prompt | ||
|
||
By default, this script provides a custom command prompt that includes information about the git repository for the current folder. However, with certain large repositories, this can result in a slow command prompt due to the performance of needed git operations. | ||
|
||
For performance reasons, a "dirty" indicator that tells you whether or not there are uncommitted changes is disabled by default. You can opt to turn this on for smaller repositories by entering the following in a terminal or adding it to your `postCreateCommand`: | ||
|
||
```bash | ||
git config devcontainers-theme.show-dirty 1 | ||
``` | ||
|
||
To completely disable the git portion of the prompt for the current folder's repository, you can use this configuration setting instead: | ||
|
||
```bash | ||
git config devcontainers-theme.hide-status 1 | ||
``` | ||
|
||
For `zsh`, the default theme is a [standard Oh My Zsh! theme](https://ohmyz.sh/). You may pick a different one by modifying the `ZSH_THEME` variable in `~/.zshrc`. |
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,58 @@ | ||
|
||
# Common Utilities (common-utils) | ||
|
||
Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user. | ||
|
||
## Example Usage | ||
|
||
```json | ||
"features": { | ||
"ghcr.io/devcontainers/features/common-utils:2": {} | ||
} | ||
``` | ||
|
||
## Options | ||
|
||
| Options Id | Description | Type | Default Value | | ||
|-----|-----|-----|-----| | ||
| installZsh | Install ZSH? | boolean | true | | ||
| configureZshAsDefaultShell | Change default shell to ZSH? | boolean | false | | ||
| installOhMyZsh | Install Oh My Zsh!? | boolean | true | | ||
| installOhMyZshConfig | Allow installing the default dev container .zshrc templates? | boolean | true | | ||
| upgradePackages | Upgrade OS packages? | boolean | true | | ||
| username | Enter name of a non-root user to configure or none to skip | string | automatic | | ||
| userUid | Enter UID for non-root user | string | automatic | | ||
| userGid | Enter GID for non-root user | string | automatic | | ||
| nonFreePackages | Add packages from non-free Debian repository? (Debian only) | boolean | false | | ||
|
||
## OS Support | ||
|
||
This Feature should work on recent versions of Debian/Ubuntu, RedHat Enterprise Linux, Fedora, RockyLinux, and Alpine Linux. | ||
|
||
## Using with dev container images | ||
|
||
This Feature is used in many of the [dev container images](https://github.com/search?q=repo%3Adevcontainers%2Fimages+%22ghcr.io%2Fdevcontainers%2Ffeatures%2Fcommon-utils%22&type=code), as a result | ||
these images have already allocated UID & GID 1000. Attempting to add this Feature with UID 1000 and/or GID 1000 on top of such a dev container image will result in an error when building the dev container. | ||
|
||
## Customizing the command prompt | ||
|
||
By default, this script provides a custom command prompt that includes information about the git repository for the current folder. However, with certain large repositories, this can result in a slow command prompt due to the performance of needed git operations. | ||
|
||
For performance reasons, a "dirty" indicator that tells you whether or not there are uncommitted changes is disabled by default. You can opt to turn this on for smaller repositories by entering the following in a terminal or adding it to your `postCreateCommand`: | ||
|
||
```bash | ||
git config devcontainers-theme.show-dirty 1 | ||
``` | ||
|
||
To completely disable the git portion of the prompt for the current folder's repository, you can use this configuration setting instead: | ||
|
||
```bash | ||
git config devcontainers-theme.hide-status 1 | ||
``` | ||
|
||
For `zsh`, the default theme is a [standard Oh My Zsh! theme](https://ohmyz.sh/). You may pick a different one by modifying the `ZSH_THEME` variable in `~/.zshrc`. | ||
|
||
|
||
--- | ||
|
||
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/common-utils/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ |
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,16 @@ | ||
#!/bin/sh | ||
|
||
get_in_path_except_current() { | ||
which -a "$1" | grep -A1 "$0" | grep -v "$0" | ||
} | ||
|
||
code="$(get_in_path_except_current code)" | ||
|
||
if [ -n "$code" ]; then | ||
exec "$code" "$@" | ||
elif [ "$(command -v code-insiders)" ]; then | ||
exec code-insiders "$@" | ||
else | ||
echo "code or code-insiders is not installed" >&2 | ||
exit 127 | ||
fi |
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,35 @@ | ||
#!/bin/sh | ||
|
||
# Load meta.env | ||
if [ -f "/usr/local/etc/vscode-dev-containers/meta.env" ]; then | ||
. /usr/local/etc/vscode-dev-containers/meta.env | ||
fi | ||
if [ -f "/usr/local/etc/dev-containers/meta.env" ]; then | ||
. /usr/local/etc/dev-containers/meta.env | ||
fi | ||
|
||
# Minimal output | ||
if [ "$1" = "version" ] || [ "$1" = "image-version" ]; then | ||
echo "${VERSION}" | ||
exit 0 | ||
elif [ "$1" = "release" ]; then | ||
echo "${GIT_REPOSITORY_RELEASE}" | ||
exit 0 | ||
elif [ "$1" = "content" ] || [ "$1" = "content-url" ] || [ "$1" = "contents" ] || [ "$1" = "contents-url" ]; then | ||
echo "${CONTENTS_URL}" | ||
exit 0 | ||
fi | ||
|
||
#Full output | ||
echo | ||
echo "Development container image information" | ||
echo | ||
if [ ! -z "${VERSION}" ]; then echo "- Image version: ${VERSION}"; fi | ||
if [ ! -z "${DEFINITION_ID}" ]; then echo "- Definition ID: ${DEFINITION_ID}"; fi | ||
if [ ! -z "${VARIANT}" ]; then echo "- Variant: ${VARIANT}"; fi | ||
if [ ! -z "${GIT_REPOSITORY}" ]; then echo "- Source code repository: ${GIT_REPOSITORY}"; fi | ||
if [ ! -z "${GIT_REPOSITORY_RELEASE}" ]; then echo "- Source code release/branch: ${GIT_REPOSITORY_RELEASE}"; fi | ||
if [ ! -z "${GIT_REPOSITORY_REVISION}" ]; then echo "- Source code revision: ${GIT_REPOSITORY_REVISION}"; fi | ||
if [ ! -z "${BUILD_TIMESTAMP}" ]; then echo "- Timestamp: ${BUILD_TIMESTAMP}"; fi | ||
if [ ! -z "${CONTENTS_URL}" ]; then echo && echo "More info: ${CONTENTS_URL}"; fi | ||
echo |
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,7 @@ | ||
#!/bin/sh | ||
set -e | ||
if [ -d "/run/systemd/system" ]; then | ||
exec /bin/systemctl "$@" | ||
else | ||
echo '\n"systemd" is not running in this container due to its overhead.\nUse the "service" command to start services instead. e.g.: \n\nservice --status-all' | ||
fi |
69 changes: 69 additions & 0 deletions
69
.devcontainer/.devpod-internal/0/devcontainer-feature.json
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,69 @@ | ||
{ | ||
"id": "common-utils", | ||
"version": "2.3.0", | ||
"name": "Common Utilities", | ||
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils", | ||
"description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.", | ||
"options": { | ||
"installZsh": { | ||
"type": "boolean", | ||
"default": true, | ||
"description": "Install ZSH?" | ||
}, | ||
"configureZshAsDefaultShell": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Change default shell to ZSH?" | ||
}, | ||
"installOhMyZsh": { | ||
"type": "boolean", | ||
"default": true, | ||
"description": "Install Oh My Zsh!?" | ||
}, | ||
"installOhMyZshConfig": { | ||
"type": "boolean", | ||
"default": true, | ||
"description": "Allow installing the default dev container .zshrc templates?" | ||
}, | ||
"upgradePackages": { | ||
"type": "boolean", | ||
"default": true, | ||
"description": "Upgrade OS packages?" | ||
}, | ||
"username": { | ||
"type": "string", | ||
"proposals": [ | ||
"devcontainer", | ||
"vscode", | ||
"codespace", | ||
"none", | ||
"automatic" | ||
], | ||
"default": "automatic", | ||
"description": "Enter name of a non-root user to configure or none to skip" | ||
}, | ||
"userUid": { | ||
"type": "string", | ||
"proposals": [ | ||
"1001", | ||
"automatic" | ||
], | ||
"default": "automatic", | ||
"description": "Enter UID for non-root user" | ||
}, | ||
"userGid": { | ||
"type": "string", | ||
"proposals": [ | ||
"1001", | ||
"automatic" | ||
], | ||
"default": "automatic", | ||
"description": "Enter GID for non-root user" | ||
}, | ||
"nonFreePackages": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Add packages from non-free Debian repository? (Debian only)" | ||
} | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
.devcontainer/.devpod-internal/0/devcontainer-features-install.sh
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,38 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
on_exit () { | ||
[ $? -eq 0 ] && exit | ||
echo 'ERROR: Feature "Common Utilities" (ghcr.io/devcontainers/features/common-utils) failed to install! Look at the documentation at ${documentation} for help troubleshooting this error.' | ||
} | ||
|
||
trap on_exit EXIT | ||
|
||
set -a | ||
. ../devcontainer-features.builtin.env | ||
. ./devcontainer-features.env | ||
set +a | ||
|
||
echo =========================================================================== | ||
|
||
echo 'Feature : Common Utilities' | ||
echo 'Description : Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.' | ||
echo 'Id : ghcr.io/devcontainers/features/common-utils' | ||
echo 'Version : 2.3.0' | ||
echo 'Documentation : https://github.com/devcontainers/features/tree/main/src/common-utils' | ||
echo 'Options :' | ||
echo ' INSTALLZSH="true" | ||
CONFIGUREZSHASDEFAULTSHELL="true" | ||
USERUID="automatic" | ||
INSTALLOHMYZSHCONFIG="true" | ||
UPGRADEPACKAGES="true" | ||
USERNAME="automatic" | ||
NONFREEPACKAGES="false" | ||
INSTALLOHMYZSH="false" | ||
USERGID="automatic"' | ||
echo 'Environment :' | ||
printenv | ||
echo =========================================================================== | ||
|
||
chmod +x ./install.sh | ||
./install.sh |
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,9 @@ | ||
INSTALLZSH="true" | ||
CONFIGUREZSHASDEFAULTSHELL="true" | ||
USERUID="automatic" | ||
INSTALLOHMYZSHCONFIG="true" | ||
UPGRADEPACKAGES="true" | ||
USERNAME="automatic" | ||
NONFREEPACKAGES="false" | ||
INSTALLOHMYZSH="false" | ||
USERGID="automatic" |
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,36 @@ | ||
#!/bin/sh | ||
#------------------------------------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See https://github.com/devcontainers/features/blob/main/LICENSE for license information. | ||
#------------------------------------------------------------------------------------------------------------------------- | ||
# | ||
# Docs: https://github.com/devcontainers/features/tree/main/src/common-utils | ||
# Maintainer: The Dev Container spec maintainers | ||
|
||
set -e | ||
|
||
INSTALL_ZSH="${INSTALLZSH:-"true"}" | ||
CONFIGURE_ZSH_AS_DEFAULT_SHELL="${CONFIGUREZSHASDEFAULTSHELL:-"false"}" | ||
INSTALL_OH_MY_ZSH="${INSTALLOHMYZSH:-"true"}" | ||
INSTALL_OH_MY_ZSH_CONFIG="${INSTALLOHMYZSHCONFIG:-"true"}" | ||
UPGRADE_PACKAGES="${UPGRADEPACKAGES:-"true"}" | ||
USERNAME="${USERNAME:-"automatic"}" | ||
USER_UID="${UID:-"automatic"}" | ||
USER_GID="${GID:-"automatic"}" | ||
ADD_NON_FREE_PACKAGES="${NONFREEPACKAGES:-"false"}" | ||
|
||
MARKER_FILE="/usr/local/etc/vscode-dev-containers/common" | ||
|
||
if [ "$(id -u)" -ne 0 ]; then | ||
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' | ||
exit 1 | ||
fi | ||
|
||
# If we're using Alpine, install bash before executing | ||
. /etc/os-release | ||
if [ "${ID}" = "alpine" ]; then | ||
apk add --no-cache bash | ||
fi | ||
|
||
exec /bin/bash "$(dirname $0)/main.sh" "$@" | ||
exit $? |
Oops, something went wrong.