B
B
B1ackGh0st2015-03-30 07:32:37
Python
B1ackGh0st, 2015-03-30 07:32:37

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

2 answer(s)
D
Dmitry Filimonov, 2015-03-30
@B1ackGh0st

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 .

A
AVKor, 2015-03-30
@AVKor

I see no reason to use Python in this task.
The -y option has already been written about.
An answer file is created , the installation takes place automatically.
After installing the base system, everything else can be done with bash scripts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question