forked from HPR/hpr_generator
		
	#267 - remove dependency check for DBD::mysql
This commit is contained in:
		| @@ -1,73 +1,67 @@ | |||||||
| #!/bin/bash -  | #!/bin/bash - | ||||||
| #=============================================================================== | #=============================================================================== | ||||||
| # | # | ||||||
| #          FILE: check-dependencies.sh | #          FILE: check-dependencies.sh | ||||||
| #  | # | ||||||
| #         USAGE: ./check-dependencies.sh  | #         USAGE: ./check-dependencies.sh | ||||||
| #  | # | ||||||
| #   DESCRIPTION: Check that Perl module dependencies for the hpr_generator  | #   DESCRIPTION: Check that Perl module dependencies for the hpr_generator | ||||||
| #		  are installed. | #		  are installed. | ||||||
| #  | # | ||||||
| #       OPTIONS: --- | #       OPTIONS: --- | ||||||
| #  REQUIREMENTS: --- | #  REQUIREMENTS: --- | ||||||
| #          BUGS: --- | #          BUGS: --- | ||||||
| #         NOTES: --- | #         NOTES: --- | ||||||
| #        AUTHOR: Roan "Rho`n" Horning (roan.horning@gmail.com) | #        AUTHOR: Roan "Rho`n" Horning (roan.horning@gmail.com) | ||||||
| #  ORGANIZATION:  | #  ORGANIZATION: | ||||||
| #       CREATED: 09/05/2024 09:55:00 PM | #       CREATED: 09/05/2024 09:55:00 PM | ||||||
| #      REVISION:  --- | #      REVISION:  --- | ||||||
| #=============================================================================== | #=============================================================================== | ||||||
|  |  | ||||||
| set -o nounset                              # Treat unset variables as an error | set -o nounset # Treat unset variables as an error | ||||||
|  |  | ||||||
| #---  FUNCTION  ---------------------------------------------------------------- | #---  FUNCTION  ---------------------------------------------------------------- | ||||||
| #          NAME: is_module_installed  | #          NAME: is_module_installed | ||||||
| #   DESCRIPTION: Tests if the supplied module is found on the system  | #   DESCRIPTION: Tests if the supplied module is found on the system | ||||||
| #    PARAMETERS: Name of the denpendent Perl module | #    PARAMETERS: Name of the denpendent Perl module | ||||||
| #       RETURNS: 0 if not found, 1 if found | #       RETURNS: 0 if not found, 1 if found | ||||||
| #------------------------------------------------------------------------------- | #------------------------------------------------------------------------------- | ||||||
| function is_module_installed { | function is_module_installed { | ||||||
| 	HR="----------------------" |   HR="----------------------" | ||||||
| 	perl -e "use ${1} "  |   perl -e "use ${1} " | ||||||
| 	if  [ $? -ne 0 ] |   if [ $? -ne 0 ]; then | ||||||
| 	then |     echo ${HR} | ||||||
| 		echo ${HR} |   else | ||||||
| 	else |     echo "Found module ${1}" | ||||||
| 		echo "Found module ${1}" |     echo ${HR} | ||||||
| 		echo ${HR} |   fi | ||||||
| 	fi |  | ||||||
| } | } | ||||||
|  |  | ||||||
| MODULES=( \ | MODULES=( | ||||||
| 	 "Getopt::Long" \ |   "Getopt::Long" | ||||||
| 	 "Pod::Usage" \ |   "Pod::Usage" | ||||||
| 	 "Config::Std" \ |   "Config::Std" | ||||||
| 	 "Template" \ |   "Template" | ||||||
| 	 "Template::Plugin::File" \ |   "Template::Plugin::File" | ||||||
| 	 "Template::Plugin::DBI" \ |   "Template::Plugin::DBI" | ||||||
| 	 "Template::Plugin::HTML::Strip" \ |   "Template::Plugin::HTML::Strip" | ||||||
| 	 "DBI" \ |   "DBI" | ||||||
| 	 "Tie::DBI" \ |   "Tie::DBI" | ||||||
| 	 "DBD::SQLite" \ |   "DBD::SQLite" | ||||||
| 	 "DBD::mysql" \ |   "Date::Calc" | ||||||
| 	 "Date::Calc" \ |   "Text::CSV_XS" | ||||||
| 	 "Text::CSV_XS" \ |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| echo "The following modules must be installed for the site-generator to function: " | echo "The following modules must be installed for the site-generator to function: " | ||||||
| for module in "${MODULES[@]}" | for module in "${MODULES[@]}"; do | ||||||
| do |   echo "* ${module}" | ||||||
| 	echo "* ${module}" |  | ||||||
| done | done | ||||||
| echo "When MySQL is used, the DBD:mysql module is required (otherwise it is optional)" |  | ||||||
| echo "When SQLite is used, then the DBD:SQLite module is required (otherwise it is optional)" |  | ||||||
|  |  | ||||||
| echo "Scanning for modules ..." | echo "Scanning for modules ..." | ||||||
| echo "----------------------" | echo "----------------------" | ||||||
|  |  | ||||||
| for module in "${MODULES[@]}" | for module in "${MODULES[@]}"; do | ||||||
| do |   is_module_installed "${module}" | ||||||
| 	is_module_installed "${module}" |  | ||||||
| done | done | ||||||
|  |  | ||||||
| echo "Finished scanning." | echo "Finished scanning." | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user