[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apt-get autoclean configuration



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Jul 19, 2017 at 03:48:03PM +0200, solitone wrote:
> On Wednesday, 19 July 2017 15:22:33 CEST tomas@tuxteam.de wrote:
> >   echo "APT::Clean-Installed no;" > /etc/apt/apt.conf.d/no-autoclean
> 
> I've set it to "false", not to "no". The manual says "off", but didn't find any 
> occurence of "on" and "off" in the other apt config files, just "true" or 
> "false". Hope it works:
> 
> $ cat /etc/apt/apt.conf.d/80autoclean 
> APT::Clean-Installed "false";

Didn't find any ref in the docs, so I downloaded the package source
(with a tip o' the hat to the "video driver/free software" thread,
esp. to Doug there: hi, Doug :-)

There is this function StringToBool in apt-pkg/contrib/strutl.cc:

 | // StringToBool - Converts a string into a boolean                      /*{{{*/
 | // ---------------------------------------------------------------------
 | /* This inspects the string to see if it is true or if it is false and
 |    then returns the result. Several varients on true/false are checked. */
 | int StringToBool(const string &Text,int Default)
 | {
 |    char *ParseEnd;
 |    int Res = strtol(Text.c_str(),&ParseEnd,0);
 |    // ensure that the entire string was converted by strtol to avoid
 |    // failures on "apt-cache show -a 0ad" where the "0" is converted
 |    const char *TextEnd = Text.c_str()+Text.size();
 |    if (ParseEnd == TextEnd && Res >= 0 && Res <= 1)
 |       return Res;
 |    
 |    // Check for positives
 |    if (strcasecmp(Text.c_str(),"no") == 0 ||
 |        strcasecmp(Text.c_str(),"false") == 0 ||
 |        strcasecmp(Text.c_str(),"without") == 0 ||
 |        strcasecmp(Text.c_str(),"off") == 0 ||
 |        strcasecmp(Text.c_str(),"disable") == 0)
 |       return 0;
 |    
 |    // Check for negatives
 |    if (strcasecmp(Text.c_str(),"yes") == 0 ||
 |        strcasecmp(Text.c_str(),"true") == 0 ||
 |        strcasecmp(Text.c_str(),"with") == 0 ||
 |        strcasecmp(Text.c_str(),"on") == 0 ||
 |        strcasecmp(Text.c_str(),"enable") == 0)
 |       return 1;
 |    
 |    return Default;

That seems to be it: no/false/without/off/disable versus yes/true/with/on/enable.
Should that be in the docs?

Cheers
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAllvyMwACgkQBcgs9XrR2kaq7ACfVIAYlbhuqXK2N8yzBYN+1z6f
vZAAnRCMKo5PyVJWU7UAi9Q7PMNkIGbf
=3tK9
-----END PGP SIGNATURE-----


Reply to: