Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Following script extracts files from packages (rpm, txz, tgz, deb or arch) and creates 2 scripts: copier.sh and remover.sh, which can then be run as root to copy all the files into the system, or remove them from the system. One can keep a set of packages (may be of different types) in a folder, cd to that folder, give command 'supi *' to create copier.sh and remover.sh. They only copy and remove the files and do not run any pre or post-install commands.
This is obviously not a desirable way to install packages (which is to install from one's own repository, using native package manager) but it can be used to test foreign packages that are not available for one's own distribution. Are there any code errors in this script?
A nice little project of more than trivial complexity. Well done!
I am sure there are errors, since there is no software without errors. I suggest to test it, and if it doesn't behave as expected, ask specific questions.
For now, let me point out a few areas that can be improved:
The four awk statements under EXTRACT FILES are inefficient and awkward (pun intended). This is handled much better with a shell case statement.
Or at least call awk once instead of four times. Awk has been designed to handle more than one case.
cat somefile | awk '...' is known as cat abuse (check it out on wikipedia). Just run awk '...' somefile.
Rather than using awk to remove the string "./supitemp" from file and directory names, don't generate that string in the first place. I.e., instead of find ./supitemp, run cd supitemp; find .; cd -.
Also check out the links in my signature. I am sure others will chime in with more suggestions.
Last edited by berndbausch; 12-12-2015 at 01:42 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.