Copy custom airootfs files with correct permissions and ownership
_make_custom_airootfs copies airootfs files from the profile directory to the working directory using
cp -af --no-preserve=ownership.
- Since the script is run as root, root becomes the owner of all files. This is an issue for custom files that should not be root owned, like those in user home directories. That's why a
chownis used to fix it.
- File permissions on the system where
mkarchisoruns affect the permissions of the files in the resulting airootfs. This can be observed by setting
umask 0027before cloning archiso git repo or before copying a profile from
/usr/share/archiso/configs/*. For a few files like
/etc/gshadow, this is corrected with
Both of these things are ugly and I want to get rid of them. That requires some way to specify user and group ownership, and permissions when copying. My idea is to create a
airootfs.filelist in the profile directory which would list the UID, GID, mode and file name of each and every file in the custom
airootfs directory. E.g., something like this:
Listed files would then be copied using
install by going over this list.
_make_customize_airootfs also has a
cp command (
cp -RdT --preserve=mode,timestamps,links), but that preserves permissions and timestamps while copying files withing the confines of airootfs. Since
install cannot preserve permissions, it sadly cannot be used.
Now, the problem is the
airootfs.filelist file format. File paths can contain any character except NUL. That means entries cannot be newline separated, but using NUL as a separator will make the file hard to read and edit.