Can Linux Bash scripts respond to install options - linux

I need to script the installation of a number of products on Redhat Linux
I am installing from previously downloaded tar files that each contain their own specific install.sh.
My problem is that by executing the install.sh scripts a number of questions are asked such as ...
a). Accept license
b). set default path(s)
c). do i wish to start service
etc...
Can Bash detect these questions and respond correctly? or do i require another linux based product/function?
For windows based installs i have used AutoItScript.
What are my options on Linux Redhat?

To establish whether the scripts support any command line options, you can:
Read the readme file of the software, if there is one. This should explain any options.
Read the top of the install.sh script. Usually options are at least listed there.
Read the code itself, which might be a lot of work.
Once you have established that the scripts do not support options, the standard way of automating this would be with an expect script. See for example automating install.sh script using an expect script.
Depending on how the install script works, you may be able to send it commands on standard input. For example, if you press Tab once, then Enter, then y and lastly Enter again, you can try the following:
printf %s $'\t\ny\n' | ./install.sh

Related

How to build a silent installer

What are the ways to create a silent installer for a .bin file.
So, currently, I have a installer.bin file that installs the software on a VM (Linux machine) using GUI wizard. This increases the load on the server so, I am looking for different ways to create a silent installer that does not uses GUI, instead uses CLI for inputs/outputs.
Currently to install the application I run the following command:
$ sudo ./installer.bin -f installer.properties -i gui
The file installer.properties is a response file that has input parameters needed by the gui. The gui takes some input parameters like location, where to install the software etc.
There is one methods, I found on the internet.
Method: I found the -silent flag and passing in the response file.
$ sudo ./installer.bin -f installer.properties -i silent
This method doesn't seem to work well and throws the error: "Installer User Interface Mode Not Supported".
I am looking for various technologies or software or method that can be used to do the task above. I have looked at many other questions. I do not know whether this question has been asked before or not.
I wanted to know, is it possible to do so without changing the codebase. If so, how ?

ATG installation in silent mode

Is there a way to install ATG commerce platform in silent mode. I need to do this for puppet module for ATG commerce environment setup.
Installation consists of two parts. Running the installers, and then configuring the instances with CIM.
Running the installers involves accepting licensing terms etc., and legally should not be scripted. However, materially, all it does is expand the compressed file into the appropriate executables and module folder structure in, say, /opt/atg/ATG/ATG10.0.3. Run it by your legal team and/or your Oracle contact, but there is nothing technically stopping you from doing this yourself with your own script that copies a pre-canned folder structure from one place to another.
CIM does support silent running by running a script that you have recorded previously. See the -record command line parameter. Note that the recorded script will only run in an situation identical (or very similar) to when it was recorded. The options CIM presents (and the sequence they are presented in) change depending on which modules and products are installed (in step 1), and their paths.
First time you will need to do the installation manually to generate the response file:
./OCPlatform11.3.2_21REL.bin -r /path/to/ocplatform.rsp
Then, you can use the next command to run the silent installation using the response file:
./OCPlatform11.3.2_21REL.bin -f /path/to/ocplatform.rsp -i silent
Reference:
Usage: OCPlatform11.3.2_21REL [-f <path_to_installer_properties_file> | -options]
(to execute the installer)
where options include:
-?
show this help text
-i [swing | console | silent]
specify the user interface mode for the installer
-D<name>=<value>
specify installer properties
-r <path_to_generate_response_file>
Generates response file.

How to create files and folder in Atom using the command line?

I was watching a speedy workflow tutorial about Atom text editor, and saw how the guy uses Linu commands like ls (to check the files in the directory), touch (to create files eg. style.css) and mkdir (to create folders). Now in my Atom editor I am able to open the command line using the following command.
CTRL + SHIFT + T
Now in my command line the default windows command line opens up, I am able to create folder using mkdir, but the commands touch and ls don't work, which makes me wonder weather Atom has its own command line?
See the SCREENSHOT to see how this guy is creating folders, files and using the ls command.
So my question is, how do I create files in Atom? How do I get the touch command to work?
It looks like the tutorial is using the Term2 package for opening a shell within the editor (http://code.tutsplus.com/courses/speedy-workflows-with-atom/lessons/term2). Since you seem to be able to open a terminal using the described screenshot, you seem to have the Term2 package installed - so far so good.
This package opens a standard command window within the editor. The tutorial seems to be using Linux or Mac OS X as the operating system. If you're running Windows, you will only have the Windows CMD interpreter available.
Windows does not natively support the touch command (but it has a mkdir command). There is a unxtools project that provides some of the common Gnu tools. If you install that, you should be able to run touch from the Windows command shell as well. More details can be found here.

sh file not found in linux command line

I'm an owner of synology's diskstation NAS server running on special OS (mainly linux)
It has only access from internet. I established command line interface to access it using synology wiki. Now I try to install Counter-Strike server on it using SteamCMD. I just look in Valve Developer Community for it.
I'm writing the next:
mkdir csServer
cd csServer
wget http://media.steampowered.com/client/steamcmd_linux.tar.gz
tar xvfz steamcmd_linux.tar.gz
./steamcmd.sh
But the last line causes -sh: ./steamcmd.sh not found. However, I can see this file in the directory.
What actually can cause it?
//ADDED
The file is executable!
Your script contains a header which says #!/bin/bash, that is use /bin/bash to execute this script. Apparently, on your system /bin/bash is not present. I am not familiar with Synology environment, but you should be able to fix this problem by installing bash and then pointing your script to the right path, which should be /opt/bin/bash. The first line of your script should therefore look like the following
#!/opt/bin/bash
You could also use Synology default ash, but beware that you script might not work as it was written for bash.
Windows style end-of-lines (CRLF) can cause this issue. If your sh file contains Windows style end-of-lines, convert it to Linux style.

Linux CentOS Server Startscript: Minecraft Server

Recently tried using the following startscript here:
http://dev.bukkit.org/bukkit-plugins/linux-server-startscript-menu/
After installing dos2unix, it says it is installed and using the latest version. I then use the command "dos2unix startserver.sh" and I prompted with the message: "dos2unix: converting file startserver.sh to UNIX format ..." and then it returns to the next blank command line. Problem is there is nothing actually starting the script or I am missing something. I have tried talking to the owner of this script and he helped me to this point, but is unsure what to do next. He says he uses debian and is less familiar with CentOS and so I am posting here.
Here is my script that has been edited according to my server. The most important change I made is SCRIPTUPDATE="0" (so it doesn't update)
Please keep in mind that I am very new to linux and any operating systems in general.
The dos2unix command converts the newline characters in a file from dos format to unix format. This is just for cleaning up a file that may have problems (e.g., from a bad ftp transfer).
Try running the ./startserver.sh command again, now that the file has been cleansed.

Resources