Re: apt-get autoclean configuration

2017-07-21 Thread solitone
On Friday, 21 July 2017 16:09:15 CEST Curt wrote:
> The man page sends you to '/usr/share/doc/apt/examples/configure-index.gz',
> where the boolean values are exclusively (I think) "true" or "false", as
> are all the default values in the /etc/apt/apt/apt.conf.d "fragments."

I see, but what confused me is that regarding the autoclean option the value 
"off" is mentioned in the manual, rather than "false". Since I didn't find any 
example with "off", I was unsure whether the suggested "off" would work 
anyway.
-- 
⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢠⠒⠀⣿⡁Sent from my brain using neurons fueled by glucose.
⢿⡄⠘⠷⠚⠋⠀ 
⠈⠳⣄



Re: apt-get autoclean configuration

2017-07-21 Thread Curt
On 2017-07-19,   wrote:
>
>> 
>> $ 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 :-)

The man page sends you to '/usr/share/doc/apt/examples/configure-index.gz', 
where
the boolean values are exclusively (I think) "true" or "false", as are
all the default values in the /etc/apt/apt/apt.conf.d "fragments."

> 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 ,int Default)
> | {
> |char *ParseEnd;
> |int Res = strtol(Text.c_str(),,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?

I don't know; the program is tolerant without befuddling you with a
host of possibilites (like a menu in a Chinese restaurant).

However this thread is proof that confusion arises and has arisen. I
would be for stating clearly and exclusively in the man page the options
"true" and "false" while leaving the tolerance in the code.

> Cheers
> - -- tomás
>
>


-- 
“We’ll sit around talking about the good old days, when we wished that we were 
dead.”
--Samuel Beckett, speculating on the nature of the afterlife.



Re: apt-get autoclean configuration

2017-07-20 Thread Fungi4All
> From: solit...@mail.com
> The thing is that it"s not obvious to me that you can set any of the values:
> "true", "on", "yes" vs. "false", "off", "no".

A bit off topic, but in some places the ^ means high in others it means low
on top. As in file managers and taks managers. Whatsupwitdat?
But every other conf/rc file I edit has its own set of unique syntax.
Shouldn't there be some linux standardization to include some such minor
details? Maybe a linux savoir-vivre manual (hey, I got that spelling right)

Re: apt-get autoclean configuration

2017-07-20 Thread solitone
On Thursday, 20 July 2017 08:25:41 CEST David Wright wrote:
> On Wed 19 Jul 2017 at 16:21:57 (+0200), to...@tuxteam.de wrote:
> > On Wed, Jul 19, 2017 at 03:48:03PM +0200, solitone wrote:
> > > On Wednesday, 19 July 2017 15:22:33 CEST to...@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:
> > I'd think so. But alas, I can't quote a document stating the "official"
> > syntax. The man page doesn't say anything on this :-/
> 
> I don't understand. man apt.conf   has a whole section on syntax

The thing is that it's not obvious to me that you can set any of the values: 
"true", "on", "yes" vs. "false", "off", "no".
-- 
⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢠⠒⠀⣿⡁Sent from my brain using neurons fueled by glucose.
⢿⡄⠘⠷⠚⠋⠀ 
⠈⠳⣄



Re: apt-get autoclean configuration

2017-07-20 Thread David Wright
On Wed 19 Jul 2017 at 16:21:57 (+0200), to...@tuxteam.de wrote:
> On Wed, Jul 19, 2017 at 03:48:03PM +0200, solitone wrote:
> > On Wednesday, 19 July 2017 15:22:33 CEST to...@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:
> 
> I'd think so. But alas, I can't quote a document stating the "official" 
> syntax.
> The man page doesn't say anything on this :-/

I don't understand. man apt.conf   has a whole section on syntax:

SYNTAX
   The configuration file is organized in a tree with options organized
   into functional groups. Option specification is given with a double
   colon notation; for instance APT::Get::Assume-Yes is an option within
   the APT tool group, for the Get tool. Options do not inherit from their
   parent groups.

   Syntactically the configuration language is modeled after what the ISC
   tools such as bind and dhcp use. Lines starting with // are treated as
   comments (ignored), as well as all text between /* and */, just like
   C/C++ comments. Each line is of the form APT::Get::Assume-Yes "true";.
   The quotation marks and trailing semicolon are required. The value must
   be on one line, and there is no kind of string concatenation. Values
   must not include backslashes or extra quotation marks. Option names are
   made up of alphanumeric characters and the characters "/-:._+". A new
   scope can be opened with curly braces, like this:


   APT {
 Get {
   Assume-Yes "true";
   Fix-Broken "true";
 };
   };

   with newlines placed to make it more readable. Lists can be created by
   opening a scope and including a single string enclosed in quotes
   followed by a semicolon. Multiple entries can be included, separated by
   a semicolon.


   DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};

   In general the sample configuration file
   /usr/share/doc/apt/examples/configure-index.gz is a good guide for how
   it should look.

etc etc, and the file referred to has between four and eight hundred
lines (jessie/stretch) of example configuration.

Cheers,
David.



Re: apt-get autoclean configuration

2017-07-20 Thread solitone
On Wednesday, 19 July 2017 23:02:04 CEST to...@tuxteam.de wrote:
> There is this function StringToBool in apt-pkg/contrib/strutl.cc:
>
>  [...]
>
>  |// 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;
> 
> That seems to be it: no/false/without/off/disable versus
> yes/true/with/on/enable. Should that be in the docs?

Thanks tomás, that's great! 

I think this info should defenitely be in the man page.
-- 
⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢠⠒⠀⣿⡁Sent from my brain using neurons fueled by glucose.
⢿⡄⠘⠷⠚⠋⠀ 
⠈⠳⣄



Re: apt-get autoclean configuration

2017-07-19 Thread tomas
-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 to...@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 ,int Default)
 | {
 |char *ParseEnd;
 |int Res = strtol(Text.c_str(),,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-



Re: apt-get autoclean configuration

2017-07-19 Thread tomas
-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 to...@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:

I'd think so. But alas, I can't quote a document stating the "official" syntax.
The man page doesn't say anything on this :-/

Cheers
- -- tomás

> $ cat /etc/apt/apt.conf.d/80autoclean 
> APT::Clean-Installed "false";

Looks sane to me. I'll try to come up with a reference later.

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

iEYEARECAAYFAllvawUACgkQBcgs9XrR2kayfQCfU2Yn7BqQgh/i1Gmi/eDpg5D9
1i8AnRz8MrepurY6rYE7JErQX6IR/j3C
=YIWd
-END PGP SIGNATURE-



Re: apt-get autoclean configuration

2017-07-19 Thread solitone
On Wednesday, 19 July 2017 15:22:33 CEST to...@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";



Re: apt-get autoclean configuration

2017-07-19 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wed, Jul 19, 2017 at 02:51:28PM +0200, solitone wrote:
> >From 'man apt-get':
> 
> autoclean (and the auto-clean alias since 1.1)
>[...]
>The configuration
>option APT::Clean-Installed will prevent installed packages
>from being erased if it is set to off.
> 
> I've just lost some cached package files, although they are installed, so I 
> want to set this option. Should I create a file in /etc/apt/apt.conf.d for 
> this 
> purpose?

Yes, that seems to be the convention. Something around

  echo "APT::Clean-Installed no;" > /etc/apt/apt.conf.d/no-autoclean

(of course you want to make sure that the file no-autoclean isn't there,
use a different name or append with >> or something. Look first :-)

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

iEYEARECAAYFAllvXRkACgkQBcgs9XrR2kbeVgCfUVD6Qf5tDF1fDhi0K4358EeU
et8An3oDGskht/TNjSuswLdoddFW2iAL
=9cml
-END PGP SIGNATURE-