pkgtools

morpheus pkg tools
git clone git://git.2f30.org/pkgtools.git
Log | Files | Refs | README | LICENSE

commit a8c86b39d8bfe3178c65a50eda42320f195e86be
parent 87d9adfc6d47bad28842ed735a7a2efc104b417e
Author: sin <sin@2f30.org>
Date:   Wed Jul  2 23:58:54 +0100

Rename prefix to root

Prefix can be used in the future for installing packages in their
own prefix when and if we move over to aufs based package management.

Diffstat:
db.c | 8++++----
infopkg.c | 6+++---
installpkg.c | 6+++---
pkg.c | 6+++---
pkg.h | 4++--
reject.c | 2+-
removepkg.c | 6+++---
7 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/db.c b/db.c @@ -5,7 +5,7 @@ int fflag = 0; int vflag = 0; struct db * -db_new(const char *prefix) +db_new(const char *root) { struct db *db; struct sigaction sa; @@ -14,13 +14,13 @@ db_new(const char *prefix) TAILQ_INIT(&db->pkg_head); TAILQ_INIT(&db->pkg_rm_head); - if (!realpath(prefix, db->prefix)) { - weprintf("realpath %s:", prefix); + if (!realpath(root, db->root)) { + weprintf("realpath %s:", root); free(db); return NULL; } - estrlcpy(db->path, db->prefix, sizeof(db->path)); + estrlcpy(db->path, db->root, sizeof(db->path)); estrlcat(db->path, DBPATH, sizeof(db->path)); db->pkgdir = opendir(db->path); diff --git a/infopkg.c b/infopkg.c @@ -18,7 +18,7 @@ main(int argc, char *argv[]) { struct db *db; char path[PATH_MAX]; - char *prefix = "/"; + char *root = "/"; int oflag = 0; int i, r; @@ -27,7 +27,7 @@ main(int argc, char *argv[]) oflag = 1; break; case 'r': - prefix = ARGF(); + root = ARGF(); break; default: usage(); @@ -36,7 +36,7 @@ main(int argc, char *argv[]) if (oflag == 0 || argc < 1) usage(); - db = db_new(prefix); + db = db_new(root); if (!db) exit(EXIT_FAILURE); r = db_load(db); diff --git a/installpkg.c b/installpkg.c @@ -18,7 +18,7 @@ main(int argc, char *argv[]) struct db *db; struct pkg *pkg; char path[PATH_MAX]; - char *prefix = "/"; + char *root = "/"; int i; ARGBEGIN { @@ -29,7 +29,7 @@ main(int argc, char *argv[]) fflag = 1; break; case 'r': - prefix = ARGF(); + root = ARGF(); break; default: usage(); @@ -38,7 +38,7 @@ main(int argc, char *argv[]) if (argc < 1) usage(); - db = db_new(prefix); + db = db_new(root); if (!db) exit(EXIT_FAILURE); if (db_load(db) < 0) { diff --git a/pkg.c b/pkg.c @@ -157,8 +157,8 @@ pkg_install(struct db *db, struct pkg *pkg) archive_read_free(ar); return -1; } - if (chdir(db->prefix) < 0) { - weprintf("chdir %s:", db->prefix); + if (chdir(db->root) < 0) { + weprintf("chdir %s:", db->root); archive_read_free(ar); return -1; } @@ -333,7 +333,7 @@ pkgentry_new(struct db *db, const char *file) struct pkgentry *pe; pe = emalloc(sizeof(*pe)); - estrlcpy(pe->path, db->prefix, sizeof(pe->path)); + estrlcpy(pe->path, db->root, sizeof(pe->path)); estrlcat(pe->path, "/", sizeof(pe->path)); estrlcat(pe->path, file, sizeof(pe->path)); estrlcpy(pe->rpath, file, sizeof(pe->rpath)); diff --git a/pkg.h b/pkg.h @@ -43,8 +43,8 @@ struct rejrule { struct db { DIR *pkgdir; /* opendir() handle for DBPATH */ - char prefix[PATH_MAX]; /* db prefix to allow for installation in a mountpoint */ - char path[PATH_MAX]; /* absolute path to DBPATH including db prefix */ + char root[PATH_MAX]; /* db root to allow for installation in a mountpoint */ + char path[PATH_MAX]; /* absolute path to DBPATH including db root */ TAILQ_HEAD(rejrule_head, rejrule) rejrule_head; TAILQ_HEAD(pkg_head, pkg) pkg_head; TAILQ_HEAD(pkg_rm_head, pkg) pkg_rm_head; diff --git a/reject.c b/reject.c @@ -25,7 +25,7 @@ rej_load(struct db *db) ssize_t len; int r; - estrlcpy(rejpath, db->prefix, sizeof(rejpath)); + estrlcpy(rejpath, db->root, sizeof(rejpath)); estrlcat(rejpath, DBPATHREJECT, sizeof(rejpath)); if (!(fp = fopen(rejpath, "r"))) diff --git a/removepkg.c b/removepkg.c @@ -18,7 +18,7 @@ int main(int argc, char *argv[]) { struct db *db; - char *prefix = "/"; + char *root = "/"; int i, r; ARGBEGIN { @@ -29,7 +29,7 @@ main(int argc, char *argv[]) fflag = 1; break; case 'r': - prefix = ARGF(); + root = ARGF(); break; default: usage(); @@ -38,7 +38,7 @@ main(int argc, char *argv[]) if (argc < 1) usage(); - db = db_new(prefix); + db = db_new(root); if (!db) exit(EXIT_FAILURE); r = db_load(db);