mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-08 07:18:47 +00:00
feat: add optional GUI install flag
This commit is contained in:
@@ -15,6 +15,7 @@ VENV_DIR="$INSTALL_DIR/venv"
|
|||||||
LAUNCHER_DIR="$HOME/.local/bin"
|
LAUNCHER_DIR="$HOME/.local/bin"
|
||||||
LAUNCHER_PATH="$LAUNCHER_DIR/seedpass"
|
LAUNCHER_PATH="$LAUNCHER_DIR/seedpass"
|
||||||
BRANCH="main" # Default branch
|
BRANCH="main" # Default branch
|
||||||
|
INSTALL_GUI=false
|
||||||
|
|
||||||
# --- Helper Functions ---
|
# --- Helper Functions ---
|
||||||
print_info() { echo -e "\033[1;34m[INFO]\033[0m $1"; }
|
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."
|
print_warning "Install 'xclip' manually to enable clipboard features in secret mode."
|
||||||
}
|
}
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: $0 [-b | --branch <branch_name>] [-h | --help]"
|
echo "Usage: $0 [-b | --branch <branch_name>] [--with-gui] [-h | --help]"
|
||||||
echo " -b, --branch Specify the git branch to install (default: main)"
|
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"
|
echo " -h, --help Display this help message"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
@@ -71,6 +73,10 @@ main() {
|
|||||||
-h|--help)
|
-h|--help)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
--with-gui)
|
||||||
|
INSTALL_GUI=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
print_error "Unknown parameter passed: $1"; usage
|
print_error "Unknown parameter passed: $1"; usage
|
||||||
;;
|
;;
|
||||||
@@ -111,12 +117,14 @@ main() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# 3. Install OS-specific dependencies
|
# 3. Install OS-specific dependencies
|
||||||
print_info "Checking for Gtk development libraries..."
|
if [ "$INSTALL_GUI" = true ]; then
|
||||||
if ! python3 -c "import gi" &>/dev/null; then
|
print_info "Checking for Gtk development libraries..."
|
||||||
print_warning "Gtk introspection bindings not found. Installing dependencies..."
|
if command -v pkg-config &>/dev/null && pkg-config --exists girepository-2.0; then
|
||||||
install_dependencies
|
print_info "Gtk bindings already available."
|
||||||
else
|
else
|
||||||
print_info "Gtk bindings already available."
|
print_warning "Gtk introspection bindings not found. Installing dependencies..."
|
||||||
|
install_dependencies
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 4. Clone or update the repository
|
# 4. Clone or update the repository
|
||||||
@@ -143,14 +151,33 @@ main() {
|
|||||||
print_info "Installing/updating Python dependencies from requirements.lock..."
|
print_info "Installing/updating Python dependencies from requirements.lock..."
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install --require-hashes -r requirements.lock
|
pip install --require-hashes -r requirements.lock
|
||||||
pip install -e .[gui]
|
if [ "$INSTALL_GUI" = true ]; then
|
||||||
print_info "Installing platform-specific Toga backend..."
|
GUI_READY=true
|
||||||
if [ "$OS_NAME" = "Linux" ]; then
|
if [ "$OS_NAME" = "Linux" ]; then
|
||||||
print_info "Installing toga-gtk for Linux..."
|
if ! (command -v pkg-config &>/dev/null && pkg-config --exists girepository-2.0); then
|
||||||
pip install toga-gtk
|
print_warning "GTK libraries (girepository-2.0) not found. Install them with: sudo apt install libgirepository1.0-dev"
|
||||||
elif [ "$OS_NAME" = "Darwin" ]; then
|
read -r -p "Continue with GUI installation anyway? (y/N) " CONTINUE_GUI
|
||||||
print_info "Installing toga-cocoa for macOS..."
|
if [[ ! "$CONTINUE_GUI" =~ ^[Yy]$ ]]; then
|
||||||
pip install toga-cocoa
|
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
|
fi
|
||||||
deactivate
|
deactivate
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user