I want to provide a make install
target for my app and I am wondering how to handle
renamed files after the application was installed.
I can think of at least two options:
a) If I just copy the new file into the target folder during make install
the old file may stay installed (can cause problems)
b) If I the update requires a previous make uninstall
: Should the user start the make uninstall
or should I add this to my make install
target? If the user forgets the make uninstall
I end up with the same problem as in a)
Which options do I have to ensure that the old installed file is removed for sure?
This isn't really an appropriate question for SO since it's basically opinion-based.
However the obvious answer is there's no way for your NEW release to be sure that all the files in the OLD release are gone because the new release can't know what files were part of the old release, unless you plan to keep a list of the contents of all old releases in perpetuity.
Instead what's usually done is that as part of the install step you also install a list of files for the release that was just installed, then when you run make install
for a NEW release you can use that list created by the old release when it was installed, to delete all those files, or check that they exist and if so tell the user to run make uninstall
first or similar.
Sometimes people even install the makefile itself, or some part of it, so that they can run the "old" makefile's uninstall
target.
This is one thing a package manager will give you: it remembers all the files that were installed and can remove them again. But you can do it yourself if you prefer.