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