1

Sorry if something like this already exists, but in my research I found no evidence that it did.

what I want: a "monitor" type script that I can write, that I would "activate" prior to apt-get installing one or more (emphasis on more) packages, then "deactivate" it when I am done. It will 'log' everything installed, and if I am not happy with the installation, will remove all traces of all installs with one command.

I want to do this because I am a programmer, and setting up the programming environment for a new language can be bug ridden (or riddled with my own user error). For instance go lang gave me trouble, but ruby/rails was rather painless, etc

now, it is my understanding that apt-get purge, and autoremove do a pretty good job of cleansing the system of a package, but I'd like to think my idea is still useful when installing many packages in succession.

My question: How should I accomplish this most effectively, speed and logicality being a priority.

All (even seemingly bad) ways that I have found to implement:

--inotifywait: inconceivable for system wide use, could apply only to 'popular' directories, but would have files slip through the cracks

--diff: same as above, pretty much.

--git: use git to save a "picture" that could be rolled back to. Same issues as above, but to a lesser extent (in my opinion. Please correct me if otherwise)

--Log package names installed (somehow)/simply count number of packages installed, then go into /var/cache/apt and use apt-get remove etc. Would anything slip through the cracks here (usually)?

I listed the ideas in the order that I had them, in conjunction with my research, so as you can see they evolved into more reasonable solutions.

So essentially I come here for advice, because I am completely comfortable writing a bash script, but I've never had a need for one before, so I seek wiser counsel. And to be honest this is for fun and to learn, also.

Thanks!

  • 1
    apt-get stores logs in /var/log/apt/, if this help you. see http://askubuntu.com/questions/21657/show-apt-get-installed-packages-history-via-commandline and http://askubuntu.com/questions/425809/where-are-the-logs-for-apt-get – Ron Jun 12 '15 at 07:18
  • Hey! That worked like a charm. This little project is great for learning some cool CLI commands (if anyone is reading this). – Trés DuBiel Jun 12 '15 at 23:06

1 Answers1

1

To anyone with similar goals,

I ended up saving the /var/log/apt/history.log in two text files, one before and one after the installation "session". Also, to allow possible extension, I saved the output of the diff into a file, which was solely the package names of newly installed packages (this could allow an interactive command line option, that would cycle through each package with a (Y/n) delete option, instead of mass removal)

To get other people on the right path: sed/grep, diff, cut, tail, xargs, and the use of > and >> to send output to files. And basic bash scripting.