Skip to content

Commit 1f0d261

Browse files
committed
updating script
Signed-off-by: Vanessa Sochat <[email protected]>
1 parent 1e9198f commit 1f0d261

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

singularity/build/main.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,7 @@ def run_build(build_dir, params, verbose=True):
111111
if not os.path.exists(template):
112112
bot.exit("Cannot find build template. Exiting.")
113113

114-
# Assemble the recipe
115-
recipe_path = os.path.join(build_dir, params['spec_file'])
116-
if not os.path.exists(recipe_path):
117-
bot.exit("Cannot find build recipe %s. Exiting." % recipe_path)
118-
119-
result = Client._run_command(["/bin/bash", template, recipe_path, "container.sif"])
114+
result = Client._run_command(["/bin/bash", template, params['spec_file'], "container.sif"])
120115
image = Client.build(recipe=params['spec_file'],
121116
build_folder=build_dir,
122117
isolated=True)

singularity/build/scripts/secure-build.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ SINGULARITY_FINAL="${2}"
88
if [ ! -f "${SINGULARITY_BUILDDEF}" ]; then
99
echo "${SINGULARITY_BUILDDEF} does not exist";
1010
exit 1;
11+
else
12+
echo "Build definition file found as ${SINGULARITY_BUILDDEF}"
1113
fi
1214

1315
SINGULARITY_confdir="/usr/local/etc/singularity"
@@ -53,10 +55,10 @@ REPO_DIR="/root/repo"
5355
STAGED_BUILD_IMAGE="/root/build"
5456

5557
# Move the repo to be the REPO_DIR
56-
cp -R $BUILDDEF_DIR $REPO_DIR
58+
cp -R $BUILDDEF_DIR/* ${SINGULARITY_WORKDIR}$REPO_DIR
5759

58-
mkdir ${SINGULARITY_WORKDIR}${REPO_DIR}
59-
mkdir ${SINGULARITY_WORKDIR}${STAGED_BUILD_IMAGE}
60+
mkdir -p ${SINGULARITY_WORKDIR}${REPO_DIR}
61+
mkdir -p ${SINGULARITY_WORKDIR}${STAGED_BUILD_IMAGE}
6062

6163
BUILD_SCRIPT="$SINGULARITY_WORKDIR/tmp/build-script"
6264
TMP_CONF_FILE="$SINGULARITY_WORKDIR/tmp.conf"
@@ -98,7 +100,7 @@ allow setuid = yes
98100
CONF
99101

100102
# We only use the builder once, make default config
101-
sudo cp "$TMP_CONF_FILE" "${SINGULARITY_confdir}/singularity.conf"
103+
cp "$TMP_CONF_FILE" "${SINGULARITY_confdir}/singularity.conf"
102104

103105
# here build pre-stage
104106
cat > "$BUILD_SCRIPT" << SCRIPT
@@ -137,5 +139,5 @@ if [ ! -f "${SINGULARITY_WORKDIR}${STAGED_BUILD_IMAGE}/container.sif" ]; then
137139
exit 1;
138140
fi
139141

140-
sudo mv "${SINGULARITY_WORKDIR}${STAGED_BUILD_IMAGE}/container.sif" "${SINGULARITY_FINAL}"
141-
sudo rm -rf $SINGULARITY_WORKDIR
142+
mv "${SINGULARITY_WORKDIR}${STAGED_BUILD_IMAGE}/container.sif" "$BUILDDEF_DIR/${SINGULARITY_FINAL}"
143+
rm -rf $SINGULARITY_WORKDIR

0 commit comments

Comments
 (0)