I am trying to write a non-interactive system update script.
Question:
if the following works well:
yes | dpkg --configure -a will the following work also very well?:
yes | apt-get install --fix-broken You have -y or --yes or --assume-yes parameters in apt-get.
Try something like
sudo apt-get install -y <package-name> Details:
The manual page of apt-get (You can also refer to manual page with man apt-get command) mentions:
-y, --yes, --assume-yes
Automatic yes to prompts. Assume "yes" as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package or removing an essential package, occurs then apt-get will abort. Configuration Item: APT::Get::Assume-Yes.
Contrary to this parameter, you also have
--assume-no
Automatic "no" to all prompts. Configuration Item: APT::Get::Assume-No.
Edit
For Vlastimil's comment, I tried
sudo apt-get install --fix-broken --assume-yes And it works. The --fix-broken part of the command can be replaced with -f and --assume-yes with -y or --yes for convenience. This will not install any package in perticular but "can omit any packages to permit APT to deduce a likely solution", as mentioned on the manual page.