From 9b6bf3e194cdab67d010235c470e705477f34604 Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Sun, 18 May 2025 13:33:49 +0200 Subject: [PATCH] Move database creation to bin/dbcreate.pl. Remove install/* Signed-off-by: Thomas Hochstein --- install/install.pl => bin/dbcreate.pl | 17 +++++++++-------- doc/ChangeLog | 1 + doc/INSTALL | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) rename install/install.pl => bin/dbcreate.pl (95%) diff --git a/install/install.pl b/bin/dbcreate.pl similarity index 95% rename from install/install.pl rename to bin/dbcreate.pl index deaa43a..ea0fd6c 100755 --- a/install/install.pl +++ b/bin/dbcreate.pl @@ -1,6 +1,6 @@ #! /usr/bin/perl # -# install.pl +# dbcreate.pl # # This script will create database tables as necessary. # @@ -13,7 +13,7 @@ BEGIN { use File::Basename; - # we're in .../install, so our module is in ../lib + # we're in .../bin, so our module is in ../lib push(@INC, dirname($0).'/../lib'); } use strict; @@ -231,7 +231,7 @@ sub CreateTable { }; my $DBQuery = $DBHandle->prepare($DBCreate{$Table}); $DBQuery->execute() or - &Bleat(2, sprintf("Can't create table %s in database %s: %s%\n",$Table, + &Bleat(2, sprintf("Can't create table %s in database %s: %s\n",$Table, $Conf{'DBDatabase'},$DBI::errstr)); printf("Database table %s.%s created succesfully.\n", $Conf{'DBDatabase'},$Conf{$Table}); @@ -261,11 +261,11 @@ __END__ =head1 NAME -install - installation script +dbcreate - database creation script =head1 SYNOPSIS -B [B<-Vh> [--update I] [B<--conffile> I] +B [B<-Vh> [--update I] [B<--conffile> I] =head1 REQUIREMENTS @@ -273,11 +273,12 @@ See L. =head1 DESCRIPTION -This script will create database tables as necessary and configured. +This script will create a database and database tables as necessary +and configured. =head2 Configuration -B will read its configuration from F which should +B will read its configuration from F which should be present in etc/ via Config::Auto or from a configuration file submitted by the B<--conffile> option. @@ -309,7 +310,7 @@ Load configuration from I instead of F. =over 4 -=item F +=item F The script itself. diff --git a/doc/ChangeLog b/doc/ChangeLog index 7743223..3cced70 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -20,6 +20,7 @@ NewsStats 0.3.0 (unreleased) Change caption handling, update documentation accordingly. * Fix call to GetMaxLength() in cliservstats. * Fix typos in documentation, update sample config file. + * Move database creation from install/install.pl to bin/dbcreate.pl NewsStats 0.2.0 (2025-05-10) * Redo directory structure: diff --git a/doc/INSTALL b/doc/INSTALL index 6eb1453..2ef057e 100644 --- a/doc/INSTALL +++ b/doc/INSTALL @@ -70,9 +70,9 @@ INSTALLATION INSTRUCTIONS * Setup your database server with a username, password and database matching the NewsStats configuration (see 2 a). - * Start the installation script: + * Start the database creation script: - # install/install.pl + # bin/dbcreate.pl It will setup the necessary database tables and display some information on the next steps.