#ifndef ISTOREUTILS_H_ #define ISTOREUTILS_H_ #include #include #include 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