From owner-freebsd-questions Fri Nov 8 21: 6:57 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8093E37B404 for ; Fri, 8 Nov 2002 21:06:53 -0800 (PST) Received: from ip68-14-62-49.no.no.cox.net (ip68-14-62-49.no.no.cox.net [68.14.62.49]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7E82643E8A for ; Fri, 8 Nov 2002 21:06:52 -0800 (PST) (envelope-from conrads@cox.net) Received: from ip68-14-62-49.no.no.cox.net (localhost [127.0.0.1]) by ip68-14-62-49.no.no.cox.net (8.12.6/8.12.6) with ESMTP id gA956g57015883; Fri, 8 Nov 2002 23:06:43 -0600 (CST) (envelope-from conrads@ip68-14-62-49.no.no.cox.net) Received: (from conrads@localhost) by ip68-14-62-49.no.no.cox.net (8.12.6/8.12.6/Submit) id gA956XSl015882; Fri, 8 Nov 2002 23:06:33 -0600 (CST) (envelope-from conrads) Message-ID: X-Mailer: XFMail 1.5.3 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <3DCBC81B.BE5526EB@ene.asda.gr> Date: Fri, 08 Nov 2002 23:06:33 -0600 (CST) Reply-To: conrads@cox.net Organization: A Rag-Tag Band of Drug-crazed Hippies From: Conrad Sabatier To: Lefteris Tsintjelis Subject: Re: Port managment Cc: freebsd-questions@FreeBSD.ORG Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 08-Nov-2002 Lefteris Tsintjelis wrote: > Conrad Sabatier wrote: >> >> On 08-Nov-2002 Lefteris Tsintjelis wrote: >> > Just to sum it up for the archives >> > >> > Conrad Sabatier wrote: >> >> >> >> On 07-Nov-2002 Lefteris Tsintjelis wrote: >> >> > Hi, >> >> > >> >> > I have acrually a few questions: >> >> > >> >> > 1) How can I find ports that do not depend in any other ports? >> >> >> >> pkg_info -ar >> > >> > Or, a very nice port (/usr/ports/sysutils/pkg_tree) I just found. It >> > does the same job with better on screen results. It can even display >> > dependencies of the dependencies in a nice graphical tree. >> > >> > pkg_tree -v >> >> Interesting. I'll have to have a look at that. >> >> >> > 2) How can I find files that are unused by any port? >> >> >> >> /usr/ports/Tools/scripts/check_consistency >> > >> > I think /usr/ports/Tools/scripts/consistency-check examines modified >> > files within /usr/local/bin only. >> > >> >> or >> >> >> >> pkg_which file(s) >> > >> > A better way to examine files in any path would be to use pkg_which -v >> > Something like "find -type f | xargs pkg_which -v | >> > fgrep '?'" would check against any port in any path. >> >> Well, yes, I didn't elaborate any further on this one. Just wanted to >> point you in the right direction. :-) > > Yes, I believe you did. :-) > >> >> > 3) How can I find modified files? >> >> >> >> pkg_info -ag >> >> >> >> > 4) How can I find missing port files? >> >> >> >> Need some clarification as to what you mean. >> > >> > I think your previous answer covers this one as well. I meant if any >> > of >> > the already installed port files are missing. "pkg_info -ag" displays >> > results of any modified/missing port files. >> > Is there a way to also check the system (/bin /sbin ...) for >> > modified/missing/extra files? >> >> man mtree > > That certainly takes care of that too! > >> >> > 5) _AND_ (yes finally) How can I find missing port dependencies? >> >> >> >> pkg_info -I $(pkg_info -arq | cut -d ' ' -f 2) >> > >> > I am not sure here if the results are any missing port dependencies. I >> > get a multiple list of the ports that are already installed. >> >> Well, the idea here is that if a package is missing, an error message >> will >> be displayed. Perhaps a better way to run this would be: >> >> pkg_info -I $(pkg_info -arq | cut -d ' ' -f 2) >/dev/null >> >> So only any errors will actual display. > > I see. There is also a nice sysutil port /usr/ports/sysutils/libchk. It > checks almost any shared libraries links. I guess that about sums it up. > Using the above commands, you could check almost everything in your file > system. Great job, thanks. The idea here is to always be able to check > the > whole system against minor data corruption problems or accidental > deletes or unknown files and file modifications. Is there anything else > I might be missing? I recently hacked together a little script to check for stale symbolic links: #!/bin/sh # # Check symbolic links to make sure they're valid pointers if [ $# -eq 0 ] then root=/ else root="$(realpath $1)" fi IFS=$(echo -e "\n") find "$root" -type l | while read link do echo -n Checking "$link..." lp="$(readlink "$link")" if [ ! -e "$lp" ] && [ ! -e "$(dirname "$link")/$lp" ] then echo Bad link: "$link" -- "$lp" does not exist else echo OK fi done -- Conrad Sabatier To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message