pm

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

commit e17765dc52fa7fbd49aed285bd6a591018d833f7
parent 1e59dea52f46876bd239166d24fdf680bf8965f1
Author: z3bra <willyatmailoodotorg>
Date:   Tue Jan 12 14:08:22 2016

Add check for already installed packs

Diffstat:
 pm.c | 8 ++++++++
 1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/pm.c b/pm.c @@ -384,8 +384,16 @@ int install(char *rootfs, char *datadir, struct pack *p) { int r; + char tmp[PATH_MAX] = ""; + struct stat st; if (overwrite == 0) { + snprintf(tmp, PATH_MAX, "%s/%s", datadir, p->name); + if (stat(tmp, &st) == 0 && S_ISDIR(st.st_mode)) { + fprintf(stderr, "%s: already installed\n", p->name); + return -1; + } + if (inspect_collision(rootfs, p) != 0) return -1; }