Forum: Cfengine Help
Subject: Package installation - trouble specifying environment variable
Author: ticketo
Link to topic: https://cfengine.com/forum/read.php?3,21587,21587#msg-21587

Hello

Reading through the documentation, the cleanest (and changewise most confined) 
way to enable non-interactive package installations in debian would be:

DEBIAN_FRONTEND=noninteractive /usr/bin/aptitude --assume-yes --quiet install

This way packages are installed without user interaction via cfengine, but if 
apt-get is called from command line (or anywhere else), then the user is being 
asked.

However cfengine doesn't like it if I tweak the std-library accordingly:

body package_method generic {
[...]
 debian.have_aptitude::
  package_add_command => "DEBIAN_FRONTEND='noninteractive' /usr/bin/aptitude 
--assume-yes install";
  package_list_update_command => "/usr/bin/aptitude update";
  package_delete_command => "DEBIAN_FRONTEND='noninteractive' /usr/bin/aptitude 
--assume-yes remove";
  package_update_command =>  "DEBIAN_FRONTEND='noninteractive' 
/usr/bin/aptitude --assume-yes install";
  package_verify_command =>  "/usr/bin/aptitude show";
  package_noverify_regex => "(State: not installed|E: Unable to locate package 
.*)";
[...]
}

Scalar item in package_add_command => { DEBIAN_FRONTEND=noninteractive 
/usr/bin/aptitude --assume-yes --quiet install } in rvalue is out of bounds 
(value should match pattern "?((:\\.*)|(/.*))), near token 
'DEBIAN_FRONTEND=noni'
[...]
Validation: Scalar item in package_add_command => { 
DEBIAN_FRONTEND=noninteractive /usr/bin/aptitude --assume-yes --quiet install } 
in rvalue is out of bounds (value should match pattern "?((:\\.*)|(/.*)))


a) How can I change the parser and make this a valid syntax?
or
b) How can I set an environment variable beforehand?
or
c) Are there any other options, except bruteforcing aptitude to always use a 
noninteractive frontend (very unclean and disruptive) or writing a wrapper 
script (another file to distribute and take care of).



Btw.: Why isn't this already part of the standard library?

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to