ESP32 Platform Documentation

Updating

Updating (public repository)

Updating repository using Git CLI
# cd to the root of the application
# eg /esp32
cd /esp32
git pull

Using package

Updating (private repository)

  • Assuming you followed deployment key setup in Cloning
  • If you use a fork, replace 'mhoek2' in the following snippets with your username
  1. Create a update.sh file
    # dedicated server:
    # cd to the root of the application.
    cd /var/www/html/esp32
    
    # or for docker:
    cd /esp32
    
    sudo nano update.sh
  2. Write to update.sh
    #!/bin/bash
    #
    
    # Check if ssh-agent is running
    if [ -z "$SSH_AUTH_SOCK" ]; then
        echo "Starting ssh-agent..."
        eval "$(ssh-agent -s)"
    fi
    
    # Check if the key is already added
    if ! ssh-add -l | grep -q "esp-deploy"; then
        echo "Adding SSH key..."
        ssh-add ~/.ssh/esp-deploy
    else
        echo "SSH key already added."
    fi
    
    # Update the repo
    git pull git@github.com:mhoek2/esp32.git
  3. Make update.sh executable
    sudo chmod +x update.sh
  4. Run update.sh
    ./update.sh

Notes

  1. If changes were made to .env which prevents pulling:
    # export changes
    git diff > changes.log
    
    # restore to original
    git restore .env
    
    # pull
    git pull
    
    # restore
    git restore changes.log

Search results