How do you know if the software was installed per OFA? The program files could be anywhere on the system. Maybe components were installed and then taken off. You don't know for sure by looking at directories such as /var/opt/oracle or the Oracle owner's home directory. Who is to say $ORACLE_HOME was ever set as an environment variable in .login or .cshrc or whatever?
You could view /etc/passwd and /etc/group to look for an Oracle owner and group. If an Oracle owner exists, "su - ownername" and you will be in the owner's home directory, assuming one was specified in the passwd file.
So, if you really don't know if Oracle was installed and you are not sure about user account resource files (i.e., the path statement does not include /some path for Oracle/bin), one recourse is to search the entire file system. That is the only way a script can verify if something exists.
Checking for existence of specific items (files, directories, and environment variables) is easy to do with a script, but to "verify if Oracle was installed" - you need to do more work than what was posted by jovery, or rephrase your question to ask for something more definite (e.g., "I know Oracle is installed. How can I see if I have $ORACLE_PATH set as an environment variable?").
- I have a script that install Oracle software using OFA
- I know all environment values like, ORACLE_HOME, ORACLE_BASE, the oracle user, etc
- This script is called by a installer graphical tool to install oracle and another software that use the database
- When this another software is reinstalled, the user must to reinstall the oracle too
I want to put the intelligence of installing the oracle or not into the installer script because this way the graphical tool always call the installer script, but the script decides if the oracle needs to be install or not.
Note that is a controlled scenario, I don’t need to create a generic script.