Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-integ / recipes-connectivity / openssh / openssh_7.%.bbappend
1 #
2 ## Copyright (C) 2019 Wind River Systems, Inc.
3 #
4 #  Licensed under the Apache License, Version 2.0 (the "License");
5 #  you may not use this file except in compliance with the License.
6 #  You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #  Unless required by applicable law or agreed to in writing, software
11 #  distributed under the License is distributed on an "AS IS" BASIS,
12 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #  See the License for the specific language governing permissions and
14 #  limitations under the License.
15
16 FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
17
18 inherit stx-metadata
19
20 STX_REPO = "config-files"
21 STX_SUBPATH = "openssh-config"
22
23 SRC_URI += "\
24     file://stx/sshd.init \
25     file://stx/sshd-keygen \
26     file://stx/sshd-keygen.service \
27     file://stx/sshd.sysconfig \
28     file://openssh-config-rm-hmac-ripemd160.patch \
29 "
30
31 do_unpack_append() {
32     bb.build.exec_func('do_copy_config_files', d)
33 }
34
35 do_copy_config_files () {
36     cp -f ${STX_METADATA_PATH}/files/sshd_config ${S}
37     # remove the unsupported and deprecated options
38     sed -i -e 's/^\(GSSAPIAuthentication.*\)/#\1/' \
39            -e 's/^\(GSSAPICleanupCredentials.*\)/#\1/' \
40            -e 's/^\(UsePrivilegeSeparation.*\)/#\1/' \
41            ${S}/sshd_config
42     cp -f ${STX_METADATA_PATH}/files/ssh_config ${S}
43 }
44
45 SYSTEMD_SERVICE_${PN}-sshd = "sshd.service"
46
47 do_install_append () {
48     rm -f ${D}${systemd_system_unitdir}/sshd.socket
49     rm -f ${D}${systemd_system_unitdir}/sshd@service.socket
50     rm -f ${D}${systemd_system_unitdir}/sshdgenkeys.service
51
52     install -d ${D}/${sysconfdir}/init.d/
53     install -m 755 ${WORKDIR}/stx/sshd.init ${D}/${sysconfdir}/init.d/sshd
54
55     install -d ${D}/${sysconfdir}/sysconfig/
56     install -m 644 ${WORKDIR}/stx/sshd.sysconfig ${D}/${sysconfdir}/sysconfig/sshd
57
58     install -m 755 ${WORKDIR}/stx/sshd-keygen ${D}/${sbindir}/sshd-keygen
59     install -m644 ${STX_METADATA_PATH}/files/sshd.service ${D}/${systemd_system_unitdir}/sshd.service
60     install -m644 ${WORKDIR}/stx/sshd-keygen.service ${D}/${systemd_system_unitdir}/sshd-keygen.service
61
62     install -d ${D}/${sysconfdir}/tmpfiles.d
63     echo "d ${localstatedir}/run/sshd 0755 root root -" >> ${D}/${sysconfdir}/tmpfiles.d/sshd.conf
64
65 }
66
67 RDEPENDS_${PN} += "bash"
68 RDEPENDS_${PN}-sshd += "bash"
69
70 # allow both systemd service and sysvinit scripts are installed
71 DISTRO_FEATURES_BACKFILL_CONSIDERED_remove = "sysvinit"
72
73 USERADD_PARAM_${PN}-sshd = "-r -d /var/empty/sshd -s /sbin/nologin -g sshd -c 'Privilege-separated SSH' sshd"
74 GROUPADD_PARAM_${PN}-sshd = "-r ssh_keys; -r sshd"