mirror of
https://github.com/nchevsky/systemrescue-zfs.git
synced 2025-12-06 07:12:01 +01:00
easy way to use squashfs pseudofile: allows to override mode uid gid of files in the SRM
When using a non-root user to execute sysrescue-customize with the srm building function, you won't have the rights to create files owned by root. When you want to keep the build_into_srm dir in a git tree, you won't be able to store the file mode there. But using a specific file mode is important for example for /root/.ssh The mksquashfs pseudo file allows to solve this by overriding individual file modes like this: cat <<EOF >recipe_dir/build_into_srm/.squashfs-pseudo /root/.ssh m 700 root root /root/.ssh/authorized_keys m 600 root root EOF
This commit is contained in:
parent
5c7608d7e4
commit
048c1724bf
|
|
@ -506,16 +506,28 @@ create_srm()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local squashfs_options=""
|
local squashfs_options=""
|
||||||
|
local squashfs_exclude=""
|
||||||
|
|
||||||
|
# did the user specify a "pseudo-file"? a list with mode, uid, gid etc. overrides for files
|
||||||
|
if [[ -f "${SRM_DIR}/.squashfs-pseudo" ]]; then
|
||||||
|
squashfs_options+=" -pf \"${SRM_DIR}/.squashfs-pseudo\" "
|
||||||
|
|
||||||
|
# exclude the pseudeo file from the filesystem
|
||||||
|
squashfs_exclude+=" -e .squashfs-pseudo"
|
||||||
|
fi
|
||||||
|
|
||||||
# load options for the mksquashfs call from options file
|
# load options for the mksquashfs call from options file
|
||||||
if [[ -f "${SRM_DIR}/.squashfs-options" ]]; then
|
if [[ -f "${SRM_DIR}/.squashfs-options" ]]; then
|
||||||
# strip comment lines, replace newlines with spaces to allow using multiple lines easily
|
# strip comment lines, replace newlines with spaces to allow using multiple lines easily
|
||||||
squashfs_options=$(cat "${SRM_DIR}/.squashfs-options" | grep -v "^#" | tr '\n' ' ')
|
squashfs_options+=$(cat "${SRM_DIR}/.squashfs-options" | grep -v "^#" | tr '\n' ' ')
|
||||||
|
|
||||||
# exclude the options file from the filesystem
|
# exclude the options file from the filesystem
|
||||||
# excludes must come after other options, so add it after the content of the options file
|
squashfs_exclude+=" -e .squashfs-options"
|
||||||
squashfs_options+=" -e .squashfs-options"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# excludes must come after all other options
|
||||||
|
squashfs_options+="$squashfs_exclude"
|
||||||
|
|
||||||
# prepare the directory options to be correctly quoted for eval
|
# prepare the directory options to be correctly quoted for eval
|
||||||
local dir_options="\"${SRM_DIR}\" \"${DEST_SRM}\""
|
local dir_options="\"${SRM_DIR}\" \"${DEST_SRM}\""
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue