Rex::Co...PkgConf(3)

πŸ“¦ version 1.14.3, in nixos 26.05, nixpkgs unstable

πŸ’– Rex::Commands::PkgConf β€” Configure packages πŸ’–

okay bestie, welcome to the User Contributed Perl Documentation page for Rex::Commands::PkgConf, and honestly? it's giving "small but mighty" πŸ’…


✨ NAME ✨

Rex::Commands::PkgConf β€” Configure packages πŸŽ€


🌸 DESCRIPTION 🌸

So this module lets you configure packages. rn it only supports Debian (using debconf), but it's designed to be extendable β€” main character energy, it's gonna grow πŸ¦‹


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole vibe, copy these exactly bestie:

 my %options = get_pkgconf('postfix');
 say $options{'postfix/relayhost'}->{value};

 # Only obtain one value
 my %options = get_pkgconf('postfix', 'postfix/relayhost');
 say $options{'postfix/relayhost'}->{value};

 # Set options
 set_pkgconf("postfix", [
    {question => 'chattr', type => 'boolean', value => 'false'},
    {question => 'relayhost', type => 'string', value => 'relay.example.com'},
 ]);

 # Don't update if it's already set
 set_pkgconf("mysql-server-5.5", [
    {question => 'mysql-server/root_password', type => 'string', value => 'mysecret'},
    {question => 'mysql-server/root_password_again', type => 'string', value => 'mysecret'},
 ], no_update => 1);

πŸ‘‘ EXPORTED FUNCTIONS πŸ‘‘

⭐ get_pkgconf($package, [$question]) ⭐

use this to query the package configs that already exist β€” like a little vibe check on what's already set πŸ”

  • no question specified? it returns all the options for that package as a hash πŸ’–
  • question specified? it returns just that one option, slay

each question comes back with the question itself as the key, and the value is a hashref πŸŽ€ that hashref has these keys: question, value and already_set. and already_set is true if the question has already been answered β€” iykyk βœ…

 # Only obtain one value
 my %options = get_pkgconf('postfix', 'postfix/relayhost');
 say $options{'postfix/relayhost'}->{question};
 say $options{'postfix/relayhost'}->{value};
 say $options{'postfix/relayhost'}->{already_set};

⭐ set_pkgconf($package, $values, [%options]) ⭐

use this one to set package configs, periodt πŸ’…

you gotta specify at least the package name and the values. the values must be an array ref, and each item in it holds a hashref with the attributes that are required by the package configuration program 🫢

for example, for debconf, this must be the question, the type and the answer πŸ“ and in that case, the types can be any acceptable debconf type: string, boolean, select, multiselect, note, text, password.

optionally the option "no_update" may be true β€” in which case the question will not be updated if it has already been set πŸ™ˆ

heads up bestie: if you pass no_update, it really does skip the update when the thing's already set. no cap.

see the synopsis for the examples, they're right up there β¬†οΈβœ¨


and that's the whole page, bestie! 🌈 go forth and configure those packages πŸ’œ

mwah πŸ’‹ β€” signed off with perl v5.42.3, dated 2023-08-05, from the Rex::Co...PkgConf(3) girlies 🧚

πŸ“¦ where this page comes from