pm

barely a pack manager
git clone git://z3bra.org/pm
Log | Files | Refs | README | LICENSE

commit 1122cb5b5c7dc42336705a96f9948cd36b9891a7
parent af900cc7fe4dc5326abf194645263bcbf789cabf
Author: z3bra <contactatz3bradotorg>
Date:   Sat Nov 25 18:34:49 +0100

Only update if versions differ

In case pack version is the same, the update will fail for this pack. An
update can be forced in order to reinstall a pack (delete + add) with
the -f flag.

Diffstat:
pm.c | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/pm.c b/pm.c @@ -840,7 +840,7 @@ int update(const char *rootfs, const char *datadir, char *name) { int r = 0, tmp = overwrite; - char path[PATH_MAX]; + char path[PATH_MAX], ver[LINE_MAX]; struct pack *p = NULL; if (re_match(PACK_FORMAT, name) != 0) { @@ -863,6 +863,13 @@ update(const char *rootfs, const char *datadir, char *name) return ERR_DELETE; } + inspect_version(datadir, p->name, ver); + if (!overwrite && !strncmp(p->version, ver, LINE_MAX)) { + fprintf(stderr, "%s: Already at version %s\n", p->name, p->version); + pack_free(p); + return ERR_DELETE; + } + if (pack_delete(rootfs, datadir, p) != 0) { pack_free(p); return ERR_DELETE;