blob: dd93565e2be4991196b8b14807256a67e3e05a57 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include <stdio.h>
#include <stdlib.h>
#include "libmbpk.h"
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#define MBPK_DB_DIR "/var/lib/mbpk"
#define MBPK_REPO_DIR "/var/lib/mbpk-repo"
#define MBPK_REPO_CONFIG "/etc/mbpk-repos.ini"
typedef struct {
const char* name;
const char* desc;
const char* url;
} mbpk_repository;
mbpk_repository **repos;
int mbpk_init(void) {
struct stat st;
if (stat(MBPK_DB_DIR, &st) == -1) {
if (mkdir(MBPK_DB_DIR, 0755) == -1) {
fprintf(stderr, "mbpk [err]: failed to create %s: %s\n", MBPK_DB_DIR, strerror(errno));
return MBPK_DB_FAIL;
}
}
if (stat(MBPK_REPO_DIR, &st) == -1) {
fprintf(stderr, "mbpk [warn]: no repositories found! you might want to sync all repositories using mbpk-update.\n");
}
return MBPK_OK;
}
|