web-dev-qa-db-fra.com

Comment définir une option par défaut pour dpkg --configure -a?

Comment puis-je envoyer une commande comme suit, mais avec les paramètres par défaut (sans entrée de l'utilisateur). Je veux utiliser ceci dans un script Shell.

 dpkg --configure -a ...

 ==> Modified (by you or by a script) since installation.  ==> Package  
distributor has shipped an updated version.    What would you like to   
do about it ?  Your options are:  
Y or I  : install the package maintainer's version  
N or O  : keep your currently-installed version  
D     : show the differences between the versions  
Z     : start a Shell to examine the situation  The default action is to keep your current version.  
*** CONFIGFILE (Y/I/N/O/D/Z) [default=N] ? ^C   
6
Adrian B

C'est un travail pour yes, si vous voulez toujours la réponse N:

yes N | dpkg --configure -a

Ou Y (fonctionne sans argument):

yes | dpkg --configure -a

Ou sur les options dpkg, voir dpkg --force-help:

[...]
[!] confnew            Always use the new config files, don't Prompt
[!] confold            Always use the old config files, don't Prompt
[!] confdef            Use the default option for new config files if one
                       is available, don't Prompt. If no default can be found,
                       you will be prompted unless one of the confold or
                       confnew options is also given
[...]

Utilisez ensuite (par exemple):

dpkg --configure -a --force-confnew
5
chaos