Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This script will update the Arduino IDE to the latest version on your Linux Mint PC. Even if you have an older version of the Arduino IDE already installed, you may still run this script, and it will update to the latest IDE. I am currently running Linux Mint ver 22.2, and my Arduino IDE is ver 2.3.7. It also updates the ESP8266 and ESP32 libraries. You can have this script in your home directory, or create a folder ~bin and put it there. The script name is "arduino_full_setup_v3_bulletproof.sh". Make sure you make it executable with chmod +x arduino_full_setup_v3_bulletproof.sh
- then run it ./arduino_full_setup_v3_bulletproof.sh
- HTH
- #!/bin/bash
- # Arduino IDE + ESP8266 + ESP32 Full Setup (Linux Mint)
- # Auto-fetch latest Arduino IDE version from official Arduino software page
- # Updated for current release handling
- set -euo pipefail
- echo "------------------------------------------------------------"
- echo " Arduino IDE + ESP8266 + ESP32 Full Setup (Linux Mint)"
- echo " Auto-fetch latest Arduino IDE from official Arduino site"
- echo "------------------------------------------------------------"
- # ============================================================
- # 0. PATH fix (duplicate-safe)
- # ============================================================
- grep -q 'export PATH="$HOME/bin:$PATH"' ~/.bashrc || \
- echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
- export PATH="$HOME/bin:$PATH"
- mkdir -p "$HOME/Applications"
- mkdir -p "$HOME/.local/share/applications"
- mkdir -p "$HOME/bin"
- # ============================================================
- # 1. Clean old Arduino IDE AppImages only
- # Leave board packages and sketchbook alone
- # ============================================================
- echo "[+] Cleaning old Arduino IDE AppImages and cache..."
- rm -f "$HOME"/Applications/arduino-ide_*_Linux_64bit.AppImage
- rm -rf "$HOME/.cache/arduino-ide" 2>/dev/null || true
- echo ""
- # ============================================================
- # 2. Get latest Arduino IDE version from official Arduino page
- # ============================================================
- echo "[+] Checking latest Arduino IDE version from Arduino official site..."
- SOFTWARE_PAGE="$(curl -fsSL https://www.arduino.cc/en/software)"
- LATEST_VER="$(printf '%s\n' "$SOFTWARE_PAGE" \
- | grep -oE 'Arduino IDE[[:space:]]+[0-9]+\.[0-9]+\.[0-9]+' \
- | head -n1 \
- | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')"
- if [[ -z "${LATEST_VER:-}" ]]; then
- echo "[X] Could not detect latest Arduino IDE version from Arduino website."
- exit 1
- fi
- echo "[✓] Latest Arduino IDE version detected: $LATEST_VER"
- echo ""
- # ============================================================
- # 3. Download latest AppImage from Arduino CDN
- # ============================================================
- FILE_NAME="arduino-ide_${LATEST_VER}_Linux_64bit.AppImage"
- CDN_URL="https://downloads.arduino.cc/arduino-ide/${FILE_NAME}"
- DEST="$HOME/Applications/${FILE_NAME}"
- echo "[+] Downloading Arduino IDE AppImage..."
- echo " $CDN_URL"
- curl -fL --retry 3 --retry-delay 2 -o "$DEST" "$CDN_URL"
- # Basic sanity check
- MIN_SIZE=$((150 * 1024 * 1024)) # 150 MB minimum
- ACTUAL_SIZE=$(stat -c%s "$DEST")
- if [[ "$ACTUAL_SIZE" -lt "$MIN_SIZE" ]]; then
- echo "[X] Downloaded file is too small ($(du -h "$DEST" | cut -f1)). Aborting."
- rm -f "$DEST"
- exit 1
- fi
- chmod 755 "$DEST"
- echo "[✓] Arduino IDE AppImage OK ($(du -h "$DEST" | cut -f1))"
- echo ""
- # ============================================================
- # 4. Install libfuse2 if needed for AppImage
- # ============================================================
- if ! dpkg -s libfuse2 &>/dev/null; then
- echo "[+] Installing libfuse2..."
- sudo apt update
- sudo apt install -y libfuse2
- else
- echo "[✓] libfuse2 already installed."
- fi
- echo ""
- # ============================================================
- # 5. Create desktop launcher
- # ============================================================
- echo "[+] Creating desktop launcher..."
- DESKTOP_FILE="$HOME/.local/share/applications/arduino-ide.desktop"
- cat <<EOF > "$DESKTOP_FILE"
- [Desktop Entry]
- Version=1.0
- Type=Application
- Name=Arduino IDE
- Comment=Arduino IDE
- Exec=$DEST --no-sandbox
- Icon=arduino
- Terminal=false
- Categories=Development;IDE;Electronics;
- StartupNotify=true
- EOF
- chmod 644 "$DESKTOP_FILE"
- update-desktop-database "$HOME/.local/share/applications" 2>/dev/null || true
- echo "[✓] Launcher created."
- echo ""
- # ============================================================
- # 6. Install Arduino CLI if missing
- # ============================================================
- if ! command -v arduino-cli &>/dev/null; then
- echo "[+] Installing arduino-cli..."
- cd /tmp
- curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
- install -m 755 /tmp/bin/arduino-cli "$HOME/bin/arduino-cli"
- else
- echo "[✓] arduino-cli already installed."
- fi
- echo ""
- # ============================================================
- # 7. Initialize CLI config if needed
- # ============================================================
- if [[ ! -f "$HOME/.arduino15/arduino-cli.yaml" ]]; then
- echo "[+] Initializing Arduino CLI..."
- arduino-cli config init
- else
- echo "[✓] Arduino CLI already initialized."
- fi
- echo ""
- # ============================================================
- # 8. Add ESP8266 + ESP32 board URLs
- # ============================================================
- ESP8266_URL="https://arduino.esp8266.com/stable/package_esp8266com_index.json"
- ESP32_URL="https://espressif.github.io/arduino-esp32/package_esp32_index.json"
- OLD_ESP8266_URL="http://arduino.esp8266.com/stable/package_esp8266com_index.json"
- echo "[+] Configuring board manager URLs..."
- # Remove old HTTP ESP8266 URL if present
- arduino-cli config delete board_manager.additional_urls "$OLD_ESP8266_URL" 2>/dev/null || true
- # Add URLs only if missing
- arduino-cli config dump | grep -qF "$ESP8266_URL" || \
- arduino-cli config add board_manager.additional_urls "$ESP8266_URL"
- arduino-cli config dump | grep -qF "$ESP32_URL" || \
- arduino-cli config add board_manager.additional_urls "$ESP32_URL"
- echo "[✓] Board manager URLs configured."
- echo ""
- # ============================================================
- # 9. Update board indexes
- # ============================================================
- echo "[+] Updating board package indexes..."
- arduino-cli core update-index
- echo ""
- # ============================================================
- # 10. Install or upgrade ESP8266 core
- # ============================================================
- echo "[+] Installing/upgrading ESP8266 core..."
- if arduino-cli core list | grep -q "esp8266:esp8266"; then
- arduino-cli core upgrade esp8266:esp8266 || true
- else
- arduino-cli core install esp8266:esp8266
- fi
- echo ""
- # ============================================================
- # 11. Install or upgrade ESP32 core
- # ============================================================
- echo "[+] Installing/upgrading ESP32 core..."
- if arduino-cli core list | grep -q "esp32:esp32"; then
- arduino-cli core upgrade esp32:esp32 || true
- else
- arduino-cli core install esp32:esp32
- fi
- echo ""
- # ============================================================
- # 12. Verify installed files
- # ============================================================
- echo "[+] Verifying ESP8266 core..."
- find "$HOME/.arduino15/packages/esp8266" -name "ESP8266HTTPClient.h" >/dev/null 2>&1 \
- && echo "[✓] ESP8266 OK" \
- || echo "[!] ESP8266 verify check did not find ESP8266HTTPClient.h"
- echo "[+] Verifying ESP32 core..."
- find "$HOME/.arduino15/packages/esp32" -name "WiFi.h" >/dev/null 2>&1 \
- && echo "[✓] ESP32 OK" \
- || echo "[!] ESP32 verify check did not find WiFi.h"
- echo ""
- echo "------------------------------------------------------------"
- echo " INSTALLATION COMPLETE — Arduino IDE $LATEST_VER READY"
- echo "------------------------------------------------------------"
- echo " AppImage: $DEST"
- echo " Launcher: $DESKTOP_FILE"
Advertisement
Add Comment
Please, Sign In to add comment