Reverse proxy subdomain to secondary application Nethserver

Ok. It should be possible to automatically remove all these configurations. One algorithm would be:

  1. Build a list of packages which are also removed by the specific nethserver package. Either do it upfront or do it incrementely package by package later by querying the list of “yum autoremove”.

  2. Before removal of a package, check which template files are defined by the installed package. Then remove the package and check again. If there is another package installed which has a template part for the same file, trigger the template expansion to regenerate the destination file otherwise remove the destination file. (have a command “yum-ns-remove” which is used instead of “yum remove”)

Algorithm 2:
Another possibility would be to have an post action for package installed which records the list of files generated by templates in separate file. This list would contain template generated destinations. If someone remove some packages with yum, you can afterwards start a ns-template-cleanup, which does similar checks as in point 2 above, i.e. check whether a former template generated file still has a template in the installed packages, then issue a template-expansion otherweise delete the file. In any case remove the file from the list of template generated files.

started to implement a %postun in my rpm

%postun
/usr/bin/rm -f /etc/httpd/conf.d/awstats.conf
/usr/bin/systemctl reload httpd
1 Like

A simplification to algorithm 2, so that no rpm has to be changed would be:

  1. The central template expansion code adds each generated file to a list (text file), let’s call it “template-generated-files”

  2. Have a “expand-and-cleanup-all-templates” command, which simply expands all existing templates and removes all files listed in the “template-generate-file” list above from the system (and the “template-generate-file” list), which are not regenerated.

  3. When a nethserver package gets removed, follow it by an “yum autoremove” and “expland-and-cleanup-all-templates”.

Does the package removal clean up the DB entries/props of the module?

the behavior from ages is to not remove the esmith db