From 974b3f50c51d01e315c9294fec6cd9c06e99b748 Mon Sep 17 00:00:00 2001 From: Nils Seidler Date: Fri, 19 Dec 2025 10:58:35 +0100 Subject: [PATCH] Improve setup script and enhance documentation - Add libsecret dependency to fix keytar build issues - Replace pkg list-installed with dpkg for better package checking - Enhance README with prerequisites, troubleshooting, and verification sections - Add detailed installation steps and usage instructions - Include comprehensive what-gets-installed section --- README.md | 99 +++++++++++++++++++++++++++++++++++++++++++++---------- setup.sh | 9 ++--- 2 files changed, 86 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index df2a301..896c1d3 100644 --- a/README.md +++ b/README.md @@ -2,32 +2,50 @@ This repository contains a setup script to install and configure the **GitHub Copilot CLI** on **Termux** (Android). It automates the installation of system dependencies, builds required native modules, and sets up the environment for a smooth experience. +## Prerequisites + +- **Termux** app installed on Android +- Internet connection for downloading packages +- At least 500MB of free storage space +- No prior setup required - the script handles everything + ## Overview The `setup.sh` script performs the following tasks: -- Installs Node.js and build tools (clang, make, python, rust). -- Installs system libraries (glib, libvips, pkg-config). -- Installs the `@github/copilot` CLI globally. +- Updates Termux package repositories +- Installs Node.js and build tools (clang, make, python, rust) +- Installs system libraries (glib, xorgproto, libvips, libsecret, pkg-config) +- Installs the `@github/copilot` CLI globally - Compiles and configures native Node.js modules: - - **node-pty**: For pseudo-terminal support. - - **sharp**: For image processing. - - **keytar**: For secure credential storage. -- Sets up a clipboard wrapper using `termux-api`. -- Configures `ripgrep` for code search. + - **node-pty**: For pseudo-terminal support + - **sharp**: For image processing + - **keytar**: For secure credential storage (requires libsecret) +- Sets up a clipboard wrapper using `termux-api` +- Configures `ripgrep` for code search ## Installation -1. Clone this repository or download the `setup.sh` file to your Termux home directory. -2. Make the script executable: - ```bash - chmod +x setup.sh - ``` -3. Run the setup script: - ```bash - ./setup.sh - ``` +1. Clone this repository or download the `setup.sh` file: + ```bash + git clone + cd copilot-termux-setup + ``` + Or if you have the script already: + ```bash + cd copilot-termux-setup + ``` + +2. Make the script executable: + ```bash + chmod +x setup.sh + ``` + +3. Run the setup script: + ```bash + ./setup.sh + ``` -The script will guide you through the installation process. It may take some time to compile the native modules. +The script will guide you through the installation process. It may take 10-15 minutes to complete as it compiles native modules from source. ## Usage @@ -36,3 +54,48 @@ Once the installation is complete, you can start the GitHub Copilot CLI by runni ```bash copilot ``` + +Then authenticate with GitHub: +1. Type `/login` in the Copilot CLI +2. Follow the authentication prompts +3. Start using AI-powered code assistance + +## Verification + +The script automatically tests all native modules at the end. You should see: +- ✓ keytar loaded successfully +- ✓ node-pty loaded successfully +- ✓ clipboard wrapper available +- sharp may show warnings but is non-critical + +## Troubleshooting + +### Script fails during installation +- Ensure you have a stable internet connection +- Run `pkg update && pkg upgrade` before running the script +- Make sure you have enough storage space + +### keytar fails to build +- This was a known issue, now fixed by installing `libsecret` +- Ensure you're using the latest version of this script + +### Copilot command not found +- Close and reopen Termux to refresh your PATH +- Or run: `hash -r` to refresh the command cache + +## What Gets Installed + +**System Packages:** +- nodejs, clang, make, python +- glib, xorgproto, rust, libvips, libsecret, pkg-config +- ripgrep, termux-api + +**Native Modules:** +- keytar (credential storage) +- node-pty (terminal/command execution) +- sharp (image processing) +- clipboard wrapper (Termux API integration) + +**Configuration Files:** +- ~/.gyp/include.gypi (node-gyp configuration) +- Patched node-addon-api for Android compatibility diff --git a/setup.sh b/setup.sh index 5bd8bf7..2e1826f 100644 --- a/setup.sh +++ b/setup.sh @@ -85,7 +85,7 @@ print_step() { echo "" } -# Ensure a pkg package is installed only if missing; can check by command or pkg list-installed +# Ensure a pkg package is installed only if missing; can check by command or dpkg ensure_pkg() { local pkgname="$1" local check_cmd="${2:-}" @@ -96,8 +96,8 @@ ensure_pkg() { return 0 fi else - if pkg list-installed "$pkgname" >/dev/null 2>&1; then - print_info "$pkgname already installed according to pkg" + if dpkg -s "$pkgname" >/dev/null 2>&1; then + print_info "$pkgname already installed according to dpkg" return 0 fi fi @@ -185,6 +185,7 @@ ensure_pkg glib ensure_pkg xorgproto ensure_pkg rust rustc ensure_pkg libvips +ensure_pkg libsecret ensure_pkg pkg-config pkg-config ensure_pkg ripgrep rg @@ -628,7 +629,7 @@ print_header "Installation Summary" echo "Installed Packages:" echo " • nodejs, clang, make, python" -echo " • glib, xorgproto, rust, libvips, pkg-config" +echo " • glib, xorgproto, rust, libvips, libsecret, pkg-config" echo " • ripgrep, termux-api" echo "" echo "Native Modules Built:"