glacier-ng 4.0.0
This commit is contained in:
commit
0cf4829fa5
159 files changed
+33717
No files matched your search
@@ -0,0 +1,23 @@
|
||||
#ifndef COMMON_H_
|
||||
#define COMMON_H_
|
||||
|
||||
#ifndef _POSIX_C_SOURCE
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
#endif
|
||||
#ifndef _DEFAULT_SOURCE
|
||||
#define _DEFAULT_SOURCE
|
||||
#endif
|
||||
#ifndef _XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE 700
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *path;
|
||||
mode_t mode;
|
||||
}
|
||||
dir_t;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,70 @@
|
||||
#ifndef ISTOREUTILS_H_
|
||||
#define ISTOREUTILS_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef enum {
|
||||
INDEX,
|
||||
STORE
|
||||
}
|
||||
index_store_t;
|
||||
|
||||
typedef enum {
|
||||
GL_BACKUP_OK = 0,
|
||||
GL_BACKUP_ERR_ALLOC = 1,
|
||||
GL_BACKUP_ERR_OPEN = 2,
|
||||
GL_BACKUP_ERR_ADD_INDEX = 3,
|
||||
GL_BACKUP_ERR_ADD_STORE = 4,
|
||||
GL_BACKUP_ERR_CLOSE = 5
|
||||
}
|
||||
gl_backup_status_t;
|
||||
|
||||
/*
|
||||
* GL_INSTALL_OK: installation successful
|
||||
* GL_INSTALL_ERR_OPEN: unable to open .gpkg file
|
||||
* GL_INSTALL_ERR_MANIFEST: manifest is missing or unparseable
|
||||
* GL_INSTALL_ERR_EXTRACT: unable to extract files
|
||||
* GL_INSTALL_ERR_INDEX: unable to update index
|
||||
* GL_INSTALL_ERR_ALREADY_INSTALLED: package already installed
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
GL_INSTALL_OK = 0,
|
||||
GL_INSTALL_ERR_OPEN = 1,
|
||||
GL_INSTALL_ERR_MANIFEST = 2,
|
||||
GL_INSTALL_ERR_EXTRACT = 3,
|
||||
GL_INSTALL_ERR_INDEX = 4,
|
||||
GL_INSTALL_ERR_ALREADY_INSTALLED = 5,
|
||||
}
|
||||
gl_install_status_t;
|
||||
|
||||
struct gpkg_entry {
|
||||
char *repo;
|
||||
char *pkg;
|
||||
};
|
||||
|
||||
struct gindex {
|
||||
int uid;
|
||||
int listed;
|
||||
struct gpkg_entry *entries;
|
||||
size_t count;
|
||||
};
|
||||
|
||||
bool gl_usr_istore_exists(index_store_t index_or_store, int uid);
|
||||
bool gl_sys_istore_exists(index_store_t index_or_store);
|
||||
|
||||
int gl_init_user(uid_t uid, bool isVerbose);
|
||||
|
||||
int gl_parse_index(struct gindex *idx, FILE *f);
|
||||
void gl_free_index(struct gindex *idx);
|
||||
|
||||
int gl_rebuild_index(uid_t uid, const char *out_dir);
|
||||
|
||||
gl_backup_status_t gl_backup_istore(const char *tar_path, const char *glacier_root,
|
||||
const char *uid);
|
||||
|
||||
gl_install_status_t gl_install_pkg(const char *gpkg_path, uid_t uid);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,84 @@
|
||||
#ifndef PKG_H_
|
||||
#define PKG_H_
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
#define _XOPEN_SOURCE 700
|
||||
|
||||
#include <libconfig.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
typedef struct {
|
||||
int maj;
|
||||
int min;
|
||||
int pat;
|
||||
char *tag;
|
||||
}
|
||||
semver_t;
|
||||
|
||||
typedef struct {
|
||||
char *dep_name;
|
||||
semver_t dep_ver;
|
||||
}
|
||||
dep_t;
|
||||
|
||||
typedef struct {
|
||||
char *conf_name;
|
||||
semver_t conf_ver;
|
||||
}
|
||||
conf_t;
|
||||
|
||||
typedef struct {
|
||||
char *pkg_name;
|
||||
semver_t pkg_ver;
|
||||
char *pkg_desc;
|
||||
char *pkg_maint;
|
||||
char *pkg_copyright;
|
||||
dep_t *pkg_dependencies;
|
||||
conf_t *pkg_conflicts;
|
||||
}
|
||||
gl_pkg_t;
|
||||
|
||||
extern const dir_t gl_root;
|
||||
|
||||
extern const dir_t gl_usr;
|
||||
extern const dir_t gl_usr_index;
|
||||
extern const dir_t gl_usr_store;
|
||||
|
||||
extern const dir_t gl_sys;
|
||||
extern const dir_t gl_sys_index;
|
||||
extern const dir_t gl_sys_store;
|
||||
|
||||
extern dep_t null_dep;
|
||||
extern conf_t null_conf;
|
||||
extern gl_pkg_t empty;
|
||||
|
||||
semver_t gl_pkgver(int major, int minor, int patch);
|
||||
semver_t gl_parse_semver(const char *str);
|
||||
void gl_free_semver(semver_t *v);
|
||||
|
||||
gl_pkg_t *gl_spawn_pkg(
|
||||
char *name, semver_t *ver, char *desc,
|
||||
char *maint, char *copy, dep_t *dep,
|
||||
conf_t conf
|
||||
);
|
||||
|
||||
void gl_show_pkg_props(const gl_pkg_t *pkg);
|
||||
void gl_free_pkg(gl_pkg_t *pkg);
|
||||
|
||||
int gl_mkdir(dir_t *dir);
|
||||
char *gl_cat_dir(const dir_t *a, const dir_t *b);
|
||||
char *gl_cat_dir_and_ver(const dir_t *base, const gl_pkg_t *pkg);
|
||||
dir_t gl_return_dir(const dir_t *a, const dir_t *b, mode_t mode);
|
||||
dir_t gl_return_dir_and_ver(const dir_t *base, gl_pkg_t *pkg, mode_t mode);
|
||||
void gl_free_path(char *path);
|
||||
void gl_free_dir(dir_t *dir);
|
||||
|
||||
int gl_gpm2gpkg(const char *filename, gl_pkg_t *pkg);
|
||||
int gl_prepare_pkgdir(gl_pkg_t *pkg, bool is_syspkg);
|
||||
char *join_with_cwd(const char *path);
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user