| #!/usr/bin/env bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| set -e |
| set -u |
|
|
| |
| BOLD="\033[1m" |
| RED="\033[31m" |
| GREEN="\033[32m" |
| YELLOW="\033[33m" |
| BLUE="\033[34m" |
| RESET="\033[0m" |
|
|
| |
| log_info() { |
| echo -e "${BLUE}[INFO]${RESET} $1" |
| } |
|
|
| log_success() { |
| echo -e "${GREEN}[SUCCESS]${RESET} $1" |
| } |
|
|
| log_warning() { |
| echo -e "${YELLOW}[WARNING]${RESET} $1" |
| } |
|
|
| log_error() { |
| echo -e "${RED}[ERROR]${RESET} $1" |
| } |
|
|
| |
| REPO_URL="https://raw.githubusercontent.com/azrilaiman2003/augment-vip/main" |
|
|
| |
| SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
|
|
| |
| check_python() { |
| log_info "Checking for Python..." |
|
|
| |
| if command -v python3 &> /dev/null; then |
| PYTHON_CMD="python3" |
| log_success "Found Python 3: $(python3 --version)" |
| elif command -v python &> /dev/null; then |
| |
| PYTHON_VERSION=$(python --version 2>&1) |
| if [[ $PYTHON_VERSION == *"Python 3"* ]]; then |
| PYTHON_CMD="python" |
| log_success "Found Python 3: $PYTHON_VERSION" |
| else |
| log_error "Python 3 is required but found: $PYTHON_VERSION" |
| log_info "Please install Python 3.6 or higher from https://www.python.org/downloads/" |
| exit 1 |
| fi |
| else |
| log_error "Python 3 is not installed or not in PATH" |
| log_info "Please install Python 3.6 or higher from https://www.python.org/downloads/" |
| exit 1 |
| fi |
| } |
|
|
| |
| download_python_installer() { |
| log_info "Downloading Python installer..." |
|
|
| |
| PROJECT_ROOT="$SCRIPT_DIR/augment-vip" |
| log_info "Creating project directory at: $PROJECT_ROOT" |
| mkdir -p "$PROJECT_ROOT" |
|
|
| |
| INSTALLER_URL="$REPO_URL/install.py" |
| INSTALLER_PATH="$PROJECT_ROOT/install.py" |
|
|
| log_info "Downloading from: $INSTALLER_URL" |
| log_info "Saving to: $INSTALLER_PATH" |
|
|
| |
| if curl -L "$INSTALLER_URL" -o "$INSTALLER_PATH"; then |
| log_success "Downloaded Python installer" |
| else |
| log_error "Failed to download Python installer" |
| exit 1 |
| fi |
|
|
| |
| chmod +x "$INSTALLER_PATH" |
|
|
| |
| log_info "Downloading Python package files..." |
|
|
| |
| mkdir -p "$PROJECT_ROOT/augment_vip" |
|
|
| |
| PYTHON_FILES=( |
| "augment_vip/__init__.py" |
| "augment_vip/utils.py" |
| "augment_vip/db_cleaner.py" |
| "augment_vip/id_modifier.py" |
| "augment_vip/cli.py" |
| "setup.py" |
| "requirements.txt" |
| ) |
|
|
| |
| for file in "${PYTHON_FILES[@]}"; do |
| file_url="$REPO_URL/$file" |
| file_path="$PROJECT_ROOT/$file" |
|
|
| |
| mkdir -p "$(dirname "$file_path")" |
|
|
| log_info "Downloading $file..." |
|
|
| |
| if curl -L "$file_url" -o "$file_path"; then |
| log_success "Downloaded $file" |
| else |
| log_warning "Failed to download $file, will try to continue anyway" |
| fi |
| done |
|
|
| log_success "All Python files downloaded" |
| return 0 |
| } |
|
|
| |
| run_python_installer() { |
| log_info "Running Python installer..." |
|
|
| |
| cd "$PROJECT_ROOT" |
|
|
| |
| if "$PYTHON_CMD" install.py "$@"; then |
| log_success "Python installation completed successfully" |
| else |
| log_error "Python installation failed" |
| exit 1 |
| fi |
|
|
| |
| cd - > /dev/null |
| } |
|
|
| |
| show_help() { |
| echo "Augment VIP Installation Script (Python Version)" |
| echo |
| echo "Usage: $0 [options]" |
| echo "Options:" |
| echo " --help Show this help message" |
| echo " --clean Run database cleaning script after installation" |
| echo " --modify-ids Run telemetry ID modification script after installation" |
| echo " --all Run all scripts (clean and modify IDs)" |
| echo |
| echo "Example: $0 --all" |
| } |
|
|
| |
| main() { |
| |
| for arg in "$@"; do |
| if [[ "$arg" == "--help" ]]; then |
| show_help |
| exit 0 |
| fi |
| done |
|
|
| log_info "Starting installation process for Augment VIP (Python Version)" |
|
|
| |
| check_python |
|
|
| |
| download_python_installer |
|
|
| |
| run_python_installer "$@" --no-prompt |
|
|
| |
| if [ "$PYTHON_CMD" = "python3" ]; then |
| AUGMENT_CMD="$PROJECT_ROOT/.venv/bin/augment-vip" |
| else |
| if [[ "$OSTYPE" == "msys"* || "$OSTYPE" == "cygwin"* ]]; then |
| AUGMENT_CMD="$PROJECT_ROOT/.venv/Scripts/augment-vip.exe" |
| else |
| AUGMENT_CMD="$PROJECT_ROOT/.venv/bin/augment-vip" |
| fi |
| fi |
|
|
| |
| echo |
| read -p "Would you like to clean VS Code databases now? (y/n) " -n 1 -r |
| echo |
| if [[ $REPLY =~ ^[Yy]$ ]]; then |
| log_info "Running database cleaning..." |
| "$AUGMENT_CMD" clean |
| fi |
|
|
| |
| echo |
| read -p "Would you like to modify VS Code telemetry IDs now? (y/n) " -n 1 -r |
| echo |
| if [[ $REPLY =~ ^[Yy]$ ]]; then |
| log_info "Running telemetry ID modification..." |
| "$AUGMENT_CMD" modify-ids |
| fi |
|
|
| log_info "You can now use Augment VIP with the following commands:" |
| log_info " $AUGMENT_CMD clean - Clean VS Code databases" |
| log_info " $AUGMENT_CMD modify-ids - Modify telemetry IDs" |
| log_info " $AUGMENT_CMD all - Run all tools" |
| } |
|
|
| |
| main "$@" |
|
|