Files
ermnvldmr.com/services/docs/content/en/root/reference/initialization.md
T

2.0 KiB

title, description, weight
title description weight
System Initialization Repository setup, Git hooks, and PATH configuration. 51

The Root framework requires a one-time initialization on each host to establish path linkages and repository-level configurations.

The init.sh Script

The init.sh script located at the repository root is the primary bootstrap mechanism. It performs the following critical tasks:

  1. Submodule Initialization: Ensures the Commons repository is present and up to date.
  2. Git Hook Configuration: Points core.hooksPath to .operator/shared/githooks to enable standardized pre-commit checks.
  3. Safe Directory Registration: Adds the repository to Git's safe.directory list, which is required for operations performed by different users (e.g., root, adam).
  4. Vim Configuration: Links a standardized .vimrc to both the current user and the root user for a consistent editing experience.
  5. PATH Persistence: Adds the .operator/shared/scripts/run directory to the user's ~/.bashrc, making the root command available globally.

Git Hooks

Root enforces standards through Git hooks stored in .operator/shared/githooks/.

  • Pre-commit: Validates that all scripts follow the namespacing and structure conventions.
  • Commit-msg: (Optional) Enforces conventional commit messages if configured.

PATH Configuration

The root command is a wrapper located in .operator/shared/scripts/run/root. By adding this directory to the PATH, the dispatcher can be invoked from any directory within the system, automatically resolving the repository root based on the current working directory or environment variables.

# Example of manual PATH addition (performed automatically by init.sh)
export PATH="$HOME/repo/.operator/shared/scripts/run:$PATH"

See also: