Community
cancel
Showing results for 
Search instead for 
Did you mean: 
MLeis4
Novice
1,258 Views

/home creation in post_install.sh (permissions/attributes)

I've found the mirroring/creating of /home on edison/yocto to be unusual to say the least.

When changing permissions in /home in the flash image (and creating account in early first boot), I "noticed" the permissions didn't change -- and the dates were all "current"

Digging into this, I noticed in post_install.sh theres:

if [ "$ota_done" != "1" ];

 

then

 

# backup initial /home/root directory

 

mkdir /tmp/oldhome

 

cp -R /home/* /tmp/oldhome/

 

fi_assert $? "Backup home/root contents of rootfs"

# format partition home to ext4

 

mkfs.ext4 -m0 /dev/disk/by-partlabel/home

 

fi_assert $? "Formatting home partition"

# mount home partition

 

mount_home

# copy back contents to /home and cleanup

 

cp -R /tmp/oldhome/* /home/

 

rm -rf /tmp/oldhome

 

fi_assert $? "Restore home/root contents on new /home partition"

Instead of cp -R it should use cp -a (perserve attributes/permissions recursively)

In addition, it makes an extra copy -- why not mount home someplace else, copy (actually should it move?) and then remount home.

marty

0 Kudos
2 Replies
idata
Community Manager
40 Views

Hello martyl,

 

 

Thank you for sharing that information with the community. I personally have never had any issues with post_build.sh, nevertheless, this information might be of much help for other users.

 

 

We really appreciate you help.

 

-Peter.
MLeis4
Novice
40 Views

This was a problem in correct ownship/permissions in /home.

This seems to fix the problem:

diff --git a/meta-intel-edison/meta-intel-edison-distro/recipes-core/post-install/files/post-install.sh b/meta-intel-edison/meta-intel-edison-distro/recipes-core/post-install/files/post-install.sh

index 0d24d06..96a3ffe 100644

--- a/meta-intel-edison/meta-intel-edison-distro/recipes-core/post-install/files/post-install.sh

+++ b/meta-intel-edison/meta-intel-edison-distro/recipes-core/post-install/files/post-install.sh

@@ -158,7 +158,7 @@ if [ "$ota_done" != "1" ];

then

# backup initial /home/root directory

mkdir /tmp/oldhome

- cp -R /home/* /tmp/oldhome/

+ cp -a /home/* /tmp/oldhome/

fi_assert $? "Backup home/root contents of rootfs"

# format partition home to ext4

@@ -169,7 +169,7 @@ then

mount_home

# copy back contents to /home and cleanup

- cp -R /tmp/oldhome/* /home/

+ cp -a /tmp/oldhome/* /home/

rm -rf /tmp/oldhome

fi_assert $? "Restore home/root contents on new /home partition"

Reply