/* * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 * * 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 version 2. * * 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. * */ #include #include #include #include #include #include #include #include using namespace sword; using std::cout; using std::cerr; using std::cin; using std::map; SWMgr *mgr; InstallMgr *installMgr; SWBuf baseDir; SWBuf confPath; class MyInstallMgr : public InstallMgr { public: MyInstallMgr(const char *privatePath = "./") : InstallMgr(privatePath) {} virtual bool isUserDisclaimerConfirmed() const { static bool confirmed = false; if (!confirmed) { cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; cout << " -=+* WARNING *+=- -=+* WARNING *+=-\n\n\n"; cout << "Although Install Manager provides a convenient way for installing\n"; cout << "and upgrading SWORD components, it also uses a systematic method\n"; cout << "for accessing sites which gives packet sniffers a target to lock\n"; cout << "into for singling out users. \n\n\n"; cout << "IF YOU LIVE IN A PERSECUTED COUNTRY AND DO NOT WISH TO RISK DETECTION,\n"; cout << "YOU SHOULD *NOT* USE INSTALL MANAGER'S REMOTE SOURCE FEATURES.\n\n\n"; cout << "Also, Remote Sources other than CrossWire may contain less than\n"; cout << "quality modules, modules with unorthodox content, or even modules\n"; cout << "which are not legitimately distributable. Many repositories\n"; cout << "contain wonderfully useful content. These repositories simply\n"; cout << "are not reviewed or maintained by CrossWire and CrossWire\n"; cout << "cannot be held responsible for their content. CAVEAT EMPTOR.\n\n\n"; cout << "If you understand this and are willing to enable remote source features\n"; cout << "then type yes at the prompt\n\n"; cout << "enable? [no] "; char prompt[10]; fgets(prompt, 9, stdin); confirmed = (!strcmp(prompt, "yes\n")); } return confirmed; } }; void init() { mgr = new SWMgr(); SWBuf baseDir = mgr->getHomeDir(); if (baseDir.length() < 1) baseDir = "."; baseDir += "/.sword/InstallMgr"; confPath = baseDir + "/InstallMgr.conf"; installMgr = new MyInstallMgr(baseDir); } // clean up and exit if status is 0 or negative error code void finish(int status) { delete installMgr; delete mgr; if (status < 1) { cout << "\n"; exit(status); } } void usage(const char *progName) { fprintf(stderr, "usage: %s