Skip to content

Commit e4436ec

Browse files
committed
try to bind mount host's /cvmfs
1 parent 2a00c2f commit e4436ec

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

bot/build.sh

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,16 @@ else
233233
REMOVAL_STEP_ARGS+=("--save" "${TARBALL_TMP_REMOVAL_STEP_DIR}")
234234
REMOVAL_STEP_ARGS+=("--storage" "${STORAGE}")
235235

236-
# add fakeroot option in order to be able to remove software, see:
237-
# https://github.com/EESSI/software-layer/issues/312
238-
REMOVAL_STEP_ARGS+=("--fakeroot")
236+
if [[ -d /cvmfs/${REPOSITORY_NAME} ]]; then
237+
REMOVAL_SCRIPT_ARGS+=("--dryrun")
238+
elif grep -q 'CONFIG_USER_NS=y' /boot/config-$(uname -r); then
239+
# add fakeroot option in order to be able to remove software, see:
240+
# https://github.com/EESSI/software-layer/issues/312
241+
REMOVAL_STEP_ARGS+=("--fakeroot")
242+
else
243+
#ERROR!
244+
exit 1
245+
fi
239246

240247
# create tmp file for output of removal step
241248
removal_outerr=$(mktemp remove.outerr.XXXX)
@@ -250,6 +257,21 @@ else
250257
# this is important, as otherwise the removed software will still be there
251258
REMOVAL_TMPDIR=$(grep ' as tmp directory ' ${removal_outerr} | cut -d ' ' -f 2)
252259
BUILD_STEP_ARGS+=("--resume" "${REMOVAL_TMPDIR}")
260+
261+
if [[ -d /cvmfs/${REPOSITORY_NAME} ]]; then
262+
remove_sw_dirs=$(grep "^TO BE REMOVED: " ${removal_outerr} | sed 's/TO BE REMOVED: //')
263+
bind_mounts_sw_dirs=""
264+
for swdir in $remove_sw_dirs; do
265+
overlay_swdir=${STORAGE}/${REPOSITORY_NAME}/overlay-upper/${swdir#/cvmfs/${REPOSITORY_NAME}/}
266+
mkdir -p ${overlay_swdir}
267+
if [[ -z ${bind_mounts_sw_dirs} ]]; then
268+
bind_mounts_sw_dirs="${overlay_swdir:${swdir}"
269+
else
270+
bind_mounts_sw_dirs="${overlay_swdir:${swdir}:${bind_mounts_sw_dirs}"
271+
fi
272+
done
273+
BUILD_STEP_ARGS+=("--extra-bind-paths" "${bind_mounts_sw_dirs}")
274+
fi
253275
fi
254276
255277
# prepare directory to store tarball of tmp for build step

0 commit comments

Comments
 (0)