From 171f92167ebcfe86bf22440a466f3be0f97d4d3a Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Thu, 7 Aug 2025 12:05:12 -0400 Subject: [PATCH] feat: add optional GUI install flag --- scripts/install.sh | 57 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 93a1133..b69d11e 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -15,6 +15,7 @@ VENV_DIR="$INSTALL_DIR/venv" LAUNCHER_DIR="$HOME/.local/bin" LAUNCHER_PATH="$LAUNCHER_DIR/seedpass" BRANCH="main" # Default branch +INSTALL_GUI=false # --- Helper Functions --- print_info() { echo -e "\033[1;34m[INFO]\033[0m $1"; } @@ -49,8 +50,9 @@ install_dependencies() { print_warning "Install 'xclip' manually to enable clipboard features in secret mode." } usage() { - echo "Usage: $0 [-b | --branch ] [-h | --help]" + echo "Usage: $0 [-b | --branch ] [--with-gui] [-h | --help]" echo " -b, --branch Specify the git branch to install (default: main)" + echo " --with-gui Include graphical interface dependencies" echo " -h, --help Display this help message" exit 0 } @@ -71,6 +73,10 @@ main() { -h|--help) usage ;; + --with-gui) + INSTALL_GUI=true + shift + ;; *) print_error "Unknown parameter passed: $1"; usage ;; @@ -111,12 +117,14 @@ main() { fi # 3. Install OS-specific dependencies - print_info "Checking for Gtk development libraries..." - if ! python3 -c "import gi" &>/dev/null; then - print_warning "Gtk introspection bindings not found. Installing dependencies..." - install_dependencies - else - print_info "Gtk bindings already available." + if [ "$INSTALL_GUI" = true ]; then + print_info "Checking for Gtk development libraries..." + if command -v pkg-config &>/dev/null && pkg-config --exists girepository-2.0; then + print_info "Gtk bindings already available." + else + print_warning "Gtk introspection bindings not found. Installing dependencies..." + install_dependencies + fi fi # 4. Clone or update the repository @@ -143,14 +151,33 @@ main() { print_info "Installing/updating Python dependencies from requirements.lock..." pip install --upgrade pip pip install --require-hashes -r requirements.lock - pip install -e .[gui] - print_info "Installing platform-specific Toga backend..." - if [ "$OS_NAME" = "Linux" ]; then - print_info "Installing toga-gtk for Linux..." - pip install toga-gtk - elif [ "$OS_NAME" = "Darwin" ]; then - print_info "Installing toga-cocoa for macOS..." - pip install toga-cocoa + if [ "$INSTALL_GUI" = true ]; then + GUI_READY=true + if [ "$OS_NAME" = "Linux" ]; then + if ! (command -v pkg-config &>/dev/null && pkg-config --exists girepository-2.0); then + print_warning "GTK libraries (girepository-2.0) not found. Install them with: sudo apt install libgirepository1.0-dev" + read -r -p "Continue with GUI installation anyway? (y/N) " CONTINUE_GUI + if [[ ! "$CONTINUE_GUI" =~ ^[Yy]$ ]]; then + GUI_READY=false + fi + fi + fi + if [ "$GUI_READY" = true ]; then + pip install -e .[gui] + print_info "Installing platform-specific Toga backend..." + if [ "$OS_NAME" = "Linux" ]; then + print_info "Installing toga-gtk for Linux..." + pip install toga-gtk + elif [ "$OS_NAME" = "Darwin" ]; then + print_info "Installing toga-cocoa for macOS..." + pip install toga-cocoa + fi + else + print_warning "Skipping GUI installation." + pip install -e . + fi + else + pip install -e . fi deactivate