blob: ee7fe75c8a25713bc03ecb8885afcdef7473555c (
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
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
typedef struct {
const char* name;
const char* desc;
const char* url;
} mbpk_repository;
#define MBPK_DB_DIR "/var/lib/mbpk"
#define MBPK_REPO_DIR "/var/lib/mbpk-repo"
#define MBPK_REPO_CONFIG "/etc/mbpk-repos.ini"
int mbpk_init(void) {
struct stat st;
if (stat(MBPK_DB_DIR, &st) == -1) {
if (mkdir(MBPK_DB_DIR, 0755) == -1) {
fprintf(stderr, "mbpk: failed to create %s: %s\n", MBPK_DB_DIR, strerror(errno));
}
return 1;
}
return 0;
}
|