Answer the question
In order to leave comments, you need to log in
How to monitor apt messages via python on Debian?
I'm trying to write a program to automatically install the necessary programs after reinstalling the OS.
Ran into a problem when apt asks if you want to install a package (or whatever). I can’t figure out how to track this event to send (y or D for example, or enter a password)
Answer the question
In order to leave comments, you need to log in
I'm not sure I understand the question exactly, but apt-get has a -y flag . And apt-get messages in Python are tracked quite simply: as I understand it, subprocess is used , there you can get both stdout and stderr, catch anything on them. But it's all somehow complicated ... If your software set does not change often and it all comes down to shell manipulations, then it's much more logical and easier to use a simple bash script here. If we are talking about servers and there are a lot of them, then you can not crutch, use, for example, Ansible .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question