net-misc/openssh: move ssh{,d}_config tweaks to a sep func
authorMike Frysinger <vapier@gentoo.org>
Wed, 20 Jun 2018 21:34:49 +0000 (17:34 -0400)
committerMike Frysinger <vapier@gentoo.org>
Thu, 21 Jun 2018 02:25:39 +0000 (22:25 -0400)
No functional changes here.  Should make managing src_install easier
as all the sshd_config/ssh_config changes are kept separate.

net-misc/openssh/openssh-7.7_p1-r101.ebuild
net-misc/openssh/openssh-7.7_p1-r5.ebuild

index 69618e6b249c3772c6878638293a092e81e2458d..d330358e032daf4fc136adfc6a2f122795a7c0a1 100644 (file)
@@ -328,40 +328,48 @@ src_test() {
        [[ ${#failed[@]}  -gt 0 ]] && die "Some tests failed: ${failed[*]}"
 }
 
-src_install() {
-       emake install-nokeys DESTDIR="${D}"
-       fperms 600 /etc/ssh/sshd_config
-       dobin contrib/ssh-copy-id
-       newinitd "${FILESDIR}"/sshd.rc6.5 sshd
-       newconfd "${FILESDIR}"/sshd-r1.confd sshd
-
-       newpamd "${FILESDIR}"/sshd.pam_include.2 sshd
-       if use pam ; then
-               sed -i \
-                       -e "/^#UsePAM /s:.*:UsePAM yes:" \
-                       -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \
-                       -e "/^#PrintMotd /s:.*:PrintMotd no:" \
-                       -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \
-                       "${ED%/}"/etc/ssh/sshd_config || die
-       fi
-
-       # Gentoo tweaks to default config files
+# Gentoo tweaks to default config files.
+tweak_ssh_configs() {
+       # First the server config.
        cat <<-EOF >> "${ED%/}"/etc/ssh/sshd_config
 
        # Allow client to pass locale environment variables #367017
        AcceptEnv LANG LC_*
        EOF
+
+       # Then the client config.
        cat <<-EOF >> "${ED%/}"/etc/ssh/ssh_config
 
        # Send locale environment variables #367017
        SendEnv LANG LC_*
        EOF
 
+       if use pam ; then
+               sed -i \
+                       -e "/^#UsePAM /s:.*:UsePAM yes:" \
+                       -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \
+                       -e "/^#PrintMotd /s:.*:PrintMotd no:" \
+                       -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \
+                       "${ED%/}"/etc/ssh/sshd_config || die
+       fi
+
        if use livecd ; then
                sed -i \
                        -e '/^#PermitRootLogin/c# Allow root login with password on livecds.\nPermitRootLogin Yes' \
                        "${ED%/}"/etc/ssh/sshd_config || die
        fi
+}
+
+src_install() {
+       emake install-nokeys DESTDIR="${D}"
+       fperms 600 /etc/ssh/sshd_config
+       dobin contrib/ssh-copy-id
+       newinitd "${FILESDIR}"/sshd.rc6.5 sshd
+       newconfd "${FILESDIR}"/sshd-r1.confd sshd
+
+       newpamd "${FILESDIR}"/sshd.pam_include.2 sshd
+
+       tweak_ssh_configs
 
        if use ldap && [[ -n ${LDAP_PATCH} ]] ; then
                insinto /etc/openldap/schema/
index 8ce813c89ca3d900d4432f30e23aa3a97fecb7ec..cadc2109835461e21e5541e75fa7a440c5a7bcb4 100644 (file)
@@ -328,40 +328,48 @@ src_test() {
        [[ ${#failed[@]}  -gt 0 ]] && die "Some tests failed: ${failed[*]}"
 }
 
-src_install() {
-       emake install-nokeys DESTDIR="${D}"
-       fperms 600 /etc/ssh/sshd_config
-       dobin contrib/ssh-copy-id
-       newinitd "${FILESDIR}"/sshd.rc6.5 sshd
-       newconfd "${FILESDIR}"/sshd-r1.confd sshd
-
-       newpamd "${FILESDIR}"/sshd.pam_include.2 sshd
-       if use pam ; then
-               sed -i \
-                       -e "/^#UsePAM /s:.*:UsePAM yes:" \
-                       -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \
-                       -e "/^#PrintMotd /s:.*:PrintMotd no:" \
-                       -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \
-                       "${ED%/}"/etc/ssh/sshd_config || die
-       fi
-
-       # Gentoo tweaks to default config files
+# Gentoo tweaks to default config files.
+tweak_ssh_configs() {
+       # First the server config.
        cat <<-EOF >> "${ED%/}"/etc/ssh/sshd_config
 
        # Allow client to pass locale environment variables #367017
        AcceptEnv LANG LC_*
        EOF
+
+       # Then the client config.
        cat <<-EOF >> "${ED%/}"/etc/ssh/ssh_config
 
        # Send locale environment variables #367017
        SendEnv LANG LC_*
        EOF
 
+       if use pam ; then
+               sed -i \
+                       -e "/^#UsePAM /s:.*:UsePAM yes:" \
+                       -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \
+                       -e "/^#PrintMotd /s:.*:PrintMotd no:" \
+                       -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \
+                       "${ED%/}"/etc/ssh/sshd_config || die
+       fi
+
        if use livecd ; then
                sed -i \
                        -e '/^#PermitRootLogin/c# Allow root login with password on livecds.\nPermitRootLogin Yes' \
                        "${ED%/}"/etc/ssh/sshd_config || die
        fi
+}
+
+src_install() {
+       emake install-nokeys DESTDIR="${D}"
+       fperms 600 /etc/ssh/sshd_config
+       dobin contrib/ssh-copy-id
+       newinitd "${FILESDIR}"/sshd.rc6.5 sshd
+       newconfd "${FILESDIR}"/sshd-r1.confd sshd
+
+       newpamd "${FILESDIR}"/sshd.pam_include.2 sshd
+
+       tweak_ssh_configs
 
        if use ldap && [[ -n ${LDAP_PATCH} ]] ; then
                insinto /etc/openldap/schema/