From 237edebe4170db9a22e4d14a65120e8a627bab14 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Sat, 25 Apr 2020 23:36:46 +0000 Subject: image_types_ostree/ota: move home physically to /var/rootdirs/home Instead of using the double indirection mode /home -> /var/rootdirs/home -> /sysroot/home move the home directory physically into /var/rootdirs. This allows to use the --modern flag when initializing the file system. The "old" style is still supported, and does make sense in case the home directories need to be shared between multiple deployments. Since multiple deployments is not a use case in meta-updater use the /var approach. See also: https://github.com/ostreedev/ostree/issues/2085. The modern flag also gets rid of dev, proc, root, run, sys and tmp. All of them have been empty and unused. Note: This change cannot be pushed through updates as this is an initial deployment setting. Only devices provisioned with images built with this change applied will use the new layout. Updates will continue to work on both systems as the symlink from the deployment stays the same (first indirection is still /home -> /var/rootdirs/home). Signed-off-by: Stefan Agner --- classes/image_types_ostree.bbclass | 2 -- classes/image_types_ota.bbclass | 7 +++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 95035e2..7cc4baa 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -55,13 +55,11 @@ IMAGE_CMD_ostree () { mkdir -p usr/etc/tmpfiles.d tmpfiles_conf=usr/etc/tmpfiles.d/00ostree-tmpfiles.conf echo "d /var/rootdirs 0755 root root -" >>${tmpfiles_conf} - echo "L /var/rootdirs/home - - - - /sysroot/home" >>${tmpfiles_conf} else mkdir -p usr/etc/init.d tmpfiles_conf=usr/etc/init.d/tmpfiles.sh echo '#!/bin/sh' > ${tmpfiles_conf} echo "mkdir -p /var/rootdirs; chmod 755 /var/rootdirs" >> ${tmpfiles_conf} - echo "ln -sf /sysroot/home /var/rootdirs/home" >> ${tmpfiles_conf} ln -s ../init.d/tmpfiles.sh usr/etc/rcS.d/S20tmpfiles.sh fi diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index 8f5a01a..374ddc2 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass @@ -45,7 +45,7 @@ do_image_ota[cleandirs] = "${OTA_SYSROOT}" do_image_ota[depends] = "${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER') == 'grub' else ''} \ ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER') == 'u-boot' else ''}" IMAGE_CMD_ota () { - ostree admin --sysroot=${OTA_SYSROOT} init-fs ${OTA_SYSROOT} + ostree admin --sysroot=${OTA_SYSROOT} init-fs --modern ${OTA_SYSROOT} ostree admin --sysroot=${OTA_SYSROOT} os-init ${OSTREE_OSNAME} # Preparation required to steer ostree bootloader detection @@ -81,7 +81,10 @@ IMAGE_CMD_ota () { chmod 700 ${OTA_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota cp -a ${IMAGE_ROOTFS}/var/local ${OTA_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/ || true - cp -a ${IMAGE_ROOTFS}/home ${OTA_SYSROOT}/ || true + + mkdir -p ${OTA_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/rootdirs + cp -a ${IMAGE_ROOTFS}/home ${OTA_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/rootdirs/home || true + # Ensure that /var/local exists (AGL symlinks /usr/local to /var/local) install -d ${OTA_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/local # Set package version for the first deployment -- cgit v1.2.3-54-g00ecf