diff options
author | Alexander Kanavin <alexander.kanavin@linux.intel.com> | 2015-09-30 15:53:15 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-10-01 07:43:36 +0100 |
commit | 006497e36a78dd184457330a3d9c67f9dad6e3bb (patch) | |
tree | 55a4854acf730a8da1f459da54a2768426a2bd58 /meta | |
parent | f1e25150ef0c4e13b73bf05085fd296b3fd483af (diff) | |
download | poky-006497e36a78dd184457330a3d9c67f9dad6e3bb.tar.gz |
image.bbclass: when building a readonly rootfs, tweak ssh settings regardless of init system in use
Previously it was done only if sysvinit was in DISTRO_FEATURES.
(From OE-Core rev: 8aa5c66a29c1394e0418e94bdd49e5b268ffc790)
Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/image.bbclass | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 7e6822cac5..9fbdce583c 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass | |||
@@ -239,6 +239,18 @@ read_only_rootfs_hook () { | |||
239 | # Tweak the mount option and fs_passno for rootfs in fstab | 239 | # Tweak the mount option and fs_passno for rootfs in fstab |
240 | sed -i -e '/^[#[:space:]]*\/dev\/root/{s/defaults/ro/;s/\([[:space:]]*[[:digit:]]\)\([[:space:]]*\)[[:digit:]]$/\1\20/}' ${IMAGE_ROOTFS}/etc/fstab | 240 | sed -i -e '/^[#[:space:]]*\/dev\/root/{s/defaults/ro/;s/\([[:space:]]*[[:digit:]]\)\([[:space:]]*\)[[:digit:]]$/\1\20/}' ${IMAGE_ROOTFS}/etc/fstab |
241 | 241 | ||
242 | # If we're using openssh and the /etc/ssh directory has no pre-generated keys, | ||
243 | # we should configure openssh to use the configuration file /etc/ssh/sshd_config_readonly | ||
244 | # and the keys under /var/run/ssh. | ||
245 | if [ -d ${IMAGE_ROOTFS}/etc/ssh ]; then | ||
246 | if [ -e ${IMAGE_ROOTFS}/etc/ssh/ssh_host_rsa_key ]; then | ||
247 | echo "SYSCONFDIR=/etc/ssh" >> ${IMAGE_ROOTFS}/etc/default/ssh | ||
248 | echo "SSHD_OPTS=" >> ${IMAGE_ROOTFS}/etc/default/ssh | ||
249 | else | ||
250 | echo "SYSCONFDIR=/var/run/ssh" >> ${IMAGE_ROOTFS}/etc/default/ssh | ||
251 | echo "SSHD_OPTS='-f /etc/ssh/sshd_config_readonly'" >> ${IMAGE_ROOTFS}/etc/default/ssh | ||
252 | fi | ||
253 | fi | ||
242 | if ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "true", "false", d)}; then | 254 | if ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "true", "false", d)}; then |
243 | # Change the value of ROOTFS_READ_ONLY in /etc/default/rcS to yes | 255 | # Change the value of ROOTFS_READ_ONLY in /etc/default/rcS to yes |
244 | if [ -e ${IMAGE_ROOTFS}/etc/default/rcS ]; then | 256 | if [ -e ${IMAGE_ROOTFS}/etc/default/rcS ]; then |
@@ -249,18 +261,6 @@ read_only_rootfs_hook () { | |||
249 | if [ -x ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh ]; then | 261 | if [ -x ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh ]; then |
250 | ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh | 262 | ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh |
251 | fi | 263 | fi |
252 | # If we're using openssh and the /etc/ssh directory has no pre-generated keys, | ||
253 | # we should configure openssh to use the configuration file /etc/ssh/sshd_config_readonly | ||
254 | # and the keys under /var/run/ssh. | ||
255 | if [ -d ${IMAGE_ROOTFS}/etc/ssh ]; then | ||
256 | if [ -e ${IMAGE_ROOTFS}/etc/ssh/ssh_host_rsa_key ]; then | ||
257 | echo "SYSCONFDIR=/etc/ssh" >> ${IMAGE_ROOTFS}/etc/default/ssh | ||
258 | echo "SSHD_OPTS=" >> ${IMAGE_ROOTFS}/etc/default/ssh | ||
259 | else | ||
260 | echo "SYSCONFDIR=/var/run/ssh" >> ${IMAGE_ROOTFS}/etc/default/ssh | ||
261 | echo "SSHD_OPTS='-f /etc/ssh/sshd_config_readonly'" >> ${IMAGE_ROOTFS}/etc/default/ssh | ||
262 | fi | ||
263 | fi | ||
264 | fi | 264 | fi |
265 | 265 | ||
266 | if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then | 266 | if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then |