LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-08-2007, 03:16 PM   #1
1veedo
Member
 
Registered: Dec 2004
Location: WV, USA
Distribution: Gentoo, Debian
Posts: 186

Rep: Reputation: 34
Writing script to find all archives w/ usr/local


While trying to fix a little problem of file location that I had screwed up w/ unionfs, I ended up running rm -rf ./usr/local (on another install, gentoo). I havn't tried booting into it yet, mostly because I just changed my cursor and I know for a fact that it was located in /usr/local/cursors.

I copied /usr/local/* .../usr/local, both systems are gentoo, but I'm positive that that's not good enough. But this should be easy to fix. I have gentoo building pkgs in the form tbz2 and I wnat to run a script that will look in every package located /32/All and find ones w/ /usr/local -- namely
Code:
tar -t --file=/32/All/$FILE | grep "usr/local"
There are two things missing.

#1 I need someway of outputing which archives actually have /usr/local, instead of just listing the files in the archive. If this proves impossible, I can always equery and figure it out or just rewrite the script to extract them.

#2 I need to somehow be able to store the files in All in a variable and feed them one at a time to the command, like a for loop.

I dont think #2 is that hard but I cant figure out how to do this.
Code:
for X in $"ls /32/All"
do
tar -t --file=/32/All/$X | grep "usr/local"
done

Last edited by 1veedo; 01-08-2007 at 03:22 PM.
 
Old 01-08-2007, 03:31 PM   #2
1veedo
Member
 
Registered: Dec 2004
Location: WV, USA
Distribution: Gentoo, Debian
Posts: 186

Original Poster
Rep: Reputation: 34
I got it.
Code:
#/bin/bash

for X in /32/All/*
do
echo $X
tar -t --file=$X | grep "usr/local"
echo " "
echo " "
done
Then I run /fixlocal > /output to get rid of all the EOF errors.

However, I didn't find any /usr/locals! It works because I can run it for /usr/share...

equery belongs can also find /usr/share etc, but no /usr/local. Is it that unused of a directory that I should just not worry about it?

Last edited by 1veedo; 01-08-2007 at 03:56 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing a bash script to find and register vmware vms juchestyle Programming 6 01-07-2007 12:03 PM
making files available in /usr/local/bin and /usr/sbin reakinator Linux - Newbie 1 10-14-2006 05:09 PM
/usr/local/bin/modem_run ==>can't find that file freakske Linux - Software 2 11-06-2005 06:15 AM
Installing software, /usr/lib directory and /usr/local millertime Linux - Software 2 07-10-2004 09:21 AM
Can't find adsl-setup script in /usr/sbin caddie Linux - Newbie 1 09-11-2002 10:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration