diff options
author | Ming Liu <peter.x.liu@external.atlascopco.com> | 2017-07-28 16:04:27 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-30 08:45:12 +0100 |
commit | 0ae4c1eeb1a70bae324347445895c7d312cf503d (patch) | |
tree | d91c397a03ff6d5bc2a2a82fcee9334e7f895c7d | |
parent | e5ba124b01ff6883a08c91daa47343dd09f6260d (diff) | |
download | openembedded-core-0ae4c1eeb1a70bae324347445895c7d312cf503d.tar.gz openembedded-core-0ae4c1eeb1a70bae324347445895c7d312cf503d.tar.bz2 openembedded-core-0ae4c1eeb1a70bae324347445895c7d312cf503d.zip |
rootfsdebugfiles.bbclass: add a optional parameter to choose file mode
This is in case that sometimes the copied target files might be
expected to have a desired mode, for instance, the ssh keys should not
be too open, otherwise the users will get a "Permission denied" error.
Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/rootfsdebugfiles.bbclass | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/meta/classes/rootfsdebugfiles.bbclass b/meta/classes/rootfsdebugfiles.bbclass index a558871e99..e2ba4e3647 100644 --- a/meta/classes/rootfsdebugfiles.bbclass +++ b/meta/classes/rootfsdebugfiles.bbclass @@ -15,6 +15,10 @@ # ROOTFS_DEBUG_FILES += "${TOPDIR}/conf/dropbear_rsa_host_key ${IMAGE_ROOTFS}/etc/dropbear/dropbear_rsa_host_key ;" # 2. Boot the image once, copy the dropbear_rsa_host_key from # the device into your build conf directory. +# 3. A optional parameter can be used to set file mode +# of the copied target, for instance: +# ROOTFS_DEBUG_FILES += "${TOPDIR}/conf/dropbear_rsa_host_key ${IMAGE_ROOTFS}/etc/dropbear/dropbear_rsa_host_key 0600;" +# in case they might be required to have a specific mode. (Shoundn't be too open, for example) # # Do not use for production images! It bypasses several # core build mechanisms (updating the image when one @@ -27,10 +31,11 @@ ROOTFS_DEBUG_FILES[doc] = "Lists additional files or directories to be installed ROOTFS_POSTPROCESS_COMMAND += "rootfs_debug_files ;" rootfs_debug_files () { #!/bin/sh -e - echo "${ROOTFS_DEBUG_FILES}" | sed -e 's/;/\n/g' | while read source target; do + echo "${ROOTFS_DEBUG_FILES}" | sed -e 's/;/\n/g' | while read source target mode; do if [ -e "$source" ]; then mkdir -p $(dirname $target) cp -a $source $target + [ -n "$mode" ] && chmod $mode $target fi done } |