I am creating an RPM and in the pre stage, I want to determine apache's document root so I can copy the web application files there.
First, I check if apache is installed. If apache is installed, the script will look for the location of httpd.conf file since it contains the document root param. But I do not know how to handle the return of the command
find / -name httpd.conf. I'm just new to shell scripts and RPM. Would like also to know if this is possible. The goal to have the RPM so it can be deployed at any system, without much manual intervention. Bellow is the code I was planning. It is not yet working
if [ "$(expr substr $(httpd -v) 17 6)" == "Apache"]; then echo "Apache is installed"; find / -name httpd.conf //need to handle the return of find and store to a location var to be used on the next line grep -i 'DocumentRoot' $location/httpd.conf //need to store the return document root to a var el echo "Apache is not installed"; fi