setup/setup.c
changeset 17 43df682785f5
parent 3 868db5c1f2d7
child 24 2b9f54d14cc2
     1.1 --- a/setup/setup.c	Thu Aug 13 19:01:16 2009 +0100
     1.2 +++ b/setup/setup.c	Mon Jan 30 13:35:28 2012 +0000
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (C) 2009  J. Ali Harlow <ali@juiblex.co.uk>
     1.6 + * Copyright (C) 2009, 2011  J. Ali Harlow <ali@juiblex.co.uk>
     1.7   *
     1.8   * This program is free software; you can redistribute it and/or modify
     1.9   * it under the terms of the GNU General Public License as published by
    1.10 @@ -75,21 +75,10 @@
    1.11      free(vector);
    1.12  }
    1.13  
    1.14 -static void *alloc_lua(void *user_data,void *ptr,size_t osize,size_t nsize)
    1.15 -{
    1.16 -    if (!nsize)
    1.17 -    {
    1.18 -	free(ptr);
    1.19 -	return NULL;
    1.20 -    }
    1.21 -    else
    1.22 -	return realloc(ptr,nsize);
    1.23 -}
    1.24 -
    1.25  void setup(const char *argv0)
    1.26  {
    1.27      char *path,*s,*prefix;
    1.28 -    int changed;
    1.29 +    int ch,changed;
    1.30      struct comps *comps;
    1.31      struct comps_group *group;
    1.32      struct comps_requirement *pkg;
    1.33 @@ -104,6 +93,18 @@
    1.34      }
    1.35      free(s);
    1.36      prefix=plover_default_prefix_for_vendor(comps->vendor);
    1.37 +    if (!plover_installed_files_match_prefix(prefix))
    1.38 +    {
    1.39 +	printf("The existing installation is not under %s\n"
    1.40 +	  "In order to continue, all the existing packages must be removed.\n"
    1.41 +	  "Do you want to remove all existing packages? ",prefix);
    1.42 +	ch=getchar();
    1.43 +	if (ch!='y' && ch!='Y' && ch!=EOF && ch!='\n')
    1.44 +	    exit(1);
    1.45 +	while(ch!='\n' && ch!=EOF)
    1.46 +	    ch=getchar();
    1.47 +	plover_remove(NULL);
    1.48 +    }
    1.49      group=plover_comps_lookup_group(comps,"base");
    1.50      if (!group)
    1.51      {
    1.52 @@ -148,4 +149,5 @@
    1.53  	plover_remove(NULL);
    1.54      else
    1.55  	setup(argv[0]);
    1.56 +    exit(0);
    1.57  }