commit:     3b9f17df19b6c64674257cf039d647ed6a2b99aa
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 20 21:34:49 2018 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Jun 21 02:25:39 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3b9f17df

net-misc/openssh: move ssh{,d}_config tweaks to a sep func

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 | 44 +++++++++++++++++------------
 net-misc/openssh/openssh-7.7_p1-r5.ebuild   | 44 +++++++++++++++++------------
 2 files changed, 52 insertions(+), 36 deletions(-)

diff --git a/net-misc/openssh/openssh-7.7_p1-r101.ebuild 
b/net-misc/openssh/openssh-7.7_p1-r101.ebuild
index 69618e6b249..d330358e032 100644
--- a/net-misc/openssh/openssh-7.7_p1-r101.ebuild
+++ b/net-misc/openssh/openssh-7.7_p1-r101.ebuild
@@ -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/

diff --git a/net-misc/openssh/openssh-7.7_p1-r5.ebuild 
b/net-misc/openssh/openssh-7.7_p1-r5.ebuild
index 8ce813c89ca..cadc2109835 100644
--- a/net-misc/openssh/openssh-7.7_p1-r5.ebuild
+++ b/net-misc/openssh/openssh-7.7_p1-r5.ebuild
@@ -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/

Reply via email to