mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-14 08:39:31 +02:00
2015-05-28 Fred Gleason <fredg@paravelsystems.com>
* Added rdcleandirs(8) utility in 'utils/rdcleandirs/'.
This commit is contained in:
parent
f50db561c6
commit
988fe7f1eb
@ -14868,4 +14868,5 @@
|
||||
* Incremented the package version to 2.10.3int02.
|
||||
2015-05-20 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added default parameters to the 'PadPoint' RLM in 'rlm_padpoint.c'.
|
||||
|
||||
2015-05-28 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added rdcleandirs(8) utility in 'utils/rdcleandirs/'.
|
||||
|
@ -442,6 +442,7 @@ AC_CONFIG_FILES([rivendell.spec \
|
||||
utils/rdalsaconfig/Makefile \
|
||||
utils/rdcheckcuts/Makefile \
|
||||
utils/rdchunk/Makefile \
|
||||
utils/rdcleandirs/Makefile \
|
||||
utils/rdcollect/Makefile \
|
||||
utils/rddbcheck/Makefile \
|
||||
utils/rddelete/Makefile \
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
|
||||
function StartDaemons {
|
||||
rdcleandirs
|
||||
if test $GPIO_START = yes ; then
|
||||
if test -x /etc/init.d/gpio ; then
|
||||
/etc/init.d/gpio status > /dev/null
|
||||
@ -101,6 +102,7 @@ function StopDaemons {
|
||||
fi
|
||||
fi
|
||||
sleep 2
|
||||
rdcleandirs
|
||||
}
|
||||
|
||||
# Set path for script functions
|
||||
|
@ -34,6 +34,7 @@ SUBDIRS = $(ALSACONFIG_RD_OPT)\
|
||||
rddgimport\
|
||||
rdcheckcuts\
|
||||
rdchunk\
|
||||
rdcleandirs\
|
||||
rdcollect\
|
||||
rddelete\
|
||||
rddiscimport\
|
||||
|
50
utils/rdcleandirs/Makefile.am
Normal file
50
utils/rdcleandirs/Makefile.am
Normal file
@ -0,0 +1,50 @@
|
||||
## automake.am
|
||||
##
|
||||
## Automake.am for rivendell/utils/rdcleandirs
|
||||
##
|
||||
## (C) Copyright 2015 Fred Gleason <fredg@paravelsystems.com>
|
||||
##
|
||||
## 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
|
||||
## published by the Free Software Foundation.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public
|
||||
## License along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
##
|
||||
## Use automake to process this into a Makefile.in
|
||||
|
||||
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -DQTDIR=\"@QT_DIR@\" @QT_CXXFLAGS@ -I$(top_srcdir)/lib
|
||||
LIBS = @QT_LIBS@ -L$(top_srcdir)/lib
|
||||
MOC = @QT_MOC@
|
||||
|
||||
# The dependency for qt's Meta Object Compiler (moc)
|
||||
moc_%.cpp: %.h
|
||||
$(MOC) $< -o $@
|
||||
|
||||
sbin_PROGRAMS = rdcleandirs
|
||||
|
||||
dist_rdcleandirs_SOURCES = rdcleandirs.cpp rdcleandirs.h
|
||||
|
||||
rdcleandirs_LDADD = @LIB_RDLIBS@ @LIBVORBIS@
|
||||
|
||||
CLEANFILES = *~\
|
||||
*.exe\
|
||||
*.idb\
|
||||
*ilk\
|
||||
*.obj\
|
||||
*.pdb\
|
||||
*.qm\
|
||||
moc_*
|
||||
|
||||
MAINTAINERCLEANFILES = *~\
|
||||
*.tar.gz\
|
||||
aclocal.m4\
|
||||
configure\
|
||||
Makefile.in\
|
||||
moc_*
|
89
utils/rdcleandirs/rdcleandirs.cpp
Normal file
89
utils/rdcleandirs/rdcleandirs.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
// rdcleandirs.cpp
|
||||
//
|
||||
// Remove stale lockfiles from user directories.
|
||||
//
|
||||
// (C) Copyright 2010 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// 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
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <pwd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qdir.h>
|
||||
#include <qfile.h>
|
||||
|
||||
#include <rdcmd_switch.h>
|
||||
#include <rdconf.h>
|
||||
|
||||
#include <rdcleandirs.h>
|
||||
|
||||
MainObject::MainObject(QObject *parent,const char *name)
|
||||
:QObject(parent,name)
|
||||
{
|
||||
struct passwd *pwd=NULL;
|
||||
|
||||
//
|
||||
// Read Command Options
|
||||
//
|
||||
RDCmdSwitch *cmd=
|
||||
new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdcleandirs",RDCLEANDIRS_USAGE);
|
||||
for(unsigned i=0;i<cmd->keys();i++) {
|
||||
}
|
||||
if(!cmd->allProcessed()) {
|
||||
fprintf(stderr,"rdcleandirs: unknown option\n");
|
||||
exit(256);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify that we have root permissions
|
||||
//
|
||||
if(getuid()!=0) {
|
||||
fprintf(stderr,"rdcleandirs: this program requires root permissions\n");
|
||||
exit(256);
|
||||
}
|
||||
|
||||
//
|
||||
// Iterate through the user database
|
||||
//
|
||||
while((pwd=getpwent())!=NULL) {
|
||||
QString user=QString(pwd->pw_name);
|
||||
QString base=RDGetBasePart(pwd->pw_shell);
|
||||
QString home=QString(pwd->pw_dir);
|
||||
if((user!="mysql")&&
|
||||
(base!="nologin")&&
|
||||
(base!="null")&&
|
||||
(base!="false")&&
|
||||
(base!="sync")&&
|
||||
(base!="shutdown")&&
|
||||
(base!="halt")&&
|
||||
(base!="reboot")) {
|
||||
QFile::remove(home+"/.rdairplaylock");
|
||||
}
|
||||
}
|
||||
endpwent();
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
QApplication a(argc,argv,false);
|
||||
new MainObject(NULL,"main");
|
||||
return a.exec();
|
||||
}
|
38
utils/rdcleandirs/rdcleandirs.h
Normal file
38
utils/rdcleandirs/rdcleandirs.h
Normal file
@ -0,0 +1,38 @@
|
||||
// rdcleandirs.h
|
||||
//
|
||||
// Remove stale lockfiles from user directories.
|
||||
//
|
||||
// (C) Copyright 2015 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// 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
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
|
||||
#ifndef RDCLEANDIRS_H
|
||||
#define RDCLEANDIRS_H
|
||||
|
||||
#include <qobject.h>
|
||||
|
||||
#define RDCLEANDIRS_USAGE "\n"
|
||||
|
||||
class MainObject : public QObject
|
||||
{
|
||||
public:
|
||||
MainObject(QObject *parent=0,const char *name=0);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
#endif // RDCLEANDIRS_H
|
Loading…
x
Reference in New Issue
Block a user