Introduction
Introduction Statistics Contact Development Disclaimer Help
Title: GearBSD: managing your packages on OpenBSD
Author: Solène
Date: 02 June 2021
Tags: rex openbsd gearbsd
Description:
# Introduction
I added a new module for GearBSD, it allows to define the exact list of
packages you want on the system and GearBSD will take care of removing
extra packages and installing missing packages. This is a huge step
for me to allow managing the system from code.
Note that this is an improvement over feeding pkg_add with a package
list because this method doesn't remove extra packages.
GearBSD packages in action on asciinema
# How to use
In the directory openbsd/packages/ of the GearBSD git repository, edit
the file Rexfile and list the packages you want in the variable
@packages.
This is the packages set I want on my server.
```Rexfile content
my @packages = qw/
bwm-ng checkrestart colorls curl dkimproxy dovecot dovecot-pigeonhole
duplicity ecl geomyidae git gnupg go-ipfs goaccess kermit lftp mosh
mtr munin-node munin-server ncdu nginx nginx-stream
opensmtpd-filter-spamassassin p5-Mail-SpamAssassin postgresql-server
prosody redis rss2email rsync
/;
```
Then, run "rex -h localhost show" to see what changes will be done like
which packages will be removed and which packages will be installed.
Run "rex -h localhost configure" to apply the changes for real. I use
"rex -h localhost" using a local ssh connection to root but you could
run rex as root with doas with the same effect.
# How does it work
Installing missing packages was easy but removing extra packages was
harder because you could delete packages that are still required as
dependencies.
Basically, the module looks at the packages you manually installed (the
one you directly installed with the pkg_add command), if they are not
part of your list of packages you want to have installed, they are
marked as automatically installed and then "pkg_delete -a" will remove
them if they are not required by any other package.
# Where is going GearBSD
This is a project I started yesterday but I've long think about it. I
really want to be able to manage my OpenBSD system with a single
configuration file. I currently wrote two modules that are
independently configured, the issue is that it doesn't allow altering
modules from one to another.
For example, if I create a module to install gnome3 and configure it
correctly, this will require gnome3 and gnome3-packages but if you
don't have them in your packages list, it will get deleted. GearBSD
needs a single configuration file with all the information required by
all packages, this will permit something like this:
```Configuration example
$module{pf}{TCPports} = [ 22 ];
$module{gnome}{enable} = 1;
$module{gnome}{lang} = "fr_FR.UTF-8";
@packages = qw/catgirl firefox keepassxc/;
```
The module gnome will know it's enabled and that @packages has to
receive gnome3 and gnome3-extras packages in order to work.
Such main configuration file will allow to catch incompatibilities like
enabling gdm and xenodm at the same time.
You are viewing proxied material from dataswamp.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.