Skip to content

Commit 4b2d64e

Browse files
authored
Merge pull request #294 from djensenius/codespace-things
Codespace things
2 parents 264f861 + 68ec3f7 commit 4b2d64e

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

install.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ else
6464
echo "" >> $LOG_FILE
6565
fi
6666

67+
# Helper function to detect Codespaces environment
68+
is_codespaces() {
69+
[ -d /workspaces/github ] || [ "$USER" = "vscode" ] || [ "$USER" = "codespace" ]
70+
}
71+
6772
# Helper function to log with timing
6873
log_with_timing() {
6974
local operation="$1"
@@ -194,7 +199,7 @@ function link_files() {
194199
ln -sf "$(pwd)/k9s" ~/.config/k9s
195200

196201
# Make tmux indicator script available in PATH for tmux config
197-
if [ -d /workspaces/github ]; then
202+
if is_codespaces; then
198203
sudo ln -sf "$(pwd)/scripts/tmux-background-install-indicator.sh" /usr/local/bin/
199204
fi
200205

@@ -209,7 +214,9 @@ function link_files() {
209214
sudo ln -sf /workspaces/github/bin/solargraph /usr/local/bin/solargraph
210215
sudo ln -sf /workspaces/github/bin/safe-ruby /usr/local/bin/safe-ruby
211216
log_with_timing "Linking GitHub Codespaces Ruby tools" "$start_time"
212-
217+
fi
218+
219+
if is_codespaces; then
213220
# Background locale update as it's not immediately critical
214221
start_time=$(start_operation "Updating locale settings")
215222
(sudo update-locale LANG=en_US.UTF-8 LC_TYPE=en_US.UTF-8 LC_ALL=en_US.UTF-8) &
@@ -222,7 +229,7 @@ function link_files() {
222229
}
223230

224231
function install_software() {
225-
if [ -d /workspaces/github ]; then
232+
if is_codespaces; then
226233
# Reduce initial delay for faster startup
227234
start_time=$(start_operation "Initial system wait (5s)")
228235
sleep 5
@@ -524,7 +531,7 @@ function install_software() {
524531

525532
function setup_software() {
526533
# Final environment and shell setup (must run at the very end)
527-
if [ -d /workspaces/github ]; then
534+
if is_codespaces; then
528535
# Change shell is the only critical operation that must complete
529536
start_time=$(start_operation "Changing default shell to fish")
530537
sudo chsh -s /usr/bin/fish vscode
@@ -659,7 +666,7 @@ function start_npm_background_installation() {
659666
{
660667
echo "Installing NPM global packages..." >> $npm_log
661668

662-
if [ -d /workspaces/github ]; then
669+
if is_codespaces; then
663670
npm install -g @fsouza/prettierd yaml-language-server vscode-langservers-extracted eslint_d prettier tree-sitter neovim >> $npm_log 2>&1
664671
npm_exit_code=$?
665672

@@ -684,7 +691,7 @@ function start_npm_background_installation() {
684691
}
685692

686693
function install_ruby_gems_parallel() {
687-
if [ -d /workspaces/github ]; then
694+
if is_codespaces; then
688695
echo "Installing Ruby gems in parallel..."
689696

690697
# Install gems in parallel using background processes

0 commit comments

Comments
 (0)