Skip to content

Commit bf3ed10

Browse files
authored
Initial DevTool feature (#40)
1 parent ca09ba5 commit bf3ed10

4 files changed

Lines changed: 65 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ to assist teams in adopting Codespaces. Here is a list of the features in this r
77
| Feature | Description |
88
| ------- | ----------- |
99
| [artifacts-helper](src/artifacts-helper) | Install Azure Artifacts credential helper configured for Codespace authentication |
10+
| [devtool](src/devtool) | Installs DevTool (Microsoft-internal only) |
1011
| [docfx](src/docfx) | Install docfx to support editing and testing documentation |
1112
| [external-repository](src/external-repository) | Handles all the details of working with an external git repository in Codespaces |
1213
| [microsoft-git](src/microsoft-git) | Install microsoft/git with Scalar and GVFS support |

src/devtool/NOTES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
This installs a Microsoft-internal tool named DevTool. This will also install
2+
the `xdg-utils` package so that the `xdg-open` CLI is available for the
3+
DevTool CLI to be able to use to open a web browser.
4+
5+
## OS Support
6+
7+
This feature is tested to work on Debian/Ubuntu
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "DevTool",
3+
"id": "devtool",
4+
"version": "1.0.0",
5+
"description": "Install DevTool",
6+
"installsAfter": [
7+
"ghcr.io/devcontainers/features/common-utils"
8+
],
9+
"customizations": {
10+
"vscode": {
11+
"extensions": [
12+
"ms-codespaces-tools.ado-codespaces-auth"
13+
]
14+
}
15+
},
16+
"postCreateCommand": "curl –sL https://aka.ms/InstallToolLinux.sh | sh -s DevTool​"
17+
}

src/devtool/install.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
6+
# Source /etc/os-release to get OS info
7+
. /etc/os-release
8+
9+
if [ "$(id -u)" -ne 0 ]; then
10+
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
11+
exit 1
12+
fi
13+
14+
apt_get_update()
15+
{
16+
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
17+
echo "Running apt-get update..."
18+
apt-get update -y
19+
fi
20+
}
21+
22+
# Checks if packages are installed and installs them if not
23+
check_packages() {
24+
if ! dpkg -s "$@" > /dev/null 2>&1; then
25+
apt_get_update
26+
apt-get -y install --no-install-recommends "$@"
27+
rm -rf /var/lib/apt/lists/*
28+
fi
29+
}
30+
31+
export DEBIAN_FRONTEND=noninteractive
32+
33+
if [ "${ID}" = "mariner" ]; then
34+
tdnf install -y curl ca-certificates
35+
tdnf clean all
36+
else
37+
check_packages curl ca-certificates xdg-utils
38+
fi
39+
40+
exit 0

0 commit comments

Comments
 (0)