Skip to content

Commit f5a834a

Browse files
committed
fix: use find instead of hardcoded gem paths for rootless patches
1 parent 8af527d commit f5a834a

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

openvoxserver/Containerfile.alpine

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,14 @@ RUN for d in \
223223
RUN sed -i 's/^ *USER="puppet"/USER=""/' /etc/default/puppetserver
224224
# `puppetserver setup` forces symlinking the "old" cadir to the "new" one for puppet 6 compatibility
225225
# reasons. this won't work because after creating a link ruby tries to call chown
226-
RUN sed -i '/Puppetserver::Ca::Utils::Config\.symlink_to_old_cadir/ s/^/# /' \
227-
/usr/lib/ruby/gems/3.4.0/gems/openvoxserver-ca-3.0.0/lib/puppetserver/ca/action/setup.rb
226+
RUN find /usr/lib/ruby/gems -name setup.rb \
227+
-path '*/openvoxserver-ca-*/lib/puppetserver/ca/action/*' \
228+
-exec sed -i '/Puppetserver::Ca::Utils::Config\.symlink_to_old_cadir/ s/^/# /' {} +
228229
# `FileUtils.chown` calls fail in rootless containers because the process
229230
# lacks CAP_CHOWN. The ownership is already handled by the g=u / SGID pattern above.
230-
RUN sed -i 's/FileUtils\.chown/# FileUtils.chown/' \
231-
/usr/lib/ruby/gems/3.4.0/gems/openvoxserver-ca-3.0.0/lib/puppetserver/ca/utils/file_system.rb
231+
RUN find /usr/lib/ruby/gems -name file_system.rb \
232+
-path '*/openvoxserver-ca-*/lib/puppetserver/ca/utils/*' \
233+
-exec sed -i 's/FileUtils\.chown/# FileUtils.chown/' {} +
232234
# `install --owner/--group` in the foreground script requires CAP_CHOWN which
233235
# is not available in rootless containers. Replace with a simple touch + chmod.
234236
RUN sed -i 's|printf.*install -D --owner.*restartfile.*|touch "$restartfile" \&\& chmod 0644 "$restartfile"|' \

0 commit comments

Comments
 (0)