I'm working with a read only file system and I'm working on splitting
packages so that their config dirs are symlinked in from the persistent
data partition. But I'd like to be able to enable or disable this
optionally, so that I can still build an image with a r/w file system and a
single partition for easier development. I've got a class file with a new
task that moves config files to /data and symlinks them back, but I can't
figure out how to conditionally enable it. Ideally it'd be enabled only if
read-only-rootfs is set in IMAGE_FEATURES.

Here's the class if it helps:

ORIGINAL_FILES ??= "file1 file2..."
SYMLINK_NAMES ??= "sym1 sym2..."

do_symlink_to_data () {
    install -d ${D}/${PERSIST_DIR}

    ORIG_ARR=(${ORIGINAL_FILES})
    SYMLINK_ARR=(${SYMLINK_NAMES})

    for i in ${!ORIG_ARR[*]}; do
        ORIG=ORIG_ARR[i]
        SYMLINK=SYMLINK_ARR[i]


        mv ${D}/$ORIG ${D}/${PERSIST_DIR}/$SYMLINK
        ln -sr ${D}/${PERSIST_DIR}/$SYMLINK ${D}/$ORIG
    done
}

FILES_${PN}_append_mender-image += " ${SYMLINK_NAMES}"

addtask symlink_to_data after do_install




-- 
Tim Froehlich
Embedded Linux Engineer
tfroehl...@archsys.io
215-218-8955
-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to