hpr_generator/GETTING_STARTED.md

91 lines
3.0 KiB
Markdown

# Clone the repository
If git is not installed on the operating system, please install it now
(see the git documentation for [instructions on installing git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)).
To retrieve the code from the repository on anhonesthost.net, run:
`clone https://repo.anhonesthost.net/rho_n/hpr_generator.git`
To retrieve the code from the repository on gitlab.com, run:
`https://gitlab.com/roan.horning/hpr_generator.git`
On success, an "hpr_generator" directory will be created in the folder from
which the clone command was executed containing a local copy of the git repository.
# Install required Perl modules
Installing the Perl modules is the most finicky part of the installation process.
The needed Perl modules can be found using the operating systems's package
manager or using the modules found in the
[Comprehensive Perl Archive Network (CPAN)](https://www.cpan.org/).
## Installing modules on Debian based Linux distributions
Run command (tested on Debian 11):
```
apt install libconfig-std-perl \
libtemplate-perl \
libtemplate-plugin-dbi-perl \
libdbd-sqlite3-perl libdate-calc-perl \
libtie-dbi-perl
```
## Using CPAN to install the modules
A cross platform method to install the needed modules is Perl CPAN application.
Make sure both the [make](https://www.gnu.org/software/make/manual/make.html)
command and the [cpan](https://perldoc.perl.org/CPAN) command are available.
Install them using the operating system's package manager, or from source.
Run commands:
```
cpan Config::Std
cpan Template
cpan Template::Plugin::DBI
cpan DBD::SQLite
cpan Date::Calc
cpan Tie::DBI
```
# Create the HPR database
The hpr_generator relies on information from a database to generate many of the
files for the website (for example: index.html, series/index.html,
hpr_mp3.rss, etc). This data is available from a MySQL dump file found on
hackerpublicradio.org at "https://www.hackerpublicradio.org/hpr.sql".
The first step is to download the hpr.sql file. This can be done using your
browser, or by running one of the following commands:
`curl https://www.hackerpublicradio.org/hpr.sql --output ./hpr.sql`
or
`wget --directory-prefix=./ https://www.hackerpublicradio.org/hpr.sql`
## Creating an SQLite database file
The SQL of the hpr.sql file must be converted from MySQL specific statements to
SQLite specific statements. The mysql2sqlite script found in the utils directory
is used for this conversion. First remove the lines from hpr.sql that
mysql2sqlite can't handle:
`sed '/^DELIMITER ;;/,/^DELIMITER ;/d' < ./hpr.sql > ./hpr-sqlite.sql`
Next run the mysql2sqlite script piping its output into the sqlite3
program which creates the hpr.db file:
`./utils/mysql2sqlite ./hpr-sqlite.sql | sqlite3 ./hpr.db`
For convenience, the update-sqlite-db.sh script in the utils directory
automates the above steps (including downloading the hpr.sql file).
From the root of the local hpr_generator repository run:
`./utils/update-sqlite-db.sh`
# Run site-generator