Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 27 additions & 11 deletions dev_env_setup_scripts/00-setup-conda.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm ~/miniconda3/miniconda.sh
#!/bin/bash

source ~/miniconda3/bin/activate
set -euo pipefail

MINICONDA_DIR="$HOME/miniconda3"
INSTALLER_PATH="$MINICONDA_DIR/miniconda.sh"
ENV_NAME="reallmforge"

mkdir -p "$MINICONDA_DIR"
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O "$INSTALLER_PATH"
bash "$INSTALLER_PATH" -b -u -p "$MINICONDA_DIR"
rm "$INSTALLER_PATH"

source "$MINICONDA_DIR/bin/activate"

conda init --all

env_name="reallmforge"
conda create --name reallmforge python=3.10
echo 'conda activate reallmforge' >> ~/.zshrc
echo 'conda activate reallmforge' >> ~/.bashrc
if ! conda info --envs | awk '{print $1}' | grep -qx "$ENV_NAME"; then
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The awk command extracts the first column, but conda info --envs output includes comment lines (starting with #) and a header line. These will be included in the grep search, potentially causing false matches. Use grep -v '^#' to filter out comment lines before the awk command: if ! conda info --envs | grep -v '^#' | awk '{print $1}' | grep -qx \"$ENV_NAME\"; then

Suggested change
if ! conda info --envs | awk '{print $1}' | grep -qx "$ENV_NAME"; then
if ! conda info --envs | grep -v '^#' | awk '{print $1}' | grep -qx "$ENV_NAME"; then

Copilot uses AI. Check for mistakes.
conda create --name "$ENV_NAME" python=3.10 -y
fi

if ! grep -Fq "conda activate $ENV_NAME" ~/.zshrc 2>/dev/null; then
echo "conda activate $ENV_NAME" >> ~/.zshrc
fi

if ! grep -Fq "conda activate $ENV_NAME" ~/.bashrc 2>/dev/null; then
echo "conda activate $ENV_NAME" >> ~/.bashrc
fi

sudo apt install build-essential
sudo apt install python3-pip
sudo apt update
sudo apt install -y build-essential
sudo apt install -y python3-pip
13 changes: 12 additions & 1 deletion dev_env_setup_scripts/install_all.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Exit immediately if a command exits with a non-zero status.
set -e
set -euo pipefail

echo "Note, these scripts can override local dotfiles, and are intended for use
with newly instantiated VMs, and not tested for existing setups."
Expand All @@ -22,6 +22,17 @@ log "Starting the full machine setup..."
log "Step 0: Setting up system packages..."
bash ./00-setup-conda.sh

log "Activating conda environment..."
CONDA_SH="$HOME/miniconda3/etc/profile.d/conda.sh"
Comment on lines +25 to +26
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded path $HOME/miniconda3 duplicates the installation directory defined in 00-setup-conda.sh as MINICONDA_DIR. If the installation path changes in one script, it must be updated here as well. Consider extracting this to a shared configuration variable or sourcing it from the previous script.

Suggested change
log "Activating conda environment..."
CONDA_SH="$HOME/miniconda3/etc/profile.d/conda.sh"
# Source MINICONDA_DIR from 00-setup-conda.sh (assumes it exports MINICONDA_DIR)
source ./00-setup-conda.sh
CONDA_SH="$MINICONDA_DIR/etc/profile.d/conda.sh"

Copilot uses AI. Check for mistakes.
if [ -f "$CONDA_SH" ]; then
# shellcheck disable=SC1090
source "$CONDA_SH"
conda activate reallmforge
else
echo "Unable to locate conda initialization script at $CONDA_SH"
exit 1
fi

log "Step 1: Setting up Zsh..."
bash ./01-setup-zsh.sh

Expand Down