Le 11/01/2017 à 18:01, Tom Zander a écrit :
On Wednesday, 11 January 2017 09:19:45 CET Doug Newgard wrote:
I'm not talking about the package function, I'm talking about the .install file with the post_{install,upgrade,remove} scriptlets. Specifically: My apologies, I must have misread :)
I have to ask a bit more since your pointers are great, but I’m not sure how I can actually accomplish them:
I’ll answer that for Doug. Note that this is my proposition based on systemd tools, there might be other solutions.
Disabling COW should be left up to the sysadmin. How would we do that?
Just don’t do it, eventually just print a message advising the user to do so.
chown should be done in the PKGBUILD if at all possible Can you explain how? AFAICT the user doesn’t exist yet at that point.
You could use systemd-tmpfiles[0] and its Z mode[1]. This tool would also help you managing the other directories creation and the like. Please tell if you need help setting up this.
Users should not be deleted; this is a security issue if the UID gets reused. Your big fancy message shouldn't be there. This is normal stuff.
After a quick glance at your install file, I think it should be as simple and short as this (+eventual notice for CoW): post_install() { systemd-sysusers bitcoin-classic.conf systemd-tmpfiles --create bitcoin-classic.conf } Of course, all of the “hard” work is to be done in new files bitcoin.tmpfiles and bitcoin.sysusers (for the systemd-sysusers[2] feature, related format[3]), that should be installed like this in package(): install -Dm644 "${srcdir}"/${pkgname}.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/${pkgname}.conf install -Dm644 "${srcdir}"/${pkgname}.sysusers "${pkgdir}"/usr/lib/sysusers.d/${pkgname}.conf I can help you writing those files if you need.
The whole "/etc/bitcoin/bitcoin.conf.dist" thing shouldn't happen. Just install to /etc/bitcoin/bitcoin.conf in the package function. I have not found out how pacman treats config files on upgrades, removes and reinstalls. The point here is that the config file should not be overwritten by the package version on upgrade, it should not be deleted when the package is deleted (and may be reinstalled just minutes later) etc. Only when its 100% identical to the one in the package can it safely be deleted / upgraded.
Maybe I didn’t look good enough, but I could not find out how to do the above. So I went for the safest solution.
See Eli answer. :) You could guess that for such a widespread need, there is something to handle it. ;) Further reviewing incoming, Bruno [0] https://www.freedesktop.org/software/systemd/man/systemd-tmpfiles.html [1] https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html [2] https://www.freedesktop.org/software/systemd/man/systemd-sysusers.html [3] https://www.freedesktop.org/software/systemd/man/sysusers.d.html