1Rex::Commands::PkgConf(U3s)er Contributed Perl DocumentatRieoxn::Commands::PkgConf(3)
2
3
4
6 Rex::Commands::PkgConf - Configure packages
7
9 With this module you can configure packages. Currently it only supports
10 Debian (using debconf), but it is designed to be extendable.
11
13 my %options = get_pkgconf('postfix');
14 say $options{'postfix/relayhost'}->{value};
15
16 # Only obtain one value
17 my %options = get_pkgconf('postfix', 'postfix/relayhost');
18 say $options{'postfix/relayhost'}->{value};
19
20 # Set options
21 set_pkgconf("postfix", [
22 {question => 'chattr', type => 'boolean', value => 'false'},
23 {question => 'relayhost', type => 'string', value => 'relay.example.com'},
24 ]);
25
26 # Don't update if it's already set
27 set_pkgconf("mysql-server-5.5", [
28 {question => 'mysql-server/root_password', type => 'string', value => 'mysecret'},
29 {question => 'mysql-server/root_password_again', type => 'string', value => 'mysecret'},
30 ], no_update => 1);
31
33 get_pkgconf($package, [$question])
34 Use this to query existing package configurations.
35
36 Without a question specified, it will return all options for the
37 specified package as a hash.
38
39 With a question specified, it will return only that option
40
41 Each question is returned with the question as the key, and the value
42 as a hashref. The hashref contains the keys: question, value and
43 already_set. already_set is true if the question has already been
44 answered.
45
46 # Only obtain one value
47 my %options = get_pkgconf('postfix', 'postfix/relayhost');
48 say $options{'postfix/relayhost'}->{question};
49 say $options{'postfix/relayhost'}->{value};
50 say $options{'postfix/relayhost'}->{already_set};
51
52 set_pkgconf($package, $values, [%options])
53 Use this to set package configurations.
54
55 At least the package name and values must be specified. Values must be
56 an array ref, with each item containing a hashref with the attributes
57 specified that are required by the package configuration program.
58
59 For example, for debconf, this must be the question, the type and
60 answer. In this case, the types can be any accetable debconf type:
61 string, boolean, select, multiselect, note, text, password.
62
63 Optionally the option "no_update" may be true, in which case the
64 question will not be updated if it has already been set.
65
66 See the synopsis for examples.
67
68
69
70perl v5.34.0 2022-01-19 Rex::Commands::PkgConf(3)