Skip to content

Commit

Permalink
cmdlib: support statoverride file in root of an overlay.d directory
Browse files Browse the repository at this point in the history
If an overlay.d directory contains a file called "statoverride" at the
root, pass it to ostree.  This allows overlay files to have permission
bits that aren't tracked by Git.

statoverride files don't support comments.  For convenience, filter out
lines starting with "#".
  • Loading branch information
bgilbert authored and jlebon committed Jul 16, 2021
1 parent 0830918 commit 7f275ca
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,26 @@ prepare_build() {
}

commit_overlay() {
local name path respath
local name path respath ovrsrc ovrrelsrc
name=$1
path=$2
respath=$(realpath "${path}")
# Apply statoverrides from a file in the root of the overlay, which may
# or may not exist. ostree doesn't support comments in statoverride
# files, but we do.
if [ -e "${respath}/statoverride" ]; then
ovrsrc="${respath}/statoverride"
ovrrelsrc=/statoverride
else
ovrsrc=/dev/null
ovrrelsrc=
fi
echo -n "Committing ${name}: ${path} ... "
ostree commit --repo="${tmprepo}" --tree=dir="${respath}" -b "${name}" \
--owner-uid 0 --owner-gid 0 --no-xattrs --no-bindings --parent=none \
--mode-ro-executables --timestamp "${git_timestamp}"
--mode-ro-executables --timestamp "${git_timestamp}" \
--statoverride <(sed -e '/^#/d' "$ovrsrc") \
--skip-list <(echo "$ovrrelsrc")
}

# Implement support for automatic local overrides:
Expand Down

0 comments on commit 7f275ca

Please sign in to comment.