added a default cachedir
This commit is contained in:
parent
86ec3a2ad7
commit
feb152d78c
|
@ -35,6 +35,7 @@
|
|||
#define min(X, Y) ((X) < (Y) ? (X) : (Y))
|
||||
|
||||
extern char *pmo_dbpath;
|
||||
extern char *pmo_cachedir;
|
||||
extern list_t *pmo_holdpkg;
|
||||
extern char *pmo_proxyhost;
|
||||
extern unsigned short pmo_proxyport;
|
||||
|
@ -214,6 +215,14 @@ int parseconfig(char *file)
|
|||
FREE(pmo_dbpath);
|
||||
pmo_dbpath = strdup(ptr);
|
||||
vprint("config: dbpath: %s\n", ptr);
|
||||
} else if(!strcmp(key, "CACHEDIR")) {
|
||||
/* shave off the leading slash, if there is one */
|
||||
if(*ptr == '/') {
|
||||
ptr++;
|
||||
}
|
||||
FREE(pmo_cachedir);
|
||||
pmo_cachedir = strdup(ptr);
|
||||
vprint("config: cachedir: %s\n", ptr);
|
||||
} else if (!strcmp(key, "LOGFILE")) {
|
||||
if(alpm_set_option(PM_OPT_LOGFILE, (long)ptr) == -1) {
|
||||
ERR(NL, "failed to set option LOGFILE (%s)\n", alpm_strerror(pm_errno));
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
/* command line options */
|
||||
char *pmo_root = NULL;
|
||||
char *pmo_dbpath = NULL;
|
||||
char *pmo_cachedir = NULL;
|
||||
char *pmo_configfile = NULL;
|
||||
unsigned short pmo_op = PM_OP_MAIN;
|
||||
unsigned short pmo_verbose = 0;
|
||||
|
@ -174,6 +175,9 @@ int main(int argc, char *argv[])
|
|||
if(pmo_dbpath == NULL) {
|
||||
pmo_dbpath = strdup("var/lib/pacman");
|
||||
}
|
||||
if(pmo_cachedir == NULL) {
|
||||
pmo_cachedir = strdup("var/cache/pacman");
|
||||
}
|
||||
|
||||
/* set library parameters */
|
||||
if(alpm_set_option(PM_OPT_LOGMASK, (long)pmo_debug) == -1) {
|
||||
|
@ -188,6 +192,10 @@ int main(int argc, char *argv[])
|
|||
ERR(NL, "failed to set option DBPATH (%s)\n", alpm_strerror(pm_errno));
|
||||
cleanup(1);
|
||||
}
|
||||
if(alpm_set_option(PM_OPT_CACHEDIR, (long)pmo_cachedir) == -1) {
|
||||
ERR(NL, "failed to set option CACHEDIR (%s)\n", alpm_strerror(pm_errno));
|
||||
cleanup(1);
|
||||
}
|
||||
|
||||
if(pmo_verbose > 1) {
|
||||
printf("Root : %s\n", pmo_root);
|
||||
|
|
Loading…
Reference in New Issue