Some packages are modifying files in their scriptlets (e.g. anonftp, XFree86). Because these files can be on shared partitions it would be nice to test if they are covered by %_netsharedpath or not. In my rpms I am using a macro: | %define __isDirectoryShared rpm --eval '%%{_netsharedpath}' | perl -e '$_=$ARGV[0];$l=<STDIN>;chomp($l);foreach $p (split(/:/,$l)) {exit(0) if m!^$p!;}; exit(1)' which can be used e.g. as: | %post | %__isDirectoryShared %{_infodir} || %{__install_info} %{_infodir}/my-doc Well, the macro contains perl and rpmlint complains about dangerous commands in the %post scriptlet, but this could be solved by a C implementation and a popt-command for rpm doing the "rpm --eval '%%{_netsharedpath}'". It would be nice if the official rpm contains such a functionality...
Agreed %_netsharedpath is pretty feeble and complicated mechanism. Rather than adding yet more complicated macro glop to do the right thing, I suggest an alternative approach 1) Classify all files, in this case, mark a file as an "info" file. 2) Associate actions with each class, in this case, the install action is %{__install_info} 3) Parameterize the actions with per-install-system configuration, in this case the (default) parameter is %{_infodir}/my-doc 4) Enrich the transaction state machine to automagically perform actions for each file in a class. 5) Make the transaction state machine sensitive to transaction context like %_netsharedpath The end result would essentially factor most of the operations now done in %post et al scriptlets out of packages, and into the installer (i.e. rpm) context without the cumbersome artifacts like "rpm --eval" to reacquire the transaction context.
How would a package fit into this scheme whose files can not be classified or are used only by this package? An example is anonftp: | $ rpm -q --scripts anonftp | ... | preuninstall scriptlet (through /bin/sh): | if [ $1 = 0 ]; then | rm -f /var/ftp/lib/* /var/ftp/bin/* | fi or XFree86 | $ rpm -q --scripts XFree86 | ... | postinstall scriptlet (through /bin/sh): | { | for dir in lbxproxy proxymngr rstart xserver ; do | [ ! -L /usr/X11R6/lib/X11/$dir -a ! -d /usr/X11R6/lib/X11/$dir ] && \ | ln -snf ../../../../etc/X11/$dir /usr/X11R6/lib/X11/$dir || : [see bug #51188 and bug #50670] What is with packages which are executing special installation-programs in their scriptlets (e.g. glibc, see bug #50667).
Yes, there will always be execeptions. I'm talking about regularizing the 20 or so common actions that constitute the majority of %post et al scriptlets. The existing mechanism will remain.
I'm gonna use this bug as a collection point for redesigning netsharedpath functionality.
*** Bug 4330 has been marked as a duplicate of this bug. ***
*** Bug 3229 has been marked as a duplicate of this bug. ***
One of these days.... I'm going to redo all the X rpm scripts from scratch. A lot of crap in there probably can go.
OK, there's a bug pile on here and no suggestions for better replacement for %_netsharedpath. So my intent -- asking for suggestions for better ideas -- is not being served anymore. AFAIAC, %_netsharedpath is the best known mechanism, and better solutions are at odds with my "stable rpm" prime directive. Hence WONTFIX.
hehe, it's a clever trick to change the initial summary/request of | Add functionality to test if path is in %_netsharedpath into | RFE: %_netsharedpath mechanism is naive, needs redesign and wait 3 years till everybody forgets this change. So, it is easier to say WONTFIX... But my mailarchive never forgets... And to clearify things... I never said that %_netsharedpath is naive -- it is doing exactly this, for what it was designed (ok... not exactly... there are other 3 year old bugs about misclassification of parent-directories... but this is another issue and when we let pass other 3 years, we can close this with WONTFIX also). I just wanted a simple resp. standardized method to test in %scriptlets whether a path is covered by %_netsharedpath.