fre 2013-08-23 klockan 16:46 -0700 skrev Adam Williamson: > But if > I'm going to do it, I'd rather get the replace-dir-with-symlink stuff > 'right' (for whatever value we decide is 'right') first time. The shortest scriptlet I saw to remove a directory in pretrans is: (see e.g. http://pkgs.fedoraproject.org/cgit/mozilla-firetray.git/tree/mozilla-firetray.spec) %pretrans -p <lua> st = posix.stat("<path to dir>") if st and st.type == "directory" then os.execute("rm -rf <path to dir>") end But, this sort of cheats a bit since is calls out to system rm, which is not present on the initial install transaction. On the other hand on the initial install transaction the directory does not exist and the os.execute will not be executed. So it is possibly acceptable. Doing recursive directory removal completely in lua is as already mentioned a quite long script. The corresponding scriptlets to remove a symlink or a file do not have to cheat: %pretrans -p <lua> st = posix.stat("<path to link>") if st and st.type == "link" then os.remove("<path to link>") end %pretrans -p <lua> st = posix.stat("<path to file>") if st and st.type == "regular" then os.remove("<path to file>") end Mattias
<<attachment: smime.p7s>>
-- devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/devel Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct