diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-28 13:05:01 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-28 13:05:01 +0200 |
| commit | d97dadfa50eb34b3eba63a31878aa38d01303f8f (patch) | |
| tree | 8417052158f621b308211b93209cbf362eb9c49d /frontends | |
| parent | 10dfe74aa8e847b89211572946596c590b1f8d39 (diff) | |
frontends: install gogios from pkg repo, add pkgrepo_setup task
Replace manual binary copy in gogios_install with pkg install (FreeBSD)
and pkg_add (OpenBSD). Add pkgrepo_setup task that configures PKG_PATH
in root's .profile on OpenBSD frontends. The gogios task now calls
gogios_install automatically.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'frontends')
| -rw-r--r-- | frontends/Rexfile | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/frontends/Rexfile b/frontends/Rexfile index 4b57dfa..0b508a9 100644 --- a/frontends/Rexfile +++ b/frontends/Rexfile @@ -504,12 +504,47 @@ task 'dtail', }; desc 'Installing Gogios binary'; +# Configure the custom package repository on OpenBSD frontends. +# Adds PKG_PATH to root's .profile so custom packages are available +# alongside the official OpenBSD repo. Official packages still install +# normally; custom (unsigned) packages require -D unsigned. +desc 'Setup custom package repo on OpenBSD frontends'; +task 'pkgrepo_setup', + group => 'frontends', + sub { + my $custom_repo = 'https://pkgrepo.f3s.buetow.org/openbsd/7.8/packages/amd64/'; + my $profile_line = "export PKG_PATH=\"${custom_repo}\""; + + append_if_no_such_line '/root/.profile', $profile_line; + }; + +# Install or update gogios from the custom package repository. +# FreeBSD hosts use pkg, OpenBSD hosts use pkg_add. task 'gogios_install', group => 'frontends', sub { - file '/usr/local/bin/gogios', - source => 'usr/local/bin/gogios', - mode => '0755'; + my $os = run 'uname -s'; + chomp $os; + + if ( $os eq 'OpenBSD' ) { + # Remove any previously manually deployed binary not managed by pkg + my $pkg_check = run 'pkg_info gogios 2>/dev/null'; + if ( $? != 0 && is_file('/usr/local/bin/gogios') ) { + Rex::Logger::info('Removing manually installed gogios binary...'); + run 'rm -f /usr/local/bin/gogios'; + } + + # Install or update from custom repo (unsigned for now) + say run 'PKG_PATH="https://pkgrepo.f3s.buetow.org/openbsd/7.8/packages/amd64/" pkg_add -D unsigned -u gogios || PKG_PATH="https://pkgrepo.f3s.buetow.org/openbsd/7.8/packages/amd64/" pkg_add -D unsigned gogios'; + } + elsif ( $os eq 'FreeBSD' ) { + say run 'pkg update -r custom && pkg install -y gogios'; + } + else { + Rex::Logger::info("Unsupported OS: $os", 'error'); + } + + say run 'gogios -version'; }; desc 'Setup Gogios monitoring system'; @@ -521,9 +556,8 @@ task 'gogios', my $gogios_path = '/usr/local/bin/gogios'; - unless ( is_file($gogios_path) ) { - Rex::Logger::info( "Gogios not installed to $gogios_path! Run task 'gogios_install'", 'error' ); - } + # Ensure gogios is installed from the package repo + run_task 'gogios_install'; run 'adduser -group _gogios -batch _gogios', unless => 'id _gogios'; run 'usermod -d /var/run/gogios _gogios'; |
