Installer Script Breakdown
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The ollacc installer is a Bash-based automation tool designed to set up a local environment for the Ollama Cloud Claude Code launcher. Its primary purpose is to establish a hidden configuration directory, install the necessary launcher and library files, and configure shell aliases for seamless command-line access. The installation process is designed to be idempotent, meaning it can be safely re-run without creating duplicate configurations or corrupting existing shell resource files.
Sources: install.sh:1-12, README.md:46-56
Installation Workflow and Logic
The install.sh script follows a structured sequence to ensure the environment is correctly prepared. It handles user identification (including sudo contexts), directory creation, file deployment, and shell environment modification.
User and Directory Initialization
The script identifies the real user and their home directory, even when executed with sudo. It then establishes ~/.ollacc as the central installation directory.
Sources: install.sh:20-33
Component Deployment
The installer copies three main categories of files into the installation directory:
- The Launcher: The main
ollaccexecutable. - Library Files: Supporting shell scripts in the
lib/directory required at runtime. - Configuration: A default
configfile (if missing) and an example configuration for reference.
| Component | Target Path | Permissions | Purpose |
|---|---|---|---|
| Launcher | ~/.ollacc/ollacc | 755 | Primary execution entry point |
| Library Scripts | ~/.ollacc/lib/* | 644 | Modular logic for auth, menu, and config |
| Configuration | ~/.ollacc/config | 600 | Stores API tokens and default models |
| Example Conf | ~/.ollacc/ollacc.conf.example | 644 | Reference for manual configuration |
Sources: install.sh:35-71, README.md:104-108
Shell Integration (Alias Injection)
The script searches for existing shell resource files (.zshrc, .bashrc, .bash_profile, or .profile) to add the ollacc alias. If no candidates exist, it creates a ~/.profile file. It uses a specific marker (# ollacc: alias) to ensure the injection is idempotent.
Sources: install.sh:73-108, README.md:52-54
Uninstallation Process
The uninstall.sh script reverses the changes made by the installer. It specifically targets the alias lines in shell resource files using the awk utility to safely remove the marker, the alias, and any preceding blank lines.
Uninstallation Logic
- Alias Removal: Iterates through all known shell RC files and removes the
ollaccblock. - Ownership Restoration: If run via
sudo, it attempts to restore correct ownership to modified RC files. - Cleanup Prompt: It interactively asks the user whether to delete the
~/.ollaccdirectory (containing the API key).
Sources: uninstall.sh:25-50, README.md:139-143
Configuration Management
The installer initializes the ~/.ollacc/config file with default environment variables. This file is critical for the ollacc runtime, as it is sourced by the launcher to provide credentials and model preferences.
Default Variables
The installer sets the following defaults if the config file is newly created:
ANTHROPIC_AUTH_TOKEN="": Empty by default; triggered for input on first run.ANTHROPIC_BASE_URL="https://ollama.com": The target API endpoint.OLLAMA_CLAUDE_DEFAULT_MODEL="": Stores the user's preferred model after selection.
Sources: install.sh:63-71, lib/auth.sh:7-14, lib/config.sh:41-45
Config I/O Helpers
The lib/config.sh script provides the underlying logic for the installer and launcher to manipulate the configuration:
bash_escape: Ensures values containing special characters (e.g.,$,*,") are safely escaped before being written to the config file.config_set: Replaces existing assignments or appends new ones while preserving user comments.config_unset: Removes specific configuration keys, used primarily during--key-clearor--model-clearoperations.
Sources: lib/config.sh:11-37, lib/flags.sh:14-31
Summary
The ollacc installation system provides a lightweight, non-intrusive method for deploying the Claude Code wrapper. By prioritizing idempotency and secure file permissions (chmod 600/700), it ensures that sensitive API tokens are protected while maintaining a simple setup flow that integrates directly with the user's existing shell environment.