Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Addition of add-sparse-env-var-to-agent-sv.bash
Browse files Browse the repository at this point in the history
Contributes to orange-cloudfoundry/paas-templates#2060

Still need testing

[skip ci]
  • Loading branch information
gberche-orange committed Oct 1, 2023
1 parent a21f1d9 commit 1811809
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions jobs/k3s-agent/templates/bin/add-sparse-env-var-to-agent-sv.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -x
set -e

#TODO: test whether the bosh job indeed runs as vcap, if running as root, we can remove next line
[ $(id -u) -eq 0 ] || exec sudo $0 $@

if ! grep TAR_OPTIONS /etc/sv/agent/run ; then
echo "patching /etc/sv/agent/run to inject TAR_OPTIONS as a workaround for https://github.com/orange-cloudfoundry/paas-templates/issues/2060"
# substitute 3rd line with new export
# more about this syntax at https://stackoverflow.com/a/9533736/1484823
sed -i.orig '3s/$^export TAR_OPTIONS=" --sparse "/'
#FIXME: check that the creation of a backup file /etc/sv/agent/run.orig is ignored by sv
# if not, replace -i.orig flag by -i flag
else
echo "/etc/sv/agent/run already contains TAR_OPTIONS"
fi
! diff /etc/sv/agent/run /etc/sv/agent/run.orig

0 comments on commit 1811809

Please sign in to comment.