Configuring Bash Script to work on other people's computers - linux

I've created a bash script that I'd like to share for other people to use
The script downloads video files, stores them in appropriate folders (which are essential to the app) and allows the user to cycle between them, using getopts so the user can send specific commands via flags
I've never done this before so I'm unsure of what "configuration" requirements I'd need to have so it works on other peoples computers. I want them to be easily able to download using homebrew or another package manager, automatically set up the required components and have them be able to use it
I know I have to create folders and a man page for them at the appropriate location. Does this require a makefile?
What other things should I be considering? My google search skills are sucking, so any links would be much appreciated

Package a precompiled busybox (https://busybox.net/downloads/binaries/latest/) next to your script, and use busybox functions only.

Related

Insert Environment variable

Is there any way to insert an Environment variable into a Linux local machine from a website?I just want that when an user clicks on a button from a website,automatically to insert an environment variable into the user linux machine.I need to do this in any web language programming.
This is definitely not possible - for the same reasons that you can't open files in Javascript from the browser.
Another solution is to allow them to download a bash script and run it on their own. You will need to include instructions to run it, of course. (Don't forget to make it executable chmod +x)
As a side note, this is probably not a good idea in the first place. You could include literally anything in that bash script, and the user (assuming (s)he can't read bash) would just have to trust you. It is generally not advised to run random bash scripts on your computer or allow websites to make modifications to your environment variables.

Creating a menu item generically in Linux

For part of a large university project I have built a large java based application. To make "installation" cleaner I am aiming to write a script to copy the jar to a hidden file in the users home directory then add a menu &/Or desktop launcher.
Since I do not know what platform the markers shall be using it seems sensible to make this generic so I was going to build a shell script and a batch file.
The shell script starts off simple, check the directory doesnt already exist, make it and copy the file accross.
Then it comes to making a launcher of some kind. I presume each desktop environment shall do things differently.
After 10 minutes with google it seems everything suggested is autotools but since I have no knowledge of this it seems a bit overkill.
Is there an easy way to achieve what i need?
Thanks
These days, basically all of the desktop environments uses desktop files. For the specification for those files, see the Desktop Entry Specification.
Normally, they're put in /usr/share/applications on the system. Those files are then read and used to construct the menu.
If you have the ability to write to the system /usr/share/applications directory, that's obviously simplest, but if you had that, you would probably be putting the JAR file somewhere other than a hidden directory in the user's home directory.
If not, the path that's supposed to be honored is ~/.local/share/applications. If you drop a desktop file in there, it should show up for the user. (This is somewhat newer; I don't think GNOME 2 supports, it for example. Older desktop environments had various special places for these files.)
Then, the problem basically reduces to figuring out what to write for the Exec line in the desktop file. (See the desktop files on your system in /usr/share/applications for some examples.) If you're lucky, you can get away with just sticking a java command in there, but the details will depend on your application.

Uploading Sawtooth Software ACA Survey to web using personal website hosting

The software created a Web Upload folder for me, which I uploaded to the site using an FTP Client (specifically WS_FTP). The first lines of the pearl files say "#!usr/bin/pearl" that I changed to "/home/calakpsi/pearl". However, when I execute the html file it searches my computer under "/C:/Users/myname/AppData/Roaming/Ipswitch/WS_FTP/Storage/cgi-bin/ciwweb.pl". I made sure the file it's looking for was in that folder, but for some reason the webpage would still not execute.
Any help or step by step solution (since I do not have an in depth technical background) would be much appreciated.
I think the problem is that your server is not configured properly to run perl scripts. Have a look at this, to see if it helps. The answer by Dave Sherohman should help you out.
Once you are able to run perl scripts, it should run (barring other issues which are script specific).
Overall the steps required to execute perl scripts are as follows. You can look up their details on the internet, as I don't know them myself.
Install any mods required for server, for instance mod_perl, on ubtuntu it would be something like sudo apt-get install libapache2-mod-perl2. If you are in windows, perhaps take one of those bitnami or other LAMP installers. They should come installed with it.
Configuration for server/virtual host, so that perl files in the directory are executed
ensure they have correct permission (and you should be all set).

CentOS/auditd: file creation at directory to trigger a script

I need to audit the directory and call a script with the file-path parameter as the file is created there. Reading the man of auditctl i can't find a way to do it.
There're references in the web to inotify or iwatch services, that should do what i need, but i'd rather use the standard auditd functionality not installing an extra software.
If that's really not possible to use auditd to track the file creation and call the script for that file, a short sample of iwatch/inotify command to do the trick will be appreciated and accepted.
For the CentOs environment pyinotify module was used which handles directories watch pretty well and triggers the desired scripts.
Unfortunately i wasn't able to find solution using pure auditd.
The list of examples of how do someone use pyinotify is here.

Double-click installer in Ubuntu?

I'm trying to update our installer so a user can simply double-click on a file and have all the dependencies and our software installed easily. This is a suite of applications that will are deployed on a clean UbuntuĀ 8.04 (Hardy Heron) installation. I have investigated making a .deb file, but listing the dependencies doesn't work, because there isn't any Internet access available. And, any script that would set up a local APT repository would still need to be run from the command line. Is there a way to put a .deb file inside of a .deb file?
I know many companies ship shell scripts that you have to chmod +x, and then execute. This is not acceptable. It is ridiculous that this isn't possible; especially considering the distribution and architecture is fixed.
If you are totally confident that it will be installed on the same system every time, you can find the list of package dependencies yourself, fetch them from the Ubuntu repositories, and package them up with your software. You just have to be clear that your software is for a specific version, probably deal with things like keeping up with maintenance releases.
You can also easily install with a script. As for your complaint about making scripts executable, well, I don't know how you're shipping your product, but since you say it's going somewhere without Internet access, I assume it's going to be copied from some kind of media. If you make the script executable when you put it on that media, you're done.
If you'd like to do this using packages, you can create a CD-ROM which contains a package repository. You can find all kinds of information on this with Google Search. For starters, try this - it's a GUI for doing it. http://aptoncd.sourceforge.net/
A makeself self-extracting executable that starts the install script using sudo will work.
The user can either run it from a terminal (after chmod-ing it) or can double-click it and tell it to "Run" from the prompt.
It's possible to put deb-files into deb-files. The only thing you need to do is to configure the appropriate scripts.
A .deb-file consists of:
1x control.tar.gz: contains a file "control" (describes the package) and optional files like "postinst" (script executed right after extraction). There are other files you might include, and Google Search should deliver information about the available scripts.
1x data.tar.gz: contains some structure of root-filesystem which contains files/folders that need to be (re-)placed. Additionally, you may configure the behaviour in the mentioned scripts.
1x debian-binary: as far as I remember, this is simply a version number in a file. I don't know exactly what it means; just remember that in most of the cases this is 2.0.
So you now may put your .deb files in the data-package. Those are extracted by your script... and installed using:
# dpkg -i yourpackage1.deb yourpackage2.deb

Resources