-
Notifications
You must be signed in to change notification settings - Fork 27
Improve one-shot dev environment setup #665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| 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 | ||
| 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." | ||||||||||||
|
|
@@ -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
|
||||||||||||
| 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" |
There was a problem hiding this comment.
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 --envsoutput includes comment lines (starting with #) and a header line. These will be included in the grep search, potentially causing false matches. Usegrep -v '^#'to filter out comment lines before the awk command:if ! conda info --envs | grep -v '^#' | awk '{print $1}' | grep -qx \"$ENV_NAME\"; then