Tiny Core Base > TCB Tips & Tricks
How to find which extension provides a file
patrikg:
I think this script can also detect some fault tcz's, that the squashfs is making so you don't clobbing your own old files and directorys.
Here is the old thread talking about that.
https://forum.tinycorelinux.net/index.php/topic,25229.msg161137.html#msg161137
Rich:
Hi patrikg
The version that is currently part of Tinycore is also capable
of that. The syntax for that version is a bit more cryptic:
--- Code: ---provides.sh "\/usr_1\/"
--- End code ---
Using the version attached to my last post would look like this:
--- Code: ---provides.sh /usr_1/
--- End code ---
patrikg:
Hi @Rich
Ok, thanks for that. Didn't know.
This is because my main dist is not TC.
I am just here to help out, because i want that TC survives.
I like it a lot with embedded systems like Raspberry PI (PICore).
And if somebody want to learn how Linux works i suggest to use TC, it's
not bloated with so many things.
It's not just the kernel(Core) that's are Tiny.
mocore:
ftr
a vaguely related tangent ... expanding *generally* on some themes in this topic
can be found hear https://forum.tinycorelinux.net/index.php/topic,27364.0.html
Rich:
Hi polikuo
Focusing on ease of use and some speed improvements, I did
some more work on provides.sh:
1. The default search mode is unchanged. Any programs/scripts calling provides.sh should see no breakage.
2. No backslashes to enter. The script adds them if needed.
3. No quoting of search term, even if it includes embedded spaces.
4. End of search term can be marked with an anchor ($).
5. Added a brief help message (-h, -help, or --help).
6. Added alias to /usr/local/bin/awk if it exists.
7. Added -nz switch to skip zsync for faster responses.
8. These features all work for both the command line and the GUI.
Regular search:
--- Code: ---tc@E310:~/Scripting/Provides$ time ./provides.sh bin/grep$
grep.tcz
real 0m 1.36s
user 0m 0.49s
sys 0m 0.23s
tc@E310:~/Scripting/Provides$
--- End code ---
Same search, no zsync:
--- Code: ---tc@E310:~/Scripting/Provides$ time ./provides.sh -nz bin/grep$
grep.tcz
real 0m 0.22s
user 0m 0.19s
sys 0m 0.03s
tc@E310:~/Scripting/Provides$
--- End code ---
-nz switch can be placed before or after the search term.
-nz switch also works in the Apps GUI Provides field.
Search, no zsync, embedded space:
--- Code: ---tc@E310:~/Scripting/Provides$ time ./provides.sh Black Gnome -nz
volumeicon.tcz
real 0m 0.13s
user 0m 0.11s
sys 0m 0.02s
tc@E310:~/Scripting/Provides$
tc@E310:~/Scripting/Provides$ time ./provides.sh Make Cocoa Headers.txt -nz
fpc-src.tcz
real 0m 0.13s
user 0m 0.10s
sys 0m 0.02s
tc@E310:~/Scripting/Provides$
--- End code ---
No quotes required.
And the help message:
--- Code: ---tc@E310:~/Scripting/Provides$ ./provides.sh --help
Find extension(s) that provide a filename.
Filenames in list being searched include full paths, for example:
usr/local/bin/grep
Usage:
provides.sh [ -nz ] FileName
-nz Skip updating (zsync) the provides.db file. This speeds up
the search, but might miss items if provides.db is outdated.
Examples:
provides.sh cal Finds cal anywhere in FileName
provides.sh bin/cal Finds bin/cal anywhere in FileName
provides.sh bin/cal$ Finds FileName that ends in bin/cal
provides.sh Black Gnome Finds FileName with embedded spaces
The more specific the search, the fewer the results returned.
tc@E310:~/Scripting/Provides$
--- End code ---
I've attached a copy of this version. I would appreciate it if some forum
members download, test, and provide comments.
After downloading, run:
--- Code: ---sudo cp provides.sh /usr/bin
--- End code ---
The new provides.sh will now be functional for both command line and Apps GUI.
I will be removing the attachments from previous posts.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version