diff options
author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2020-03-27 11:17:28 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2020-03-27 11:17:28 +0300 |
commit | 43ae816db67b30de2a73484b2e243d8490b47209 (patch) | |
tree | 1bee8338087f94c927c5497a1d626b0ace050906 | |
parent | ac4f64315805c88645b462fd66377155075abb44 (diff) |
kcollectd: add support for path argument
-rw-r--r-- | packages/sys-analyzer/kcollectd/files/add_path_argument.patch | 71 | ||||
-rw-r--r-- | packages/sys-analyzer/kcollectd/kcollectd.exlib | 1 |
2 files changed, 72 insertions, 0 deletions
diff --git a/packages/sys-analyzer/kcollectd/files/add_path_argument.patch b/packages/sys-analyzer/kcollectd/files/add_path_argument.patch new file mode 100644 index 0000000..b611d1e --- /dev/null +++ b/packages/sys-analyzer/kcollectd/files/add_path_argument.patch @@ -0,0 +1,71 @@ +diff --git a/kcollectd/gui.cc b/kcollectd/gui.cc +index a344f47..df3e442 100644 +--- a/kcollectd/gui.cc ++++ b/kcollectd/gui.cc +@@ -59,12 +59,14 @@ + + #include "drag_pixmap.xpm" + +-#ifndef RRD_BASEDIR ++/*#ifndef RRD_BASEDIR + #define RRD_BASEDIR "/var/lib/collectd/rrd" +-#endif ++#endif */ + + #define I18N_NOOP(text) text + ++extern QString rrd_path; ++ + static struct { + KStandardAction::StandardAction actionType; + const char *name; +@@ -372,7 +374,7 @@ KCollectdGui::KCollectdGui(QWidget *parent) + menuBar()->addMenu(helpMenu()); + + // build rrd-tree +- get_rrds(RRD_BASEDIR, listview()); ++ get_rrds(rrd_path.toUtf8().data(), listview()); + } + + KCollectdGui::~KCollectdGui() {} +diff --git a/kcollectd/kcollectd.cc b/kcollectd/kcollectd.cc +index cccd3df..1f3b439 100644 +--- a/kcollectd/kcollectd.cc ++++ b/kcollectd/kcollectd.cc +@@ -37,6 +37,8 @@ + + #include "gui.h" + ++QString rrd_path = ""; ++ + int main(int argc, char **argv) { + using namespace boost::filesystem; + +@@ -64,9 +66,18 @@ int main(int argc, char **argv) { + parser.addVersionOption(); + + parser.addPositionalArgument("+[file]", i18n("A kcollectd-file to open")); ++ parser.addPositionalArgument("path", i18n("rrd path")); + parser.process(application); + + const QStringList args = parser.positionalArguments(); ++ if (args.size() >= 2) ++ { ++ rrd_path = args.at(1); ++ } ++ else ++ { ++ rrd_path = "/var/lib/collectd/rrd"; ++ } + try { + if (application.isSessionRestored()) { + kRestoreMainWindows<KCollectdGui>(); +@@ -81,7 +92,7 @@ int main(int argc, char **argv) { + } catch (const std::exception &e) { + KMessageBox::error(0, i18n("Failed to read collectd-structure at \'%1\'\n" + "Terminating.", +- QString(RRD_BASEDIR))); ++ rrd_path)); + exit(1); + } + diff --git a/packages/sys-analyzer/kcollectd/kcollectd.exlib b/packages/sys-analyzer/kcollectd/kcollectd.exlib index 45d1e44..bbdc3f9 100644 --- a/packages/sys-analyzer/kcollectd/kcollectd.exlib +++ b/packages/sys-analyzer/kcollectd/kcollectd.exlib @@ -27,5 +27,6 @@ DEPENDENCIES=" DEFAULT_SRC_PREPARE_PATCHES=( "${FILES}"/gcc9-build-fix.patch + "${FILES}"/add_path_argument.patch ) |