diff -r 868db5c1f2d7 -r 5cbb66c24fc6 update/update.c --- a/update/update.c Thu Aug 13 19:01:16 2009 +0100 +++ b/update/update.c Fri Mar 23 20:29:50 2012 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 J. Ali Harlow + * Copyright (C) 2009, 2011 J. Ali Harlow * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,6 +17,7 @@ */ #include +#include #include #include "config.h" #include "plover/plover.h" @@ -27,6 +28,7 @@ void update(const char *argv0) { char *path,*s,*prefix; + int ch; struct comps *comps; path=plover_get_program_directory(argv0); s=plover_strconcat(path,"/repodata/comps.xml",NULL); @@ -38,6 +40,18 @@ } free(s); prefix=plover_default_prefix_for_vendor(comps->vendor); + if (!plover_installed_files_match_prefix(prefix)) + { + printf("The existing installation is not under %s\n" + "In order to continue, all the existing packages must be removed.\n" + "Do you want to remove all existing packages? ",prefix); + ch=getchar(); + if (ch!='y' && ch!='Y' && ch!=EOF && ch!='\n') + exit(1); + while(ch!='\n' && ch!=EOF) + ch=getchar(); + plover_remove(NULL); + } plover_comps_free(comps); plover_update(path,prefix,NULL); free(prefix); @@ -49,4 +63,5 @@ razor_set_lua_loader("posix",luaopen_posix); razor_set_lua_loader("whelk",luaopen_whelk); update(argv[0]); + exit(0); }