/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.

Primary LanguageShell

Proteus Apt Git

GitHub repo size GitHub last commit (by committer) View Apt Repo



About

This is the internal part of Proteus App Manager and 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/<codename>/<architecture>

Once the packages are downloaded and placed in the correct location, they will then be added to the apt repo via the package Reprepro, and then finally uploaded to Github.




Usage

Download proteus-git.sh

wget "https://raw.githubusercontent.com/Aetherinox/proteus-git/main/proteus-git.sh"

Set proteus-git.sh to be executable

sudo chmod +x proteus-git.sh

Run the script

./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:

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
Installing this also installs apt-move

sudo apt install apt-url
apt-move
Available from Proteus Apt Repo

sudo apt install apt-move
lastversion
Python script installed via pip.
Info can be viewed on github page

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

sudo apt install tree

Install apt-move + apt-url

Add Proteus Apt Repo to your sources.list by first adding the GPG key:

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:

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:

sudo apt update

Then install apt-url:

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.

sudo apt-get install apt-move


Install lastversion

Install pip and python3-venv

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

Download lastversion and unzip

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

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

touch /etc/profile.d/lastversion.sh

In the file, add

export PATH="$HOME/bin:$PATH"

Then refresh the files

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
#!/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:

export GPG_KEY=ABCD0123



Proteus Apt Repo

The Proteus Git app is developed to manage the packages associated with the Proteus Apt Repo and is associated to the Proteus App Manager. To utilize the Proteus Apt Repo:

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

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:

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

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

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 = you@address.com
	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.