On 07.05.2020 20:38, Wietse Venema wrote: > Maxim Nikulin: >> >> Just to avoid any ambiguity, you suggest that package post install >> script should have something like the following, don't you? >> >> postfix upgrade-configuration \ > > In which script file or documentation file? > >> shlib_directory=/usr/lib... >> ... > > Why would one want to hard-code /usr/lib?
In real life some kind parametrization is expected here (I realized I am unsure concerning postfix, generally /usr/local is used by default.) I put "/usr/lib..." just avoid diving into details with e.g. RPM macro expansion or parameters of alternative build and packaging scripts. Is it OK to discuss Fedora packaging rules? (RedHat EL .spec file is similar) https://src.fedoraproject.org/rpms/postfix/raw/master/f/postfix.spec Post-install RPM script https://src.fedoraproject.org/rpms/postfix/blob/HEAD/f/postfix.spec#_447 %post -e contains in particular https://src.fedoraproject.org/rpms/postfix/blob/HEAD/f/postfix.spec#_451 %{_sbindir}/postfix set-permissions upgrade-configuration \ daemon_directory=%{postfix_daemon_dir} \ # More parameters... >From your words I decided that the following line should be added here shlib_directory=%{postfix_shlib_dir} \ I took it from install step https://src.fedoraproject.org/rpms/postfix/blob/HEAD/f/postfix.spec#_309 %install namely from "make non-interactive-package" command https://src.fedoraproject.org/rpms/postfix/blob/HEAD/f/postfix.spec#_322 It uses definition of the internal postfix_shlib_dir parameter %define postfix_shlib_dir %{_libdir}/postfix https://src.fedoraproject.org/rpms/postfix/blob/HEAD/f/postfix.spec#_32 > Why not also override queue_directory, data_directory, etc? Of > course many of these are meaningful only for first-time installs. Sorry, I narrowed down context too much, My question was on shlib_directory, so I assumed that "..." is a proper substitution for all other variables. By the way, I noticed that queue_directory and data_directory are passed to "make non-interactive-package" but not to "postfix upgrade-configuration" (and shlib_directory too). >>> As for shlib_dir in main.cf: >>> >>> shlib_dir not only specifies at BUILD time the location for >>> libpostfix-*, information that the runtime linker needs to use to >>> start a Postfix program, before any Postfix program can look up >>> settings in main.cf. > > You missed the paragraph that immediately follows this. It explains > how the main.cf setting is used during RUN time. Maybe I stick too strong to workflow with installing of prepared rpm or deb packages as opposite to compiling and installing from sources. I realized the following might be a reason to *avoid* default value in the config file inside a package: >>> and therefore this location may be changed after Postfix is built. If administrator of particular server installed a package and later decided to move .so files to other directory then it is time to add explicit shlib_directory to main.cf. This case invoking "postfix upgrade-configuration" with shlib_directory parameter in package post-install script will break postfix. The script is executed during package upgrade and such scenario includes the cases of transitions from one package vendor to another perhaps with change of package layout. I suspect that in general it should be quite fragile solution to alternate shlib_directory while using packages. So the source of problems is upgrade of package between versions with different layouts or with/without support of shared libraries. If shlib_directory were absent in main.cf and all programs were getting the value from postconf instead of reading main.cf directly than package upgrades would be smooth. Such way is not viable since there are installations with explicit shlib_directory across the world. So the only way is to force updating the setting to built-in value from new package version (and no possibility to customize shlib_directory on particular server if postfix is installed from a package). Commenting out the line in the post install script could be an alternative. To summarize, I am considering adapting of the following to particular packaging system # post-install stage (clean install or upgrade) %{_sbindir}/postfix set-permissions upgrade-configuration \ shlib_directory=%{postfix_shlib_dir} \ daemon_directory=%{postfix_daemon_dir} \ # More parameters...