Skip to content

Commit 68ec3f7

Browse files
committed
Codespace things
1 parent 1877242 commit 68ec3f7

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
@@ -649,7 +656,7 @@ function start_npm_background_installation() {
649656
{
650657
echo "Installing NPM global packages..." >> $npm_log
651658

652-
if [ -d /workspaces/github ]; then
659+
if is_codespaces; then
653660
npm install -g @fsouza/prettierd yaml-language-server vscode-langservers-extracted eslint_d prettier tree-sitter neovim >> $npm_log 2>&1
654661
npm_exit_code=$?
655662

@@ -674,7 +681,7 @@ function start_npm_background_installation() {
674681
}
675682

676683
function install_ruby_gems_parallel() {
677-
if [ -d /workspaces/github ]; then
684+
if is_codespaces; then
678685
echo "Installing Ruby gems in parallel..."
679686

680687
# Install gems in parallel using background processes

0 commit comments

Comments
 (0)