Spec URL: https://fedorapeople.org/~bgilbert/ssh-key-dir/rust-ssh-key-dir.spec SRPM URL: https://fedorapeople.org/~bgilbert/ssh-key-dir/rust-ssh-key-dir-0.1.1-1.fc31.src.rpm Description: sshd AuthorizedKeysCommand to read key files from ~/.ssh/authorized_keys.d. Fedora Account System Username: bgilbert
Two small comments: > install -D -m 644 -t %{buildroot}%{_sysconfdir}/ssh/sshd_config.d conf/40-ssh-key-dir.conf install -Dpm0644 -t %{buildroot}%{_sysconfdir}/ssh/sshd_config.d conf/40-ssh-key-dir.conf > if [ -x /usr/bin/systemctl ]; then > /usr/bin/systemctl try-reload-or-restart sshd.service > fi Not really happy about this one... What about %systemd_post sshd.service? Also you'll need to have Requires(post): openssh-server Probably for postun too, but not sure.
Updated. Added post/postun dependencies on systemd and openssh-server, updated install flags, and unconditionalized invocation of systemctl. > What about %systemd_post sshd.service? The %systemd_* macros don't do what we need here; in particular, %systemd_post activates a preset. Since we're adding/updating/removing an sshd_config.d fragment, we need to reload sshd to pick up the changes.
%systemd_postun_with_restart should do what you want for postun, which would happen on every upgrade. %systemd_post would run on initial install to preset.
The behavior we want is: SIGHUP sshd on initial install, SIGHUP on upgrades, and SIGHUP on removal. We use systemctl try-reload-or-restart because we want the try- behavior (don't fail if sshd isn't running); systemctl doesn't have a try-reload. %systemd_postun_with_restart does a restart rather than reload, and %systemd_post isn't useful because we don't need any presets applied. I've updated the spec to avoid reloading twice on package upgrades, and also to correctly associate the scriptlets with the subpackage. :-/
(fedscm-admin): The Pagure repository was created at https://src.fedoraproject.org/rpms/rust-ssh-key-dir