Add new default ADEPT directories : /home/<user>/.config/adept and $ADEPT_DIR environment variable
This commit is contained in:
parent
937c27fc23
commit
ab5afa5003
19
README.md
19
README.md
|
@ -82,38 +82,43 @@ BUILD_SHARED build libgourou.so if 1, nothing if 0, can be combined with BUILD_S
|
|||
Utils
|
||||
-----
|
||||
|
||||
You can import configuration from your eReader or create a new one with _utils/adept\_activate_ :
|
||||
First, add libgourou.so to your LD_LIBRARY_PATH
|
||||
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
|
||||
|
||||
You can optionaly specify your .adept directory
|
||||
|
||||
export ADEPT_DIR=/home/XXX
|
||||
|
||||
Then, use utils as following :
|
||||
|
||||
You can import configuration from your eReader or create a new one with _utils/adept\_activate_ :
|
||||
|
||||
./utils/adept_activate -u <AdobeID USERNAME>
|
||||
|
||||
Then a _./.adept_ directory is created with all configuration file
|
||||
Then a _/home/<user>/.config/adept_ directory is created with all configuration file
|
||||
|
||||
To download an ePub/PDF :
|
||||
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
|
||||
./utils/acsmdownloader -f <ACSM_FILE>
|
||||
|
||||
To export your private key (for DeDRM software) :
|
||||
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
|
||||
./utils/acsmdownloader --export-private-key [-o adobekey_1.der]
|
||||
|
||||
To remove ADEPT DRM :
|
||||
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
|
||||
./utils/adept_remove -f <encryptedFile>
|
||||
|
||||
To list loaned books :
|
||||
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
|
||||
./utils/adept_loan_mgt [-l]
|
||||
|
||||
To return a loaned book :
|
||||
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD
|
||||
./utils/adept_loan_mgt -r <id>
|
||||
|
||||
|
||||
You can get utils full options description with -h or --help switch
|
||||
|
||||
|
||||
|
|
|
@ -32,10 +32,6 @@
|
|||
#define HOBBES_DEFAULT_VERSION "10.0.4"
|
||||
#endif
|
||||
|
||||
#ifndef DEFAULT_ADEPT_DIR
|
||||
#define DEFAULT_ADEPT_DIR "./.adept"
|
||||
#endif
|
||||
|
||||
#ifndef ACS_SERVER
|
||||
#define ACS_SERVER "http://adeactivate.adobe.com/adept"
|
||||
#endif
|
||||
|
@ -108,6 +104,11 @@ namespace gourou
|
|||
*/
|
||||
void returnLoan(const std::string& loanID, const std::string& operatorURL);
|
||||
|
||||
/**
|
||||
* @brief Return default ADEPT directory (ie /home/<user>/.config/adept)
|
||||
*/
|
||||
static std::string getDefaultAdeptDir(void);
|
||||
|
||||
/**
|
||||
* @brief Create a new ADEPT environment (device.xml, devicesalt and activation.xml).
|
||||
*
|
||||
|
@ -118,7 +119,7 @@ namespace gourou
|
|||
* @param ACSServer Override main ACS server (default adeactivate.adobe.com)
|
||||
*/
|
||||
static DRMProcessor* createDRMProcessor(DRMProcessorClient* client,
|
||||
bool randomSerial=false, const std::string& dirName=std::string(DEFAULT_ADEPT_DIR),
|
||||
bool randomSerial=false, std::string dirName=std::string(""),
|
||||
const std::string& hobbes=std::string(HOBBES_DEFAULT_VERSION),
|
||||
const std::string& ACSServer=ACS_SERVER);
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <libgourou_common.h>
|
||||
#include <libgourou_log.h>
|
||||
|
||||
#define LOCAL_ADEPT_DIR "./.adept"
|
||||
|
||||
#define ASN_NONE 0x00
|
||||
#define ASN_NS_TAG 0x01
|
||||
#define ASN_CHILD 0x02
|
||||
|
@ -68,11 +70,14 @@ namespace gourou
|
|||
if (user) delete user;
|
||||
}
|
||||
|
||||
DRMProcessor* DRMProcessor::createDRMProcessor(DRMProcessorClient* client, bool randomSerial, const std::string& dirName,
|
||||
DRMProcessor* DRMProcessor::createDRMProcessor(DRMProcessorClient* client, bool randomSerial, std::string dirName,
|
||||
const std::string& hobbes, const std::string& ACSServer)
|
||||
{
|
||||
DRMProcessor* processor = new DRMProcessor(client);
|
||||
|
||||
if (dirName == "")
|
||||
dirName = getDefaultAdeptDir();
|
||||
|
||||
Device* device = Device::createDevice(processor, dirName, hobbes, randomSerial);
|
||||
processor->device = device;
|
||||
|
||||
|
@ -845,6 +850,22 @@ namespace gourou
|
|||
signNode(root);
|
||||
}
|
||||
|
||||
std::string DRMProcessor::getDefaultAdeptDir(void)
|
||||
{
|
||||
#ifndef DEFAULT_ADEPT_DIR
|
||||
const char* user = getenv("USER");
|
||||
|
||||
if (user && user[0])
|
||||
{
|
||||
return std::string("/home/") + user + std::string("/.config/adept/");
|
||||
}
|
||||
else
|
||||
return LOCAL_ADEPT_DIR;
|
||||
#else
|
||||
return DEFAULT_ADEPT_DIR "/";
|
||||
#endif
|
||||
}
|
||||
|
||||
void DRMProcessor::returnLoan(const std::string& loanID, const std::string& operatorURL)
|
||||
{
|
||||
pugi::xml_document returnReq;
|
||||
|
|
|
@ -201,6 +201,8 @@ static void usage(const char* cmd)
|
|||
|
||||
std::cout << std::endl;
|
||||
std::cout << "Device file, activation file and device key file are optionals. If not set, they are looked into :" << std::endl;
|
||||
std::cout << " * $ADEPT_DIR environment variable" << std::endl;
|
||||
std::cout << " * /home/<user>/.config/adept" << std::endl;
|
||||
std::cout << " * Current directory" << std::endl;
|
||||
std::cout << " * .adept" << std::endl;
|
||||
std::cout << " * adobe-digital-editions directory" << std::endl;
|
||||
|
|
|
@ -230,7 +230,7 @@ int main(int argc, char** argv)
|
|||
|
||||
if (!_outputDir || _outputDir[0] == 0)
|
||||
{
|
||||
outputDir = strdup(abspath(DEFAULT_ADEPT_DIR));
|
||||
outputDir = strdup(abspath(gourou::DRMProcessor::getDefaultAdeptDir().c_str()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -348,6 +348,8 @@ static void usage(const char* cmd)
|
|||
|
||||
std::cout << std::endl;
|
||||
std::cout << "ADEPT directory is optional. If not set, it's looked into :" << std::endl;
|
||||
std::cout << " * $ADEPT_DIR environment variable" << std::endl;
|
||||
std::cout << " * /home/<user>/.config/adept" << std::endl;
|
||||
std::cout << " * Current directory" << std::endl;
|
||||
std::cout << " * .adept" << std::endl;
|
||||
std::cout << " * adobe-digital-editions directory" << std::endl;
|
||||
|
|
|
@ -158,6 +158,8 @@ static void usage(const char* cmd)
|
|||
|
||||
std::cout << std::endl;
|
||||
std::cout << "Device file, activation file and device key file are optionals. If not set, they are looked into :" << std::endl;
|
||||
std::cout << " * $ADEPT_DIR environment variable" << std::endl;
|
||||
std::cout << " * /home/<user>/.config/adept" << std::endl;
|
||||
std::cout << " * Current directory" << std::endl;
|
||||
std::cout << " * .adept" << std::endl;
|
||||
std::cout << " * adobe-digital-editions directory" << std::endl;
|
||||
|
|
|
@ -61,6 +61,20 @@ bool fileExists(const char* filename)
|
|||
|
||||
const char* findFile(const char* filename, bool inDefaultDirs)
|
||||
{
|
||||
std::string path;
|
||||
|
||||
const char* adeptDir = getenv("ADEPT_DIR");
|
||||
if (adeptDir && adeptDir[0])
|
||||
{
|
||||
path = adeptDir + std::string("/") + filename;
|
||||
if (fileExists(path.c_str()))
|
||||
return strdup(path.c_str());
|
||||
}
|
||||
|
||||
path = gourou::DRMProcessor::getDefaultAdeptDir() + filename;
|
||||
if (fileExists(path.c_str()))
|
||||
return strdup(path.c_str());
|
||||
|
||||
if (fileExists(filename))
|
||||
return strdup(filename);
|
||||
|
||||
|
@ -68,7 +82,7 @@ const char* findFile(const char* filename, bool inDefaultDirs)
|
|||
|
||||
for (int i=0; i<(int)ARRAY_SIZE(defaultDirs); i++)
|
||||
{
|
||||
std::string path = std::string(defaultDirs[i]) + filename;
|
||||
path = std::string(defaultDirs[i]) + filename;
|
||||
if (fileExists(path.c_str()))
|
||||
return strdup(path.c_str());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user