Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/aetherinox/proteus-git

A bash script which is used to push debian packages to a self-hosted apt repository. Supports downloading package updates both apt-get and Github repos.
https://github.com/aetherinox/proteus-git

apt apt-get debian-packages repo repository ubuntu-packages zorin zorin-os zorin-packages zorinos

Last synced: 24 days ago
JSON representation

A bash script which is used to push debian packages to a self-hosted apt repository. Supports downloading package updates both apt-get and Github repos.

Awesome Lists containing this project

README

        


Proteus Apt Git

![GitHub repo size](https://img.shields.io/github/repo-size/Aetherinox/proteus-apt-repo?label=size&color=59702a) ![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/Aetherinox/proteus-apt-repo?color=b43bcc) [![View Apt Repo](https://img.shields.io/badge/Repo%20-%20View%20-%20%23f00e7f?logo=Linux&logoColor=FFFFFF&label=Repo)](https://github.com/Aetherinox/proteus-apt-repo/)




## About
This is the internal part of [Proteus App Manager](https://github.com/Aetherinox/proteus-app-manager) and [Proteus Apt Repo](https://github.com/Aetherinox/proteus-apt-repo).

Once an automatic task is created, every X minutes, the main script of this repo will be called and a list of all Ubuntu packages will be checked, downloaded, and queued for updates (if any available for each package).

Downloaded packages will be locally sent to their correct architecture location:
- incoming/proteus-git/``/``

Once the packages are downloaded and placed in the correct location, they will then be added to the apt repo via the package [Reprepro](https://salsa.debian.org/brlink/reprepro), and then finally uploaded to Github.


---


## Usage
Download `proteus-git.sh`
```shell
wget "https://raw.githubusercontent.com/Aetherinox/proteus-git/main/proteus-git.sh"
```

Set `proteus-git.sh` to be executable

```shell
sudo chmod +x proteus-git.sh
```

Run the script
```shell
./proteus-git.sh
```


On first run a `bin` file will be created in `/home/$USER/bin/proteus-git` and another file at `/etc/profile.d/proteus-git.sh`. This allows you to execute the proteus-git app from any folder by using:
```shell
proteus-git
```

You can then delete the original `proteus-git.sh` file you downloaded from Github if you wish.


---


## Requirements
Proteus Git has requirements that need met before the script will function. You have a few options below for installing them:


| Requirement | Desc | Execute |
| --- | --- | --- |
| `apt-url` |
Available from [Proteus Apt Repo](https://github.com/Aetherinox/proteus-apt-repo)
Installing this also installs `apt-move`

| `sudo apt install apt-url` |
| `apt-move` |
Available from [Proteus Apt Repo](https://github.com/Aetherinox/proteus-apt-repo)

| `sudo apt install apt-move` |
| `lastversion` |
Python script installed via `pip`.
Info can be viewed on [github page](https://github.com/dvershinin/lastversion)

| `pip install lastversion` |
| `reprepro` |
Installed via `proteus apt repo`.
Requires `v5.4.2-1`

| `sudo apt install lastversion` |
| `tree` |
Output directories as tree
Available from [Proteus Apt Repo](https://github.com/Aetherinox/proteus-apt-repo)

| `sudo apt install tree` |


### Install apt-move + apt-url
Add [Proteus Apt Repo]() to your sources.list by first adding the GPG key:
```shell
wget -qO - https://github.com/Aetherinox.gpg | sudo gpg --dearmor -o /usr/share/keyrings/aetherinox-proteus-apt-repo-archive.gpg
```

Then add the Proteus Apt repo to your list of sources:

```shell
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/aetherinox-proteus-apt-repo-archive.gpg] https://raw.githubusercontent.com/Aetherinox/proteus-apt-repo/master $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/aetherinox-proteus-apt-repo-archive.list
```

Then update your packages:
```shell
sudo apt update
```

Then install `apt-url`:
```shell
sudo apt install apt-url
```

Both `apt-move` and `apt-url` will be installed. `apt-url` will be placed in `/usr/bin/`




### Install apt-move
Install `apt-move` and then manually copy the files in this repo to your machine.
```shell
sudo apt-get install apt-move
```




### Install lastversion
Install `pip` and `python3-venv`

```shell
sudo apt install python3-pip
sudo apt-get install python3-venv
```

Download `lastversion` and unzip
```shell
mkdir -p /home/$USER/Packages/lastversion

wget https://github.com/dvershinin/lastversion/archive/refs/tags/v3.3.2.zip

unzip v3.3.2.zip -d /home/aetherinox/Packages/lastversion

cd /home/$USER/Packages/lastversion
```

Install `lastversion`

```shell
pip install lastversion --break-system-packages
```

The `lastversion` bin file will be placed in `/home/$USER/.local/bin`.
We are going to move it to `/home/$USER/bin/`

In terminal, execute
```shell
touch /etc/profile.d/lastversion.sh
```

In the file, add
```
export PATH="$HOME/bin:$PATH"
```

Then refresh the files
```shell
source $HOME/.bashrc
source $HOME/.profile
```

Log out and back in for changes to take affect.


---


## secrets.sh
At the very top of the `proteus-git.sh` file, `secrets.sh` is called. This file is required in order for you to not be rate limited by `lastversion`, and for defining other vars that will be used in the Proteus Git.

Create a `secrets.sh` and add your `Personal Access Token`.

To create a Personal Access Token for each service, visit:
| Service | Link |
| --- | --- |
| Github | https://github.com/settings/tokens |
| Gitlab | https://gitlab.com/-/profile/personal_access_tokens |

```shell
#!/bin/bash
PATH="/bin:/usr/bin:/sbin:/usr/sbin:/home/$USER/bin"
export GITHUB_API_TOKEN=github_pat_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
export GITLAB_PA_TOKEN=glpat-xxxxxxxxxxxxxxx
```

You can also define your `GPG` public key that you wish to use for package signing in the `secrets.sh` file:
```shell
export GPG_KEY=ABCD0123
```


---


## Proteus Apt Repo
The Proteus Git app is developed to manage the packages associated with the [Proteus Apt Repo](https://github.com/Aetherinox/proteus-apt-repo) and is associated to the [Proteus App Manager](https://github.com/Aetherinox/proteus-app-manager). To utilize the Proteus Apt Repo:

Open Terminal and add the GPG key for the developer to your keyring

```shell
wget -qO - https://github.com/Aetherinox.gpg | sudo gpg --dearmor -o /usr/share/keyrings/aetherinox-proteus-apt-repo-archive.gpg
```

Then execute the command below to receive our package list:
```shell
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/aetherinox-proteus-apt-repo-archive.gpg] https://raw.githubusercontent.com/Aetherinox/proteus-apt-repo/master $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/aetherinox-proteus-apt-repo-archive.list
```

Finally, run in terminal
```shell
sudo apt update
```
The new repository is now available to use.


---


## Configure GPG
Ensure you have GPG configured so that pushes and packages can be signed.


### Ubuntu Passwords & Keys
Import your GPG key into `Passwords & Keys` or whatever program you utilize to store GPG keys.


You also have the option to setup Proteus Git to automatically import a GPG key. Simply place a `.gpg` file inside `proteus-git/.gpg/yourfile.gpg`. Once Proteus Git is launched, it will import the gpg file that exists within that `.gpg` folder.


### GPG / Gnupg
Ensure you cache your session by creating the file `/home/$USER/.gnupg/gpg-agent.conf`

Add the following
```shell
enable-putty-support
enable-ssh-support
use-standard-socket
default-cache-ttl-ssh 60
max-cache-ttl-ssh 120
default-cache-ttl 28800 # gpg key cache time
max-cache-ttl 28800 # max gpg key cache time
pinentry-program "/usr/bin/pinentry"
allow-loopback-pinentry
allow-preset-passphrase
pinentry-timeout 0
```


### .gitconfig
Open `/home/$USER/.gitconfig` and ensure your `.gitconfig` is similar to the following:

```
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[user]
name = Username
email = [email protected]
signingKey = BCA07641EE3FCD7BC5585281488D518ABD3DC629
[commit]
gpgsign = true
[gpg]
program = gpg
[safe]
directory = /home/$USER/Repos/repo-name
[tag]
forceSignAnnotated = true
[credential]
helper = store
```


Once all this is done, you can launch `proteus-git` and start running the package downloader.