2023-01-16 Fred Gleason <fredg@paravelsystems.com>

* Added a check in rddbconfig(8) for the existence of a host entry
	for the local host, along with an offer to create such an entry if
	it does not exist.
	* Added an '--add-host-entry' option to rdadmin(1).
	* Added a rdadmin(1) man page.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2023-01-16 12:52:47 -05:00
parent 9f812cceb3
commit 0f07e7871e
7 changed files with 177 additions and 5 deletions

View File

@ -23908,3 +23908,9 @@
2023-01-09 Fred Gleason <fredg@paravelsystems.com> 2023-01-09 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rddbconfig(8) that made it impossible to specify * Fixed a bug in rddbconfig(8) that made it impossible to specify
a blank DB password. a blank DB password.
2023-01-16 Fred Gleason <fredg@paravelsystems.com>
* Added a check in rddbconfig(8) for the existence of a host entry
for the local host, along with an offer to create such an entry if
it does not exist.
* Added an '--add-host-entry' option to rdadmin(1).
* Added a rdadmin(1) man page.

View File

@ -2,7 +2,7 @@
## ##
## docs/manpages/automake.am for Rivendell ## docs/manpages/automake.am for Rivendell
## ##
## (C) Copyright 2015-2019 Fred Gleason <fredg@paravelsystems.com> ## (C) Copyright 2015-2023 Fred Gleason <fredg@paravelsystems.com>
## ##
## This program is free software; you can redistribute it and/or modify ## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License version 2 as ## it under the terms of the GNU General Public License version 2 as
@ -33,7 +33,8 @@
%.8: %.xml %.8: %.xml
xsltproc $(DOCBOOK_STYLESHEETS)/manpages/docbook.xsl $< xsltproc $(DOCBOOK_STYLESHEETS)/manpages/docbook.xsl $<
all-local: rdairplay.1\ all-local: rdadmin.1\
rdairplay.1\
rdalsaconfig.1\ rdalsaconfig.1\
rdclilogedit.1\ rdclilogedit.1\
rd.conf.5\ rd.conf.5\
@ -50,7 +51,8 @@ all-local: rdairplay.1\
rdsinglestart.1\ rdsinglestart.1\
rdsoftkeys.1 rdsoftkeys.1
man_MANS = rdairplay.1\ man_MANS = rdadmin.1\
rdairplay.1\
rdalsaconfig.1\ rdalsaconfig.1\
rdclilogedit.1\ rdclilogedit.1\
rd.conf.5\ rd.conf.5\
@ -68,6 +70,8 @@ man_MANS = rdairplay.1\
rdsoftkeys.1 rdsoftkeys.1
EXTRA_DIST = exitcodes.xml\ EXTRA_DIST = exitcodes.xml\
rdadmin.1\
rdadmin.xml\
rdairplay.1\ rdairplay.1\
rdairplay.xml\ rdairplay.xml\
rdalsaconfig.1\ rdalsaconfig.1\

83
docs/manpages/rdadmin.xml Normal file
View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<refentry id="stdin" xmlns="http://docbook.org/ns/docbook" version="5.0">
<!--
Header
-->
<refmeta>
<refentrytitle>rdadmin</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class='source'>January 2023</refmiscinfo>
<refmiscinfo class='manual'>Linux Audio Manual</refmiscinfo>
</refmeta>
<refnamediv>
<refname>rdadmin</refname>
<refpurpose>
Module for configuring the Rivendell Radio Automation System
</refpurpose>
</refnamediv>
<info>
<author>
<personname>
<firstname>Fred</firstname>
<surname>Gleason</surname>
<email>fredg@paravelsystems.com</email>
</personname>
<contrib>Application Author</contrib>
</author>
</info>
<!--
Body
-->
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
<command>rdadmin</command>
<arg choice='opt'>--add-host-entry</arg>
<sbr/>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id='description'><title>Description</title>
<para>
The <command>rdadmin</command><manvolnum>1</manvolnum> module is used
to manage the configuration of the Rivendell Radio Automation System.
When started with no arguments, it will prompt for the credentials of a
Rivendell user that has the
<userinput>Administer System</userinput> or
<userinput>Administer RSS Feeds</userinput> permissions.
If authentication of those credentials is successful, it will then
display the main <command>rdadmin</command><manvolnum>1</manvolnum>
button menu.
</para>
<para>
If invoked by a system user with an effective user id of
<userinput>0</userinput>
--i.e. &quot;root&quot; -- and the <userinput>--add-host-entry</userinput>
option is specified, <command>rdadmin</command><manvolnum>1</manvolnum>
will bypass the login process and prompt the user to create a new host
entry for the local system, following which it will exit.
</para>
<para>
For documentation of the GUI elements of
<command>rdadmin</command><manvolnum>1</manvolnum>, see the
<userinput>Rivendell Administration</userinput> section of the
<userinput>Rivendell Operations Guide</userinput>.
</para>
</refsect1>
<refsect1 id='see_also'><title>See Also</title>
<para>
<citerefentry>
<refentrytitle>rdalsaconfig</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>
<literal>, </literal>
<citerefentry>
<refentrytitle>rddbconfig</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>
</para>
</refsect1>
</refentry>

View File

@ -92,6 +92,12 @@ AddStation::AddStation(QString *stationname,QWidget *parent)
cancel_button->setText(tr("Cancel")); cancel_button->setText(tr("Cancel"));
connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
//
// Set Default Station Name
//
add_name_edit->setText(*stationname);
add_name_edit->setReadOnly(!stationname->isEmpty());
// //
// Fill Exemplar List // Fill Exemplar List
// //

View File

@ -34,6 +34,7 @@
#include <rddbheartbeat.h> #include <rddbheartbeat.h>
#include <rdescape_string.h> #include <rdescape_string.h>
#include "add_station.h"
#include "edit_system.h" #include "edit_system.h"
#include "globals.h" #include "globals.h"
#include "info_dialog.h" #include "info_dialog.h"
@ -71,7 +72,8 @@ MainWidget::MainWidget(RDConfig *config,RDWidget *parent)
QString str; QString str;
QString err_msg; QString err_msg;
RDApplication::ErrorType err_type=RDApplication::ErrorOk; RDApplication::ErrorType err_type=RDApplication::ErrorOk;
admin_add_host_entry=false;
// //
// Fix the Window Size // Fix the Window Size
// //
@ -88,6 +90,28 @@ MainWidget::MainWidget(RDConfig *config,RDWidget *parent)
exit(1); exit(1);
} }
} }
for(int i=0;i<rda->cmdSwitch()->keys();i++) {
if(rda->cmdSwitch()->key(i)=="--add-host-entry") {
if(geteuid()==0) {
admin_add_host_entry=true;
rda->cmdSwitch()->setProcessed(i,true);
}
else {
QMessageBox::critical(this,"RDAdmin - "+tr("Error"),
tr("The --add-host-entry option requires root permissions."));
exit(1);
}
}
if(!rda->cmdSwitch()->processed(i)) {
QMessageBox::critical(this,"RDAdmin - "+tr("Error"),
tr("Unrecognized option")+": "+
rda->cmdSwitch()->key(i)+" "+
rda->cmdSwitch()->value(i));
exit(1);
}
}
setWindowIcon(rda->iconEngine()->applicationIcon(RDIconEngine::RdAdmin,22)); setWindowIcon(rda->iconEngine()->applicationIcon(RDIconEngine::RdAdmin,22));
setWindowTitle(QString("RDAdmin v")+VERSION+" - "+ setWindowTitle(QString("RDAdmin v")+VERSION+" - "+
tr("Host")+": "+rda->config()->stationName()); tr("Host")+": "+rda->config()->stationName());
@ -218,6 +242,23 @@ MainWidget::MainWidget(RDConfig *config,RDWidget *parent)
// //
// Log In // Log In
// //
if(admin_add_host_entry) {
QString hostname=rda->config()->stationName();
AddStation *d=new AddStation(&hostname,this);
if(d->exec()) {
QMessageBox::information(this,"RDAdmin - "+tr("Debug"),
tr("Success!"));
}
else {
RDStation::remove(hostname);
QMessageBox::information(this,"RDAdmin - "+tr("Debug"),
tr("Aborted!"));
}
delete d;
exit(0);
}
Login *login=new Login(&admin_username,&admin_password,this); Login *login=new Login(&admin_username,&admin_password,this);
if(!login->exec()) { if(!login->exec()) {
exit(0); exit(0);

View File

@ -60,6 +60,7 @@ class MainWidget : public RDMainWindow
QString admin_filter; QString admin_filter;
QString admin_group; QString admin_group;
QString admin_schedcode; QString admin_schedcode;
bool admin_add_host_entry;
}; };

View File

@ -32,6 +32,7 @@
#include <rdapplication.h> #include <rdapplication.h>
#include <rdconf.h> #include <rdconf.h>
#include <rdconfig.h> #include <rdconfig.h>
#include <rdescape_string.h>
#include <rdpaths.h> #include <rdpaths.h>
#include "../../icons/rivendell-22x22.xpm" #include "../../icons/rivendell-22x22.xpm"
@ -170,7 +171,7 @@ void MainWidget::mismatchData()
return; return;
} }
if (QMessageBox::question(this,tr("Database Mismatch"),QString::asprintf("Your database is version %d. Your Rivendell %s installation requires version %d. Would you like to modify your database to the current version?",db->schema(),VERSION,RD_VERSION_DATABASE),(QMessageBox::No|QMessageBox::Yes)) != QMessageBox::Yes) { if (QMessageBox::question(this,tr("Database Mismatch"),QString::asprintf("Your database is version %d. Your Rivendell %s installation requires version %d. Would you like to modify your database to this version?",db->schema(),VERSION,RD_VERSION_DATABASE),(QMessageBox::No|QMessageBox::Yes)) != QMessageBox::Yes) {
return; return;
} }
@ -373,8 +374,38 @@ void MainWidget::restoreData()
RDApplication::syslog(rd_config,LOG_INFO,"restored %s database from %s", RDApplication::syslog(rd_config,LOG_INFO,"restored %s database from %s",
rd_config->mysqlDbname().toUtf8().constData(), rd_config->mysqlDbname().toUtf8().constData(),
filename.toUtf8().constData()); filename.toUtf8().constData());
} }
emit updateLabels(); emit updateLabels();
//
// Check for local host entry
//
int schema=0;
QString err_msg;
if(RDOpenDb(&schema,&err_msg,rd_config)&&(schema==RD_VERSION_DATABASE)) {
QString sql=QString("select ")+
"`NAME` "+ // 00
"from `STATIONS` where "+
"`NAME`='"+RDEscapeString(rd_config->stationName())+"'";
RDSqlQuery *q=new RDSqlQuery(sql);
if(!q->first()) {
if(QMessageBox::question(this,"RDDbConfig - "+
tr("Missing Host Entry"),
tr("This database is missing a host entry for the local system")+" [\""+rd_config->stationName()+"\"].\n"+
tr("Create one?"),
QMessageBox::Yes,QMessageBox::No)==
QMessageBox::Yes) {
QStringList args;
args.push_back("--add-host-entry");
QProcess *proc=new QProcess(this);
proc->start("/usr/bin/rdadmin",args);
proc->waitForFinished(-1);
}
}
delete q;
}
startDaemons(); startDaemons();
} }
} }