Skip to content

Commit 2eca587

Browse files
authored
Update postCreateCommand (#43)
1 parent 6a6cb47 commit 2eca587

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

src/devtool/devcontainer-feature.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "DevTool",
33
"id": "devtool",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"description": "Install DevTool",
66
"installsAfter": [
77
"ghcr.io/devcontainers/features/common-utils"
@@ -13,5 +13,5 @@
1313
]
1414
}
1515
},
16-
"postCreateCommand": "curl -sL https://aka.ms/InstallToolLinux.sh | sh -s DevTool"
16+
"postCreateCommand": "/usr/local/share/install-devtool.sh"
1717
}

src/devtool/install.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,31 @@ else
3737
check_packages curl ca-certificates xdg-utils
3838
fi
3939

40+
# --- Generate a 'install-devtool.sh' script to be executed by the 'postCreateCommand' lifecycle hook
41+
DEVTOOL_SCRIPT_PATH="/usr/local/share/install-devtool.sh"
42+
43+
tee "$DEVTOOL_SCRIPT_PATH" > /dev/null \
44+
<< EOF
45+
#!/bin/bash
46+
set -e
47+
EOF
48+
49+
tee -a "$DEVTOOL_SCRIPT_PATH" > /dev/null \
50+
<< 'EOF'
51+
52+
echo "Installing DevTool..."
53+
# Wait up to 3 minutes for the ado-auth-helper to be installed
54+
for i in {1..180}; do
55+
if [ -f ${HOME}/ado-auth-helper ]; then
56+
break
57+
fi
58+
sleep 1
59+
done
60+
61+
cd /tmp
62+
curl -sL https://aka.ms/InstallToolLinux.sh | sh -s DevTool
63+
EOF
64+
65+
chmod 755 "$DEVTOOL_SCRIPT_PATH"
66+
4067
exit 0

test/devtool/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -e
66
source dev-container-features-test-lib
77

88
# Feature-specific tests
9-
check "dev" dev --version
9+
check "devtool" cat /usr/local/share/install-devtool.sh
1010

1111

1212
# Report results

0 commit comments

Comments
 (0)