Skip to content

4. Centaur files

Chiron edited this page Jul 5, 2026 · 5 revisions

What are they?

A .centaur file is just a sequence of bash commands to install a package. Inspired by portage's ebuilds, these files turn centaur into a compile-based package manager. I've designed the syntax of these files to be as easy to create and use as possible and what better way of doing this than parsing bash (which so many people know already).

A skeleton file is included in this repo and also availiable at /etc/centaur/packages/skeleton.centaur for you to get started.

Features

  • Mostly Bash (all the CLI commands you normally use will work in .centaur files)
  • Comments
  • Environment variables
  • More stuff coming later because I've just started making this project :P

Limitations

  • Currently only one liners are supported. This means for loops etc.. must be kept to one line.
  • Comments in the middle of a line

Creating .centaur files

Structure

There are three main elements of a .centaur file:

  • Meta block - This contains information about dependencies and how a package should be installed
  • Install block - This is the bash that is run to install the package
  • Uninstall block - This is the bash that is run to uninstall the package

All together it looks like this:

[meta]
# metadata in here
[/meta]

[install]
# install bash in here
[/install]

[uninstall]
# uninstall bash in here
[/uninstall]

To make a comment use #. Comments starting in the middle of the line are not currently supported.

Rules

There are a couple of things to keep in mind when writing .centaur files:

Meta

Dependencies

The meta block MUST show what dependencies need to be installed (even if there are none!):

[meta]
dependencies = "foo bar"
[/meta]

The variable dependencies stores a string where each package is separated by a space (" ")

Other data

Only the dependencies variable is required, however it is good practice to include some other data:

[meta]
dependencies = "foo bar"
name = "package"
version = "0.1"

While name and version are ignored by the parser, it is still helpful to include. Anything can technically be added in the meta block, it is just ignored if it is not recognised.

All dependencies required should be added to the top of the file. Dependencies and install commands should be separated by a line starting with =. e.g.

Naming

Please follow this standard:

[Package Name]-[Package Version].centaur

# For example:
writedoc-2.3-p1.centaur

Root permissions

Centaur will already have been called with root permissions for installation and uninstallation (is that a word?). You do not need to include sudo in your commands.

Recommendations

Steps for installing

Downloading source code

  • Preferably download a tarball with wget, you could use git clone but wget is easier IMO
  • Please download it to /tmp/centaur/

Example:

wget https://github.com/Chiron8/writedoc/archive/refs/tags/v2.3-p1.tar.gz -O /tmp/centaur/writedoc.tar.gz

installs the writedoc v2.3-p1 tarball to /tmp/centaur/writedoc.tar.gz

Compiling and Installing

  • No specific software, do whatever

Cleaning up files

  • Use rm with minimal permissions. Example:
rm writedoc.tar.gz
rm -r writedoc-2.3-p1/

Deletes the tarball and extracted directory.

Printing to Stdout

  • Use echo

Example:

echo "Finished installing!"

It's a good idea to let the user what is going on.

Example

Take a look at writedoc-2.3-p1.centaur:

[meta]
name = "writedoc"
version = "2.3-p1"
dependencies = "example"
[/meta]

[install]
echo "Downloading..."
wget https://github.com/Chiron8/writedoc/archive/refs/tags/v2.3-p1.tar.gz -O /tmp/centaur/writedoc.tar.gz

echo "Installing..."
tar -xf /tmp/centaur/writedoc.tar.gz -C /tmp/centaur
cd /tmp/centaur/writedoc-2.3-p1/
./install.sh

echo "Finished installing! "
echo "Tidying Files..."
cd ../
rm writedoc.tar.gz
rm -r writedoc-2.3-p1/

echo "Finished!"
[/install]

[uninstall]
echo "Uninstalling..."
rm /usr/local/bin/writedoc
rm /usr/local/share/man/man1/writedoc.1
rm -r /usr/local/share/writedoc
echo "Finished!"
[/uninstall]

We have all the necessary things to successfully install the program and uninstall data.

  • Downloading and extracting a tarball to /tmp/centaur
  • Running an install script (you can always use other commands)
  • Cleaning up files that are no long needed after installation
  • Uninstall instructions are written

Cases of good practice:

  • User messages
  • sudo is not used anywhere
  • name and version are included in the metadata

Clone this wiki locally