Skip to content

Commit

Permalink
Update postCreateCommand (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
markphip authored Oct 10, 2023
1 parent 6a6cb47 commit 2eca587
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/devtool/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "DevTool",
"id": "devtool",
"version": "1.0.0",
"version": "1.0.1",
"description": "Install DevTool",
"installsAfter": [
"ghcr.io/devcontainers/features/common-utils"
Expand All @@ -13,5 +13,5 @@
]
}
},
"postCreateCommand": "curl -sL https://aka.ms/InstallToolLinux.sh | sh -s DevTool"
"postCreateCommand": "/usr/local/share/install-devtool.sh"
}
27 changes: 27 additions & 0 deletions src/devtool/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,31 @@ else
check_packages curl ca-certificates xdg-utils
fi

# --- Generate a 'install-devtool.sh' script to be executed by the 'postCreateCommand' lifecycle hook
DEVTOOL_SCRIPT_PATH="/usr/local/share/install-devtool.sh"

tee "$DEVTOOL_SCRIPT_PATH" > /dev/null \
<< EOF
#!/bin/bash
set -e
EOF

tee -a "$DEVTOOL_SCRIPT_PATH" > /dev/null \
<< 'EOF'
echo "Installing DevTool..."
# Wait up to 3 minutes for the ado-auth-helper to be installed
for i in {1..180}; do
if [ -f ${HOME}/ado-auth-helper ]; then
break
fi
sleep 1
done
cd /tmp
curl -sL https://aka.ms/InstallToolLinux.sh | sh -s DevTool
EOF

chmod 755 "$DEVTOOL_SCRIPT_PATH"

exit 0
2 changes: 1 addition & 1 deletion test/devtool/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
source dev-container-features-test-lib

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


# Report results
Expand Down

0 comments on commit 2eca587

Please sign in to comment.