From 7c254544ca5cbd5118fa3c6a0091066cbc5e00d2 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Mon, 21 May 2018 12:09:13 +0200 Subject: [PATCH] Remove kiwix-install tool. Fix #189 --- src/installer/kiwix-install.cpp | 173 -------------------------------- src/installer/meson.build | 4 - src/man/fr/kiwix-install.1 | 40 -------- src/man/fr/kiwix.1 | 52 ---------- src/man/fr/meson.build | 5 +- src/man/kiwix-install.1 | 40 -------- src/man/meson.build | 3 +- src/meson.build | 1 - 8 files changed, 3 insertions(+), 315 deletions(-) delete mode 100644 src/installer/kiwix-install.cpp delete mode 100644 src/installer/meson.build delete mode 100644 src/man/fr/kiwix-install.1 delete mode 100644 src/man/fr/kiwix.1 delete mode 100644 src/man/kiwix-install.1 diff --git a/src/installer/kiwix-install.cpp b/src/installer/kiwix-install.cpp deleted file mode 100644 index b0b98ea..0000000 --- a/src/installer/kiwix-install.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright 2011-2014 Emmanuel Engelhart - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * any later version. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -#include -#include -#include -#include - -enum supportedAction { NONE, ADDCONTENT }; - -void usage() -{ - cout << "Usage: kiwix-install [--verbose] addcontent ZIM_PATH KIWIX_PATH" - << endl; - exit(1); -} - -int main(int argc, char** argv) -{ - /* Init the variables */ - const char* contentPath = NULL; - const char* kiwixPath = NULL; - supportedAction action = NONE; - bool verboseFlag = false; - int option_index = 0; - int c = 0; - - /* Argument parsing */ - while (42) { - static struct option long_options[] - = {{"verbose", no_argument, 0, 'v'}, {0, 0, 0, 0}}; - - if (c != -1) { - c = getopt_long(argc, argv, "vi", long_options, &option_index); - - switch (c) { - case 'v': - verboseFlag = true; - break; - } - } else { - if (optind < argc) { - if (action == NONE) { - string actionString = argv[optind++]; - if (actionString == "addcontent" || actionString == "ADDCONTENT") { - action = ADDCONTENT; - } - } else if (contentPath == NULL) { - contentPath = argv[optind++]; - } else if (kiwixPath == NULL) { - kiwixPath = argv[optind++]; - } else { - usage(); - } - } else { - break; - } - } - } - - /* Check if we have enough arguments */ - if (contentPath == NULL || kiwixPath == NULL) { - usage(); - } - - /* Make the action */ - if (action == ADDCONTENT) { - /* Check if the content path exists and is readable */ - if (verboseFlag) { - std::cout << "Check if the ZIM file exists..." << std::endl; - } - if (!fileExists(contentPath)) { - cerr << "The content path '" << contentPath - << "' does not exist or is not readable." << endl; - exit(1); - } - - /* Check if this is a ZIM file */ - try { - if (verboseFlag) { - std::cout << "Check if the ZIM file is valid..." << std::endl; - } - kiwix::Reader* reader = new kiwix::Reader(contentPath); - delete reader; - } catch (exception& e) { - cerr << "The content available at '" << contentPath - << "' is not a ZIM file." << endl; - exit(1); - } - string contentFilename = getLastPathElement(contentPath); - - /* Check if kiwixPath/kiwix/kiwix.exe exists */ - if (verboseFlag) { - std::cout << "Check if the Kiwix path is valid..." << std::endl; - } - string kiwixBinaryPath = computeAbsolutePath(kiwixPath, "kiwix/kiwix.exe"); - if (!fileExists(kiwixBinaryPath)) { - kiwixBinaryPath = computeAbsolutePath(kiwixPath, "kiwix/kiwix"); - if (!fileExists(kiwixBinaryPath)) { - cerr << "Unable to find the Kiwix binary at '" << kiwixBinaryPath - << "[.exe]'." << endl; - exit(1); - } - } - - /* Check if the directory "data" structure exists */ - if (verboseFlag) { - std::cout << "Check the target data directory structure..." << std::endl; - } - string dataPath = computeAbsolutePath(kiwixPath, "data/"); - if (!fileExists(dataPath)) { - makeDirectory(dataPath); - } - - /* Check if the directory "data/content" structure exists */ - string dataContentPath = computeAbsolutePath(kiwixPath, "data/content/"); - if (!fileExists(dataContentPath)) { - makeDirectory(dataContentPath); - } - - /* Check if the directory "data/library" structure exists */ - string dataLibraryPath = computeAbsolutePath(kiwixPath, "data/library/"); - if (!fileExists(dataLibraryPath)) { - makeDirectory(dataLibraryPath); - } - - /* Copy the file to the data/content directory */ - if (verboseFlag) { - std::cout << "Copy ZIM file to the target directory..." << std::endl; - } - string newContentPath - = computeAbsolutePath(dataContentPath, contentFilename); - if (!fileExists(newContentPath) - || getFileSize(contentPath) != getFileSize(newContentPath)) { - copyFile(contentPath, newContentPath); - } - - /* Add the file to the library.xml */ - if (verboseFlag) { - std::cout << "Create the library XML file..." << std::endl; - } - kiwix::Manager libraryManager; - string libraryPath - = computeAbsolutePath(dataLibraryPath, contentFilename + ".xml"); - string bookId = libraryManager.addBookFromPathAndGetId( - newContentPath, "../content/" + contentFilename, "", false); - if (!bookId.empty()) { - libraryManager.setCurrentBookId(bookId); - libraryManager.writeFile(libraryPath); - } else { - cerr << "Unable to build or save library file '" << libraryPath << "'" - << endl; - } - } - - exit(0); -} diff --git a/src/installer/meson.build b/src/installer/meson.build deleted file mode 100644 index 73c4961..0000000 --- a/src/installer/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -executable('kiwix-install', ['kiwix-install.cpp'], - dependencies:all_deps, - install:true, - install_rpath: join_paths(get_option('prefix'), get_option('libdir'))) diff --git a/src/man/fr/kiwix-install.1 b/src/man/fr/kiwix-install.1 deleted file mode 100644 index ae3a4c4..0000000 --- a/src/man/fr/kiwix-install.1 +++ /dev/null @@ -1,40 +0,0 @@ -.TH KIWIX 1 "21 May 2012" -.SH NAME -kiwix\-install \- Installeur de fichiers ZIM -.SH SYNOPSIS -.IX Header SYNOPSIS -kiwix\-install [\-\-verbose|-v] [\-\-backend|\-b=xapian|clucene] [\-\-buildIndex|\-i] addcontent ZIM_PATH KIWIX_PATH -.SH DESCRIPTION -.PP -Créé une arborescence contenant Kiwix et des données pour redistribution. -.br -Si demandé, créé aussi un index plein texte. - -.TP -\fB\-\-verbose\fR -Active le mode verbeux de la sortie. - -.TP -\fB\-\-backend=xapian|clucene\fR -Séléctionne un moteur d'indexation. - -.TP -\fB\-\-buildIndex\fR -Créer un index plein texte pour le fichier ZIM. - -.TP -\fBZIM_PATH\fR -Chemin du fichier de contenu ZIM. - -.TP -\fBKIWIX_PATH\fR -Chemin d'accès dossier kiwix/. -.br -Le chemin doit contenit le binaire statique de Kiwix. - -.SH SEE ALSO -kiwix(1) kiwix\-serve(1) kiwix\-manage(1) -.SH AUTHOR -Emmanuel Engelhart -.br -Vasudev Kamath (Manual) diff --git a/src/man/fr/kiwix.1 b/src/man/fr/kiwix.1 deleted file mode 100644 index 3166c9b..0000000 --- a/src/man/fr/kiwix.1 +++ /dev/null @@ -1,52 +0,0 @@ -.TH KIWIX 1 "12 juin 2012" -.SH NAME -Kiwix \- Lecteur hors-ligne de fichiers ZIM -.SH SYNOPSIS -.B kiwix [-jsconsole] [-articleByUrl] [-articleByTitle] [FILE] -.SH DESCRIPTION -.PP -Kiwix est un lecteur de content au format ZIM. -.br -Les fichiers ZIM sont des archives de contenus compressés (généralement HTML) -.br -Les fichiers ZIM les plus populaires sont ceux de Wikipédia et Wikileaks. - -.TP -\fB\-jsconsole\fR -Active la console de debogage JavaScript de Xulrunner. -\fB\-articleByUrl url\fR -Ouvre un article en particulier en renseignant son url. FILE doit être donné. -.TP -\fB\-articleByTitle title\fR -Ouvre un article en particulier en renseignant son titre. FILE doit être donné. - -.PP -Fonctionnalités: - * Lecteur de ZIM natif - * Moteur de recherche plein texte - * Signets et Notes - * Serveur Web pour diffuser les fichiers ZIM sur le réseau - * Export HTML et PDF - * Traduits dans de nombreuses langues - * Suggestions de recherche - * Indexation des fichiers ZIM - * Onglets de navigation - * Bibliothèque de contenus intégrée - -.SH SEE ALSO -kiwix\-install(1) kiwix\-serve(1) -.br -kiwix\-manage(1) - - -.SH TROUBLESHOOTING -Aller à http://reportabug.kiwix.org pour plus de détails sur comment rapporter un bogue. - -.SH AUTHORS - Emmanuel Engelhart - Guillaume Duhamel - Fabien Coullon - Renaud Gaudin - Wilfredo Rodriguez -.br - Vasudev Kamath (Manual) diff --git a/src/man/fr/meson.build b/src/man/fr/meson.build index 2f32357..efbde20 100644 --- a/src/man/fr/meson.build +++ b/src/man/fr/meson.build @@ -1,4 +1,3 @@ -install_man('kiwix-install.1', - 'kiwix-manage.1', +install_man('kiwix-manage.1', 'kiwix-serve.1', - install_dir:get_option('mandir')+'/fr/man1') \ No newline at end of file + install_dir:get_option('mandir')+'/fr/man1') diff --git a/src/man/kiwix-install.1 b/src/man/kiwix-install.1 deleted file mode 100644 index 5ba07ad..0000000 --- a/src/man/kiwix-install.1 +++ /dev/null @@ -1,40 +0,0 @@ -.TH KIWIX 1 "21 May 2012" -.SH NAME -kiwix\-install \- Kiwix ZIM Installer -.SH SYNOPSIS -.IX Header SYNOPSIS -kiwix\-install [\-\-verbose|-v] [\-\-backend|\-b=xapian|clucene] [\-\-buildIndex|\-i] addcontent ZIM_PATH KIWIX_PATH -.SH DESCRIPTION -.PP -Creates a standalone Kiwix + data hierarchy. -.br -If specified, also creates a full\-text index. - -.TP -\fB\-\-verbose\fR -Enable verbose output. - -.TP -\fB\-\-backend=xapian|clucene\fR -Select an indexing backend. - -.TP -\fB\-\-buildIndex\fR -Build an index for the ZIM file. - -.TP -\fBZIM_PATH\fR -ZIM content file path. - -.TP -\fBKIWIX_PATH\fR -Path to the kiwix/ folder. -.br -The path must contain the kiwix standalone binary. - -.SH SEE ALSO -kiwix(1) kiwix\-serve(1) kiwix\-manage(1) -.SH AUTHOR -Emmanuel Engelhart -.br -Vasudev Kamath (Manual) diff --git a/src/man/meson.build b/src/man/meson.build index 8682c2b..2345deb 100644 --- a/src/man/meson.build +++ b/src/man/meson.build @@ -1,4 +1,3 @@ -install_man('kiwix-install.1', - 'kiwix-manage.1', +install_man('kiwix-manage.1', 'kiwix-serve.1') subdir('fr') diff --git a/src/meson.build b/src/meson.build index a427815..18bad9c 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,5 +1,4 @@ -subdir('installer') subdir('manager') subdir('reader') subdir('searcher')