commit 80b694c974a91889c6c0187ce5e82818d52a2925
parent c956a2dbb2ab4ae3e253d7249afc7e69e37ddea0
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Sat, 6 Sep 2025 13:01:20 +0200
git-publish: modify permission rules on copied resources
Ensure that once deployed, resources comply with umask rules. To deploy
resources, use cat rather than cp, which uses the permissions of the
original file in preference to umask, which only takes effect if its
permissions are more restrictive than those of the source file.
Diffstat:
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/git-publish b/git-publish
@@ -47,17 +47,30 @@ synopsis()
check_resources() # path
{
+ # Copy resources using the cat command rather than cp to ensure
+ # that the file is created in accordance with the umask settings.
+ #
+ # The cp command creates destination files with the original
+ # permissions, to which the umask permissions are ultimately added.
+ # The umask therefore only has an impact if it is more restrictive
+ # than that of the original file.
+ #
+ # However, the umask should take precedence here, as the destination
+ # directory may require write access for the group so that its members
+ # can update its contents. These access rights are managed through
+ # the umask, which cp would ignore.
+
if [ ! -e "$1/favicon.png" ]; then
# Make the favicon from the logo
- cp -L "${GIT_PUBLISH_RESOURCES_PATH}/logo.png" "$1/favicon.png"
+ cat "${GIT_PUBLISH_RESOURCES_PATH}/logo.png" > "$1/favicon.png"
fi
if [ ! -e "$1/logo.png" ]; then
- cp -L "${GIT_PUBLISH_RESOURCES_PATH}/logo.png" "$1/logo.png"
+ cat "${GIT_PUBLISH_RESOURCES_PATH}/logo.png" > "$1/logo.png"
fi
if [ ! -e "$1style.css" ]; then
- cp -L "${GIT_PUBLISH_RESOURCES_PATH}/style.css" "$1/style.css"
+ cat "${GIT_PUBLISH_RESOURCES_PATH}/style.css" > "$1/style.css"
fi
}