From d804a3564cec1b1b37d548e0f6d85cbcf445e34b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Nov 2025 17:23:49 +0000 Subject: [PATCH 1/5] Initial plan From 32182ef2842b43d0190dee715855a9b546fca63b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Nov 2025 17:28:20 +0000 Subject: [PATCH 2/5] Add install.sh script for flutter_tracker Co-authored-by: DonnieBLT <128622481+DonnieBLT@users.noreply.github.com> --- flutter_tracker/install.sh | 217 +++++++++++++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100755 flutter_tracker/install.sh diff --git a/flutter_tracker/install.sh b/flutter_tracker/install.sh new file mode 100755 index 0000000..8641c70 --- /dev/null +++ b/flutter_tracker/install.sh @@ -0,0 +1,217 @@ +#!/bin/bash + +# Flutter Activity Tracker - Installation Script +# This script installs Flutter and all dependencies needed for the flutter_tracker + +set -e + +echo "==================================" +echo "Flutter Activity Tracker Installer" +echo "==================================" +echo "" + +# Check if we're on Linux +if [[ "$OSTYPE" != "linux-gnu"* ]]; then + echo "❌ This app requires Linux" + exit 1 +fi + +echo "✅ Linux detected" + +# Check for X11 +if [ -z "$DISPLAY" ]; then + echo "⚠️ Warning: X11 display not found. The app will require a graphical session to run." + echo " Make sure you run this in a graphical environment when starting the app." +fi + +echo "" +echo "==================================" +echo "Installing System Dependencies" +echo "==================================" +echo "" + +# Check if we have sudo access +if ! command -v sudo &> /dev/null; then + echo "❌ sudo not found. This script requires sudo to install system packages." + exit 1 +fi + +# Update package list +echo "Updating package list..." +sudo apt-get update + +# Install required system libraries +echo "" +echo "Installing required system libraries..." +REQUIRED_PACKAGES=( + "libx11-dev" + "libxi-dev" + "libxtst-dev" + "build-essential" + "curl" + "git" + "unzip" + "xz-utils" + "zip" + "libglu1-mesa" +) + +for package in "${REQUIRED_PACKAGES[@]}"; do + if dpkg -l | grep -q "^ii $package"; then + echo "✅ $package already installed" + else + echo "📦 Installing $package..." + sudo apt-get install -y "$package" + fi +done + +echo "" +echo "✅ All system dependencies installed" + +echo "" +echo "==================================" +echo "Installing Flutter SDK" +echo "==================================" +echo "" + +# Check if Flutter is already installed +if command -v flutter &> /dev/null; then + echo "✅ Flutter is already installed: $(flutter --version | head -n1)" + FLUTTER_INSTALLED=true +else + echo "Flutter not found. Installing Flutter SDK..." + FLUTTER_INSTALLED=false +fi + +if [ "$FLUTTER_INSTALLED" = false ]; then + # Determine Flutter installation directory + if [ -d "$HOME/flutter" ]; then + echo "⚠️ Flutter directory already exists at $HOME/flutter" + echo " Using existing directory..." + FLUTTER_DIR="$HOME/flutter" + else + FLUTTER_DIR="$HOME/flutter" + echo "Installing Flutter to $FLUTTER_DIR..." + + # Clone Flutter repository + cd "$HOME" + if ! git clone https://github.com/flutter/flutter.git -b stable --depth 1; then + echo "❌ Failed to clone Flutter repository" + exit 1 + fi + fi + + # Add Flutter to PATH for this session + export PATH="$PATH:$FLUTTER_DIR/bin" + + # Add Flutter to PATH permanently + SHELL_RC="" + if [ -f "$HOME/.bashrc" ]; then + SHELL_RC="$HOME/.bashrc" + elif [ -f "$HOME/.zshrc" ]; then + SHELL_RC="$HOME/.zshrc" + fi + + if [ -n "$SHELL_RC" ]; then + if ! grep -q "flutter/bin" "$SHELL_RC"; then + { + echo "" + echo "# Flutter SDK" + echo "export PATH=\"\$PATH:$FLUTTER_DIR/bin\"" + } >> "$SHELL_RC" + echo "✅ Added Flutter to PATH in $SHELL_RC" + fi + fi + + echo "✅ Flutter installed at $FLUTTER_DIR" +fi + +# Verify Flutter installation +echo "" +echo "Verifying Flutter installation..." +if ! command -v flutter &> /dev/null; then + echo "❌ Flutter command not found in PATH" + echo " Please add Flutter to your PATH:" + echo " export PATH=\"\$PATH:$HOME/flutter/bin\"" + exit 1 +fi + +echo "✅ Flutter found: $(flutter --version | head -n1)" + +# Run flutter doctor to check for any issues +echo "" +echo "Running Flutter doctor..." +flutter doctor + +# Enable Linux desktop support +echo "" +echo "Enabling Linux desktop support..." +if ! flutter config --enable-linux-desktop; then + echo "❌ Failed to enable Linux desktop support" + exit 1 +fi + +echo "✅ Linux desktop support enabled" + +echo "" +echo "==================================" +echo "Building Native Library" +echo "==================================" +echo "" + +# Navigate to flutter_tracker directory +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +cd "$SCRIPT_DIR" + +# Build native library +echo "Building native activity tracker library..." +cd linux + +if [ ! -f build.sh ]; then + echo "❌ build.sh not found in linux directory" + exit 1 +fi + +chmod +x build.sh +./build.sh + +if [ ! -f libactivity_tracker.so ]; then + echo "❌ Failed to build libactivity_tracker.so" + exit 1 +fi + +echo "✅ Native library built successfully" +cd .. + +echo "" +echo "==================================" +echo "Installing Flutter Dependencies" +echo "==================================" +echo "" + +# Get Flutter dependencies +echo "Running flutter pub get..." +if ! flutter pub get; then + echo "❌ Failed to get Flutter dependencies" + exit 1 +fi + +echo "✅ Flutter dependencies installed" + +echo "" +echo "==================================" +echo "Installation Complete!" +echo "==================================" +echo "" +echo "✅ All dependencies have been installed successfully" +echo "" +echo "To run the Flutter Activity Tracker:" +echo " cd $(pwd)" +echo " ./run.sh" +echo "" +echo "Or run the demo:" +echo " ./demo.sh" +echo "" +echo "Note: If this is a new shell session, you may need to restart your terminal" +echo " or run: source ~/.bashrc (or ~/.zshrc)" +echo "" From b6f75037f618fa815120be3eb0a3a001d6b6f315 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Nov 2025 17:30:18 +0000 Subject: [PATCH 3/5] Improve install.sh error handling and package checking Co-authored-by: DonnieBLT <128622481+DonnieBLT@users.noreply.github.com> --- flutter_tracker/install.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/flutter_tracker/install.sh b/flutter_tracker/install.sh index 8641c70..fd0d709 100755 --- a/flutter_tracker/install.sh +++ b/flutter_tracker/install.sh @@ -38,7 +38,9 @@ fi # Update package list echo "Updating package list..." -sudo apt-get update +if ! sudo apt-get update; then + echo "⚠️ Warning: Failed to update package list. Continuing with existing package information..." +fi # Install required system libraries echo "" @@ -57,7 +59,7 @@ REQUIRED_PACKAGES=( ) for package in "${REQUIRED_PACKAGES[@]}"; do - if dpkg -l | grep -q "^ii $package"; then + if dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -q 'install ok installed'; then echo "✅ $package already installed" else echo "📦 Installing $package..." @@ -93,7 +95,8 @@ if [ "$FLUTTER_INSTALLED" = false ]; then FLUTTER_DIR="$HOME/flutter" echo "Installing Flutter to $FLUTTER_DIR..." - # Clone Flutter repository + # Clone Flutter repository (stable branch for production use) + # Use -b beta or -b dev if you need cutting-edge features cd "$HOME" if ! git clone https://github.com/flutter/flutter.git -b stable --depth 1; then echo "❌ Failed to clone Flutter repository" From d50b84d763c0ed2e8a5edd73298c2889a2196eda Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Nov 2025 17:33:17 +0000 Subject: [PATCH 4/5] Refine install.sh with code review improvements Co-authored-by: DonnieBLT <128622481+DonnieBLT@users.noreply.github.com> --- flutter_tracker/install.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/flutter_tracker/install.sh b/flutter_tracker/install.sh index fd0d709..35f0ad0 100755 --- a/flutter_tracker/install.sh +++ b/flutter_tracker/install.sh @@ -87,12 +87,12 @@ fi if [ "$FLUTTER_INSTALLED" = false ]; then # Determine Flutter installation directory - if [ -d "$HOME/flutter" ]; then - echo "⚠️ Flutter directory already exists at $HOME/flutter" + FLUTTER_DIR="$HOME/flutter" + + if [ -d "$FLUTTER_DIR" ]; then + echo "⚠️ Flutter directory already exists at $FLUTTER_DIR" echo " Using existing directory..." - FLUTTER_DIR="$HOME/flutter" else - FLUTTER_DIR="$HOME/flutter" echo "Installing Flutter to $FLUTTER_DIR..." # Clone Flutter repository (stable branch for production use) @@ -116,7 +116,7 @@ if [ "$FLUTTER_INSTALLED" = false ]; then fi if [ -n "$SHELL_RC" ]; then - if ! grep -q "flutter/bin" "$SHELL_RC"; then + if ! grep -q "export PATH=.*flutter/bin" "$SHELL_RC"; then { echo "" echo "# Flutter SDK" @@ -143,8 +143,9 @@ echo "✅ Flutter found: $(flutter --version | head -n1)" # Run flutter doctor to check for any issues echo "" -echo "Running Flutter doctor..." -flutter doctor +echo "Running Flutter doctor to verify installation..." +echo "(This may take a moment...)" +flutter doctor || echo "⚠️ Some Flutter doctor checks failed, but installation can proceed" # Enable Linux desktop support echo "" From f789e3c02913587247166f10add9e6f85e17db06 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Nov 2025 17:34:43 +0000 Subject: [PATCH 5/5] Add timeout protection for flutter doctor command Co-authored-by: DonnieBLT <128622481+DonnieBLT@users.noreply.github.com> --- flutter_tracker/install.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flutter_tracker/install.sh b/flutter_tracker/install.sh index 35f0ad0..4f58902 100755 --- a/flutter_tracker/install.sh +++ b/flutter_tracker/install.sh @@ -145,7 +145,11 @@ echo "✅ Flutter found: $(flutter --version | head -n1)" echo "" echo "Running Flutter doctor to verify installation..." echo "(This may take a moment...)" -flutter doctor || echo "⚠️ Some Flutter doctor checks failed, but installation can proceed" +if command -v timeout &> /dev/null; then + timeout 120 flutter doctor || echo "⚠️ Some Flutter doctor checks failed, but installation can proceed" +else + flutter doctor || echo "⚠️ Some Flutter doctor checks failed, but installation can proceed" +fi # Enable Linux desktop support echo ""