Compare commits
No commits in common. "06601c5d20ea25c4fbd60abbea455222ef89da2d" and "b17daba4ed4c0389dc706fcc2ab71cceb79212bd" have entirely different histories.
06601c5d20
...
b17daba4ed
@ -41,9 +41,8 @@ apt install libconfig-std-perl \
|
|||||||
## Using CPAN to install the modules
|
## Using CPAN to install the modules
|
||||||
|
|
||||||
A cross platform method to install the needed modules is the Perl CPAN application.
|
A cross platform method to install the needed modules is the Perl CPAN application.
|
||||||
Make sure that the [gcc](https://www.gnu.org/software/gcc/),
|
Make sure both the [make](https://www.gnu.org/software/make/manual/make.html)
|
||||||
[make](https://www.gnu.org/software/make/manual/make.html),
|
command and the [cpan](https://perldoc.perl.org/CPAN) command are available.
|
||||||
and [cpan](https://perldoc.perl.org/CPAN) commands are available.
|
|
||||||
Install them using the operating system's package manager, or from source.
|
Install them using the operating system's package manager, or from source.
|
||||||
|
|
||||||
Run commands:
|
Run commands:
|
||||||
@ -52,21 +51,9 @@ Run commands:
|
|||||||
cpan Config::Std
|
cpan Config::Std
|
||||||
cpan Template
|
cpan Template
|
||||||
cpan Template::Plugin::DBI
|
cpan Template::Plugin::DBI
|
||||||
cpan Template::Plugin::HTML::Strip
|
|
||||||
cpan DBD::SQLite
|
cpan DBD::SQLite
|
||||||
cpan Date::Calc
|
cpan Date::Calc
|
||||||
cpan Tie::DBI
|
cpan Tie::DBI
|
||||||
cpan Text:CSV_XS
|
|
||||||
```
|
|
||||||
|
|
||||||
## Testing for Perl module dependencies
|
|
||||||
|
|
||||||
A bash script is included in the utils directory that will list the Perl modules used by the site-generator and report whether the modules are installed on the current OS.
|
|
||||||
|
|
||||||
It can be run from any directory. To run from the utils directory:
|
|
||||||
|
|
||||||
```
|
|
||||||
./check-dependencies.sh
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# Create the HPR database
|
# Create the HPR database
|
||||||
|
@ -25,7 +25,7 @@ Static web page generator for the Hacker Public Radio website.
|
|||||||
- ``GRANT SELECT ON hpr_hpr.* TO 'hpr-generator'@'localhost';``
|
- ``GRANT SELECT ON hpr_hpr.* TO 'hpr-generator'@'localhost';``
|
||||||
- ``GRANT EXECUTE ON `hpr_hpr`.* TO 'hpr-generator'@'localhost';``
|
- ``GRANT EXECUTE ON `hpr_hpr`.* TO 'hpr-generator'@'localhost';``
|
||||||
* Install the needed Perl modules using preferred method (distribution packages, CPAN, etc.)
|
* Install the needed Perl modules using preferred method (distribution packages, CPAN, etc.)
|
||||||
* Getopt::Long
|
* GetOpt
|
||||||
* Pod::Usage
|
* Pod::Usage
|
||||||
* Config::Std
|
* Config::Std
|
||||||
* Template
|
* Template
|
||||||
@ -35,7 +35,7 @@ Static web page generator for the Hacker Public Radio website.
|
|||||||
* Template::Plugin::HTML::Strip
|
* Template::Plugin::HTML::Strip
|
||||||
* DBI
|
* DBI
|
||||||
* Tie::DBI
|
* Tie::DBI
|
||||||
* DBD::SQLite or DBD::mysql
|
* DBD::SQLite or DBD:mysql
|
||||||
* Date::Calc
|
* Date::Calc
|
||||||
* Text::CSV_XS
|
* Text::CSV_XS
|
||||||
* HTML::Entities
|
* HTML::Entities
|
||||||
|
@ -122,6 +122,7 @@ use Text::CSV_XS;
|
|||||||
use HTML::Entities qw(encode_entities);
|
use HTML::Entities qw(encode_entities);
|
||||||
use Date::Calc;
|
use Date::Calc;
|
||||||
use DBI;
|
use DBI;
|
||||||
|
use DBD::SQLite;
|
||||||
use Tie::DBI;
|
use Tie::DBI;
|
||||||
use Template;
|
use Template;
|
||||||
use Template::Plugin::Date;
|
use Template::Plugin::Date;
|
||||||
|
@ -3,10 +3,15 @@
|
|||||||
<!--% PROCESS 'shared-utils.tpl.html' %-->
|
<!--% PROCESS 'shared-utils.tpl.html' %-->
|
||||||
<!--% PROCESS "queries-correspondent-${constants.database}.tpl.html" %-->
|
<!--% PROCESS "queries-correspondent-${constants.database}.tpl.html" %-->
|
||||||
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
|
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
|
||||||
|
<!--% query_hpr_show_count = DBI.prepare('
|
||||||
|
SELECT id
|
||||||
|
FROM eps
|
||||||
|
WHERE eps.hostid = ?
|
||||||
|
')
|
||||||
|
%-->
|
||||||
<!--% results_hpr_shows = DBI.prepare(query_hpr_shows)
|
<!--% results_hpr_shows = DBI.prepare(query_hpr_shows)
|
||||||
%-->
|
%-->
|
||||||
<!--% results_hpr_show_count = DBI.prepare(query_hpr_show_count) %-->
|
<!--% hpr_shows_to_count = query_hpr_show_count.execute(id); %-->
|
||||||
<!--% hpr_shows_to_count = results_hpr_show_count.execute(id); %-->
|
|
||||||
<!--% hpr_shows = results_hpr_shows.execute(id); %-->
|
<!--% hpr_shows = results_hpr_shows.execute(id); %-->
|
||||||
<!--% hpr_show_count = 0 %-->
|
<!--% hpr_show_count = 0 %-->
|
||||||
<!--% FOREACH show IN hpr_shows_to_count %-->
|
<!--% FOREACH show IN hpr_shows_to_count %-->
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--% query_hpr_shows = '
|
<!--% query_hpr_shows = '
|
||||||
SELECT
|
SELECT
|
||||||
eps.id,
|
eps.id,
|
||||||
eps.explicit,
|
eps.explicit,
|
||||||
eps.date, eps.license, eps.duration,
|
eps.date, eps.license, eps.duration,
|
||||||
@ -16,9 +16,3 @@
|
|||||||
ORDER BY eps.id DESC
|
ORDER BY eps.id DESC
|
||||||
'
|
'
|
||||||
%-->
|
%-->
|
||||||
<!--% query_hpr_show_count = '
|
|
||||||
SELECT id
|
|
||||||
FROM eps
|
|
||||||
WHERE eps.hostid = ? AND eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY)
|
|
||||||
'
|
|
||||||
%-->
|
|
||||||
|
@ -16,9 +16,3 @@
|
|||||||
ORDER BY eps.id + 0 DESC
|
ORDER BY eps.id + 0 DESC
|
||||||
'
|
'
|
||||||
%-->
|
%-->
|
||||||
<!--% query_hpr_show_count = '
|
|
||||||
SELECT id
|
|
||||||
FROM eps
|
|
||||||
WHERE eps.hostid = ? AND eps.date < date(\'now\', \'+1 days\')
|
|
||||||
'
|
|
||||||
%-->
|
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
#!/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" \
|
|
||||||
"DBD::mysql" \
|
|
||||||
"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 "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 "----------------------"
|
|
||||||
|
|
||||||
for module in "${MODULES[@]}"
|
|
||||||
do
|
|
||||||
is_module_installed "${module}"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Finished scanning."
|
|
Loading…
Reference in New Issue
Block a user