pkgtools

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

commit 31b673ee0fca620788a31845a460d1b993889468
parent b0cffec486336c505982016bf7a997500f470626
Author: sin <sin@2f30.org>
Date:   Wed Jun 25 13:04:02 +0100

Skip packages that fail to be installed/removed

Diffstat:
installpkg.c | 8++++++--
removepkg.c | 3++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/installpkg.c b/installpkg.c @@ -55,6 +55,8 @@ main(int argc, char *argv[]) if (vflag == 1) printf("installing %s\n", path); pkg = pkg_load_file(db, path); + if (!pkg) + continue; if (fflag == 0) { if (pkg_collisions(pkg) < 0) { db_free(db); @@ -62,8 +64,10 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); } } - db_add(db, pkg); - pkg_install(db, pkg); + if (db_add(db, pkg) < 0) + continue; + if (pkg_install(db, pkg) < 0) + continue; printf("installed %s\n", path); } diff --git a/removepkg.c b/removepkg.c @@ -68,7 +68,8 @@ pkg_remove_cb(struct db *db, struct pkg *pkg, void *name) if (strcmp(pkg->name, name) == 0) { if (pkg_remove(db, pkg) < 0) return -1; - db_rm(db, pkg); + if (db_rm(db, pkg) < 0) + return -1; printf("removed %s\n", pkg->name); return 1; }