diff options
| -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 |
