BuildSystem: Fix file permission bits on image creation
If a file had setuid/setgid/sticky bits set, they were not copied to the sysroot
This commit is contained in:
parent
bad3b8b3e2
commit
c9355ad94a
|
@ -47,21 +47,23 @@ if sudo mount $ROOT_PARTITION $MOUNT_DIR; then
|
||||||
else
|
else
|
||||||
sudo rsync -rulHpt $BANAN_SYSROOT/ $MOUNT_DIR
|
sudo rsync -rulHpt $BANAN_SYSROOT/ $MOUNT_DIR
|
||||||
|
|
||||||
fakeroot -i $BANAN_FAKEROOT find $BANAN_SYSROOT -printf './%P|%U|%G\n' >$BANAN_BUILD_DIR/sysroot-perms.txt
|
fakeroot -i $BANAN_FAKEROOT find $BANAN_SYSROOT -printf './%P|%U|%G|%04m\n' >$BANAN_BUILD_DIR/sysroot-perms.txt
|
||||||
sudo bash -c "
|
sudo bash -c "
|
||||||
if enable stat &>/dev/null; then
|
if enable stat &>/dev/null; then
|
||||||
while IFS='|' read -r path uid gid; do
|
while IFS='|' read -r path uid gid mode; do
|
||||||
full=\"$MOUNT_DIR/\$path\"
|
full=\"$MOUNT_DIR/\$path\"
|
||||||
stat \"\$full\"
|
stat \"\$full\"
|
||||||
if [[ \${STAT[uid]} != \$uid ]] || [[ \${STAT[gid]} != \$gid ]]; then
|
if [[ \${STAT[uid]} != \$uid ]] || [[ \${STAT[gid]} != \$gid ]] || [[ \${STAT[perms]} != \$mode ]]; then
|
||||||
chown -h \"\$uid:\$gid\" \"\$full\"
|
chown -h \"\$uid:\$gid\" \"\$full\"
|
||||||
|
chmod -h \"\$mode\" \"\$full\"
|
||||||
fi
|
fi
|
||||||
done <$BANAN_BUILD_DIR/sysroot-perms.txt
|
done <$BANAN_BUILD_DIR/sysroot-perms.txt
|
||||||
else
|
else
|
||||||
while IFS='|' read -r path uid gid; do
|
while IFS='|' read -r path uid gid mode; do
|
||||||
full=\"$MOUNT_DIR/\$path\"
|
full=\"$MOUNT_DIR/\$path\"
|
||||||
if [[ \$(stat -c '%u %g' \"\$full\") != \"\$uid \$gid\" ]]; then
|
if [[ \$(stat -c '%u %g %a' \"\$full\") != \"\$uid \$gid \$mode\" ]]; then
|
||||||
chown -h \"\$uid:\$gid\" \"\$full\"
|
chown -h \"\$uid:\$gid\" \"\$full\"
|
||||||
|
chmod -h \"\$mode\" \"\$full\"
|
||||||
fi
|
fi
|
||||||
done <$BANAN_BUILD_DIR/sysroot-perms.txt
|
done <$BANAN_BUILD_DIR/sysroot-perms.txt
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue