[SOLVED] Is there a way to reset /usr/local ?

I've used /usr/local to test a program without installing it to my system with pacman. Prior to this, /usr/local was empty. I'm still learning Linux, but it seems that /usr/local (in the case of Arch) could be used as a playground since nothing gets installed there (at least not in my personal history of using Arch) so that is why I've tested in that location. The only downside is that I've had to add environment variables to my system, but that's no problem.
So currently, /usr/local contains files pertaining only to one single app (in the various directories, e.g. bin, lib, etc). It'd be neat if there was a way to reset /usr/local to factory standards so I don't have to dig through every folder and delete stuff manually.
Is there such an app/script?
If /usr/local isn't meant to be used in such a way, perhaps it'd be convenient to have a folder called /usr/test or something? Or is that what the /tmp folder is for?
THanks for the enlightenment!
Last edited by trusktr (2012-04-01 22:04:08)

@trusktr. What you describe seems complicated and not much reliable. The stage 3) of my script "find the files that are cnewer than the file in /tmp" and make a log of the result in a file in /var/log that I leave there for reference. Of course I install only one package at a time. Your solution has the problem that if you touch in any way a file that belong to the package after it has been installed (because you or some tool modify a configuration file, for instance) you would loose the ability to track it (this would update the ctime to the actual time).
Removing a package is a little more complicated that you describe and cannot be fully automated. Some files are caches of files present in the filesystem (/usr/share/mime/mime.cache for instance) or are just modified by the installation of the package (/usr/share/info/dir) and contains information for several packages. You cannot just delete these files, you have to handle these properly.
Of course the good ways to do things would be to write an archlinux build script. But with my method, there is no additional work to install the package and, although it requires a little attention, it make at least the package removable.
Just for the info, I post my script here (it was written for my personal use with no man pages) (license: public domain):
http://pastebin.com/NTt6RPVE

Similar Messages

Maybe you are looking for