mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-11 09:03:40 +02:00
2018-10-24 Fred Gleason <fredg@paravelsystems.com>
* Consolidated the implementation of the 'RDProfile' class into two files. * Added an rdselect_helper(1) SETUID helper program. * Removed the SETUID bit from rdselect(1).
This commit is contained in:
@@ -30,7 +30,6 @@ moc_%.cpp: %.h
|
||||
install-exec-hook:
|
||||
mkdir -p $(DESTDIR)$(prefix)/share/rivendell
|
||||
cp rdselect_*.qm $(DESTDIR)$(prefix)/share/rivendell
|
||||
chmod 4755 $(DESTDIR)$(prefix)/bin/rdselect
|
||||
|
||||
uninstall-local:
|
||||
rm -f $(DESTDIR)$(prefix)/share/rivendell/rdselect_*.qm
|
||||
|
@@ -26,22 +26,24 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qwindowsstyle.h>
|
||||
#include <qpainter.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qdesktopwidget.h>
|
||||
#include <qdir.h>
|
||||
#include <qlabel.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qpainter.h>
|
||||
#include <qprocess.h>
|
||||
#include <qtextcodec.h>
|
||||
#include <qtranslator.h>
|
||||
#include <qdir.h>
|
||||
#include <qdesktopwidget.h>
|
||||
#include <qwindowsstyle.h>
|
||||
|
||||
#include <rd.h>
|
||||
#include <rdconf.h>
|
||||
#include <rdcmd_switch.h>
|
||||
#include <rdpaths.h>
|
||||
#include <rdstatus.h>
|
||||
#include <dbversion.h>
|
||||
|
||||
#include <rdselect.h>
|
||||
#include "rdselect.h"
|
||||
|
||||
//
|
||||
// Icons
|
||||
@@ -195,13 +197,14 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
//
|
||||
// Check for Root User
|
||||
//
|
||||
|
||||
/*
|
||||
setuid(geteuid()); // So the SETUID bit works as expected
|
||||
if(getuid()!=0) {
|
||||
QMessageBox::information(this,tr("RDSelect"),
|
||||
tr("Only root can run this utility!"));
|
||||
exit(256);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -225,28 +228,30 @@ void MainWidget::doubleClickedData(Q3ListBoxItem *item)
|
||||
|
||||
void MainWidget::okData()
|
||||
{
|
||||
if(RDModulesActive()) {
|
||||
QMessageBox::information(this,tr("RDSelect"),
|
||||
tr("One or more Rivendell modules are still open."));
|
||||
return;
|
||||
}
|
||||
QStringList args;
|
||||
QProcess *proc=NULL;
|
||||
|
||||
if(!VerifyShutdown()) {
|
||||
QStringList f0=select_configs[select_box->currentItem()]->filename().
|
||||
split("/",QString::SkipEmptyParts);
|
||||
args.push_back(f0.last());
|
||||
proc=new QProcess(this);
|
||||
proc->start(QString(RD_PREFIX)+"/bin/rdselect_helper",args);
|
||||
proc->waitForFinished();
|
||||
if(proc->exitStatus()!=QProcess::NormalExit) {
|
||||
QMessageBox::critical(this,"RDSelect - "+tr("Error"),
|
||||
tr("RDSelect helper process crashed!"));
|
||||
delete proc;
|
||||
return;
|
||||
}
|
||||
if(!Shutdown(select_current_id)) {
|
||||
SetSystem(-1);
|
||||
QMessageBox::warning(this,tr("RDSelect"),
|
||||
tr("Unable to shutdown current configuration")+
|
||||
"\n["+QString(strerror(errno))+"].");
|
||||
if(proc->exitCode()!=0) {
|
||||
QMessageBox::critical(this,"RDSelect - "+tr("Error"),
|
||||
tr("Unable to select configuration:")+"\n"+
|
||||
RDConfig::rdselectExitCodeText((RDConfig::RDSelectExitCode)proc->exitCode()));
|
||||
delete proc;
|
||||
return;
|
||||
}
|
||||
if(!Startup(select_box->currentItem())) {
|
||||
SetSystem(-1);
|
||||
QMessageBox::warning(this,tr("RDSelect"),
|
||||
tr("Unable to start up new configuration"));
|
||||
}
|
||||
SetSystem(select_box->currentItem());
|
||||
delete proc;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -267,47 +272,6 @@ void MainWidget::resizeEvent(QResizeEvent *e)
|
||||
}
|
||||
|
||||
|
||||
bool MainWidget::Shutdown(int id)
|
||||
{
|
||||
RDConfig *conf=select_configs[id];
|
||||
|
||||
if(system("systemctl stop rivendell")!=0) {
|
||||
return false;
|
||||
}
|
||||
system(QString("umount ")+conf->audioRoot());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool MainWidget::Startup(int id)
|
||||
{
|
||||
RDConfig *conf=select_configs[id];
|
||||
|
||||
if(!conf->audioStoreMountSource().isEmpty()) {
|
||||
QString cmd=QString("mount");
|
||||
if(!conf->audioStoreMountType().isEmpty()) {
|
||||
cmd+=" -t "+conf->audioStoreMountType();
|
||||
}
|
||||
if(!conf->audioStoreMountOptions().isEmpty()) {
|
||||
cmd+=" -o "+conf->audioStoreMountOptions();
|
||||
}
|
||||
cmd+=" "+conf->audioStoreMountSource()+" "+
|
||||
conf->audioRoot();
|
||||
if(system(cmd)!=0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
unlink(RD_CONF_FILE);
|
||||
symlink(select_filenames[id],RD_CONF_FILE);
|
||||
if(system("systemctl start rivendell")!=0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::SetSystem(int id)
|
||||
{
|
||||
QString text=tr("None");
|
||||
@@ -319,12 +283,6 @@ void MainWidget::SetSystem(int id)
|
||||
}
|
||||
|
||||
|
||||
bool MainWidget::VerifyShutdown() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::SetCurrentItem(int id)
|
||||
{
|
||||
QPixmap *pix=redx_map;
|
||||
|
@@ -52,10 +52,7 @@ class MainWidget : public QWidget
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
private:
|
||||
bool Shutdown(int id);
|
||||
bool Startup(int id);
|
||||
void SetSystem(int id);
|
||||
bool VerifyShutdown() const;
|
||||
void SetCurrentItem(int id);
|
||||
std::vector<RDConfig *> select_configs;
|
||||
QStringList select_filenames;
|
||||
|
@@ -9,7 +9,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>RDSelect</source>
|
||||
<translation>RDSelect</translation>
|
||||
<translation type="obsolete">RDSelect</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>None</source>
|
||||
@@ -29,19 +29,31 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>Only root can run this utility!</source>
|
||||
<translation>Pouze superuživatel (root) může spouštět tento program!</translation>
|
||||
<translation type="obsolete">Pouze superuživatel (root) může spouštět tento program!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to shutdown current configuration</source>
|
||||
<translation>Nelze vypnout nynější nastavení</translation>
|
||||
<translation type="obsolete">Nelze vypnout nynější nastavení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to start up new configuration</source>
|
||||
<translation>Nelze spustit nové nastavení</translation>
|
||||
<translation type="obsolete">Nelze spustit nové nastavení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>One or more Rivendell modules are still open.</source>
|
||||
<translation>Jeden nebo více modulů Rivendell je stále ještě otevřeno.</translation>
|
||||
<translation type="obsolete">Jeden nebo více modulů Rivendell je stále ještě otevřeno.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDSelect helper process crashed!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to select configuration:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@@ -7,10 +7,6 @@
|
||||
<source>&Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDSelect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>None</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@@ -28,19 +24,15 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Only root can run this utility!</source>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to shutdown current configuration</source>
|
||||
<source>RDSelect helper process crashed!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to start up new configuration</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>One or more Rivendell modules are still open.</source>
|
||||
<source>Unable to select configuration:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@@ -7,10 +7,6 @@
|
||||
<source>&Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDSelect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>None</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@@ -28,19 +24,15 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Only root can run this utility!</source>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to shutdown current configuration</source>
|
||||
<source>RDSelect helper process crashed!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to start up new configuration</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>One or more Rivendell modules are still open.</source>
|
||||
<source>Unable to select configuration:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@@ -7,10 +7,6 @@
|
||||
<source>&Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDSelect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>None</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@@ -28,19 +24,15 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Only root can run this utility!</source>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to shutdown current configuration</source>
|
||||
<source>RDSelect helper process crashed!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to start up new configuration</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>One or more Rivendell modules are still open.</source>
|
||||
<source>Unable to select configuration:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@@ -7,10 +7,6 @@
|
||||
<source>&Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDSelect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>None</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@@ -28,19 +24,15 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Only root can run this utility!</source>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to shutdown current configuration</source>
|
||||
<source>RDSelect helper process crashed!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to start up new configuration</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>One or more Rivendell modules are still open.</source>
|
||||
<source>Unable to select configuration:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@@ -7,10 +7,6 @@
|
||||
<source>&Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDSelect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>None</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@@ -28,19 +24,15 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Only root can run this utility!</source>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to shutdown current configuration</source>
|
||||
<source>RDSelect helper process crashed!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to start up new configuration</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>One or more Rivendell modules are still open.</source>
|
||||
<source>Unable to select configuration:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@@ -7,10 +7,6 @@
|
||||
<source>&Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>RDSelect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>None</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@@ -28,19 +24,15 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Only root can run this utility!</source>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to shutdown current configuration</source>
|
||||
<source>RDSelect helper process crashed!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to start up new configuration</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>One or more Rivendell modules are still open.</source>
|
||||
<source>Unable to select configuration:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
Reference in New Issue
Block a user