#!/bin/bash set -e # Environment variables FLUTTER_VERSION="3.29.2" # Detect shell profile SHELL_PROFILE="" if [[ "$SHELL" == */zsh ]]; then SHELL_PROFILE="$HOME/.zshrc" echo "Detected zsh shell" elif [[ "$SHELL" == */bash ]]; then SHELL_PROFILE="$HOME/.bashrc" echo "Detected bash shell" else SHELL_PROFILE="$HOME/.profile" echo "Shell could not be determined, using $SHELL_PROFILE" fi # Install required dependencies using apt echo "Installing required dependencies..." sudo apt-get update -y || true sudo apt-get upgrade -y || true sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa || true # Android-related packages disabled as they were causing errors # sudo apt-get install -y --fix-missing \ # ca-certificates \ # build-essential \ # libssl-dev \ # cmake \ # llvm-dev \ # libclang-dev \ # lld \ # gcc \ # libc6-dev \ # jq \ # make \ # pkg-config \ # git \ # automake \ # libtool \ # m4 \ # autoconf \ # file \ # curl \ # wget \ # gnupg \ # software-properties-common \ # lsb-release \ # libudev-dev \ # zip unzip \ # nodejs npm \ # openjdk-17-jdk \ # clang \ # ninja-build \ # libgtk-3-dev \ # liblzma-dev \ # libstdc++-12-dev \ # xz-utils \ # libpulse0 \ # libglu1-mesa \ # locales \ # lcov \ # libsqlite3-dev \ # libxtst6 \ # libnss3-dev \ # libnspr4 \ # libxss1 \ # libatk-bridge2.0-0 \ # libgtk-3-0 \ # libgdk-pixbuf2.0-0 \ # binutils || true # Set up directories echo "Setting up directories..." mkdir -p $HOME/flutter # Set up environment variables echo "Setting up environment variables..." if ! grep -q "FLUTTER_PATH" "$SHELL_PROFILE"; then echo 'export PATH=$PATH:$HOME/flutter/bin' >> "$SHELL_PROFILE" fi # Download and install Flutter if not already installed if [ ! -d "$HOME/flutter/bin" ]; then echo "Downloading and installing Flutter..." cd $HOME wget -q https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz tar -xf flutter_linux_${FLUTTER_VERSION}-stable.tar.xz -C $HOME rm flutter_linux_${FLUTTER_VERSION}-stable.tar.xz echo $SHELL echo 'export PATH="$HOME/development/flutter/bin:$PATH"' >> ~/.bash_profile # Set flutter environment variable for current session export PATH="$HOME/flutter/bin:$PATH" git config --global --add safe.directory /root/flutter # Configure Flutter echo "Configuring Flutter..." flutter config --no-analytics flutter precache flutter doctor flutter update-packages --verify-only else echo "Flutter already installed, skipping download" fi echo "Environment setup complete!" echo "Please restart your terminal or run 'source $SHELL_PROFILE' to apply environment variables." cd /workspace/komodo-wallet flutter pub get || true flutter build web || flutter build web || true exit 0