File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -44,8 +44,21 @@ cp ${ALIEN_KEYFILE} ${WORK_DIR}/userkey.pem
4444
4545echo " JALIEN_TOKEN_CERT=/workdir/usercert.pem" > ${WORK_DIR} /envfile
4646echo " JALIEN_TOKEN_KEY=/workdir/userkey.pem" >> ${WORK_DIR} /envfile
47+ if [ " ${GRID_CVMFS_PACKAGE} " ]; then
48+ echo " GRID_CVMFS_PACKAGE=${GRID_CVMFS_PACKAGE} " >> ${WORK_DIR} /envfile
49+ fi
50+
51+ # load a CVMFS package if we are asked to do so -- but do it as part of the job
52+ LOADER=' if [ "${GRID_CVMFS_PACKAGE}" ]; then
53+ /cvmfs/alice.cern.ch/bin/alienv printenv ${GRID_CVMFS_PACKAGE} > cvmfs_env
54+ source cvmfs_env
55+ fi'
56+ # Inject the block after the first line (shebang)
57+ JOBSCRIPT=${WORK_DIR} /job.sh
58+ awk -v block=" $LOADER " ' NR==1 {print; print block; next} 1' " $JOBSCRIPT " > tmpfile && mv tmpfile " $JOBSCRIPT "
59+ chmod +x " ${JOBSCRIPT} "
4760
4861# launch job = script inside the container in the workdir
49- APPTAINER_EXEC=" /cvmfs/alice.cern.ch/containers/bin/apptainer/${ARCH} /current/bin/apptainer"
50- ${APPTAINER_EXEC} exec -C -B /cvmfs:/cvmfs,${WORK_DIR} :/workdir \
62+ APPTAINER_EXEC=${APPTAINER_EXEC :- " /cvmfs/alice.cern.ch/containers/bin/apptainer/${ARCH} /current/bin/apptainer" }
63+ ${APPTAINER_SUDO : +sudo} ${ APPTAINER_EXEC} exec -C -B /cvmfs:/cvmfs,${WORK_DIR} :/workdir \
5164 --pwd /workdir --env-file ${WORK_DIR} /envfile ${APPTAINER_CONTAINER} /workdir/job.sh
You can’t perform that action at this time.
0 commit comments