# Git component installer

This directory contains the installer for the git component for OpenGnsys.

It downloads, installs and configures Forgejo, creates the default repositories and configures SSH keys.

# Quick Installation

## Ubuntu 24.04

### Add the repository


Create the file `/etc/apt/sources.list.d/opengnsys.sources` with these contents:

    Types: deb
    URIs: https://ognproject.evlt.uma.es/debian-opengnsys/
    Suites: noble
    Components: main
    Signed-By:
     -----BEGIN PGP PUBLIC KEY BLOCK-----
     .
     mDMEZzx/SxYJKwYBBAHaRw8BAQdAa83CuAJ5/+7Pn9LHT/k34EAGpx5FnT/ExHSj
     XZG1JES0Ik9wZW5HbnN5cyA8b3Blbmduc3lzQG9wZW5nbnN5cy5lcz6ImQQTFgoA
     QRYhBC+J38Xsso227ZbDVt2S5xJQRhKDBQJnPH9LAhsDBQkFo5qABQsJCAcCAiIC
     BhUKCQgLAgQWAgMBAh4HAheAAAoJEN2S5xJQRhKDW/MBAO6swnpwdrbm48ypMyPh
     NboxvF7rCqBqHWwRHvkvrq7pAP9zd98r7z2AvqVXZxnaCsLTUNMEL12+DVZAUZ1G
     EquRBbg4BGc8f0sSCisGAQQBl1UBBQEBB0B6D6tkrwXSHi7ebGYsiMPntqwdkQ/S
     84SFTlSxRqdXfgMBCAeIfgQYFgoAJhYhBC+J38Xsso227ZbDVt2S5xJQRhKDBQJn
     PH9LAhsMBQkFo5qAAAoJEN2S5xJQRhKDJ+cBAM9jYbeq5VXkHLfODeVztgSXnSUe
     yklJ18oQmpeK5eWeAQDKYk/P0R+1ZJDItxkeP6pw62bCDYGQDvdDGPMAaIT6CA==
     =xcNc
     -----END PGP PUBLIC KEY BLOCK-----

It's required to run `apt update` after creating this file

### Install packages

    sudo apt install -y python3-git opengnsys-libarchive-c python3-termcolor python3-requests python3-tqdm bsdextrautils

## Adding SSH Keys to oglive

The Git system accesses the ogrepository via SSH. To function, it needs the oglive to have an SSH key, and for the ogrepository to accept it.

The Git installer can make the required changes by extracting an SSH key from an oglive and installing it in Forgejo. If there is a local ogboot installation, the installer will do this automatically. If there is not, it is necessary to provide the installer with an oglive from which to extract the key using the `--oglive-file` or `--oglive-url` parameter.

For example:

    ./opengnsys_git_installer.py --oglive-url https://example.com/ogLive-noble.iso

The installer will proceed to download the file, mount the ISO, and extract the key.

To perform the process after completing the installation and only add a key to an existing installation, use the `--set-ssh-key` parameter:

    ./opengnsys_git_installer.py --set-ssh-key --oglive-url https://example.com/ogLive-noble.iso


# Running the Installer

    # ./opengnsys_git_installer.py

It must be run as `root`.

The installer downloads and installs Forgejo, a web interface for Git. The configuration is automatically generated.

Forgejo manages the repositories and SSH access, so it must always be running. By default, it is installed on port 3000.

The default user is `oggit` with the password `opengnsys`.

# Packages with Dependencies

The OgGit system requires Python modules that are not included in Ubuntu 24.04 or have outdated versions.

The package sources can be found in oggit/packages.

# Source Code Documentation

Python documentation can be generated using a utility like pdoc3 (there are multiple possible alternatives):

    # Install pdoc3
    pip install --user pdoc3

    # Generate documentation
    pdoc3 --force --html opengnsys_git_installer.py