@@ -44,8 +44,9 @@ function usage() {
4444
4545 Image Format
4646 --folder -f build development sandbox (folder)
47+ --option -o add a custom option to build (-o --fakeroot or -option 'section post' )
4748 --writable -w non-production writable image (ext3)
48- Default is squashfs (recommended)
49+ Default is squashfs (recommended) (deprecated)
4950 --name -n provide basename for the container (default based on URI)
5051 --mount -m provide list of custom mount points (in quotes!)
5152 --help -h show this help and exit
6162mount_points=" /oasis /projects /scratch /local-scratch /work /home1 /corral-repl /corral-tacc /beegfs /share/PI /extra /data /oak"
6263image_format=" squashfs"
6364new_container_name=" "
65+ options=" "
6466
6567while true ; do
6668 case ${1:- } in
@@ -78,15 +80,18 @@ while true; do
7880 mount_points=" ${1:- } "
7981 shift
8082 ;;
83+ -o|--option)
84+ shift
85+ options=" ${1:- } ${options} "
86+ shift
87+ ;;
8188 -f|--folder)
8289 shift
8390 image_format=" sandbox"
84- shift
8591 ;;
8692 -w|--writable)
8793 shift
8894 image_format=" writable"
89- shift
9095 ;;
9196 :) printf " missing argument for -%s\n" " $option " >&2
9297 usage
@@ -107,7 +112,7 @@ while true; do
107112 esac
108113done
109114
110- image=$1
115+ image=${1}
111116
112117echo " "
113118echo " Image Format: ${image_format} "
@@ -313,11 +318,11 @@ docker rm $container_id >> /dev/null
313318# Build a final image from the sandbox
314319echo " (9/10) Building ${image_format} container..."
315320if [ " $image_format " == " squashfs" ]; then
316- new_container_name=${new_container_name} .simg
317- singularity build ${new_container_name} $build_sandbox
321+ new_container_name=${new_container_name} .sif
322+ singularity build ${options} ${ new_container_name} $build_sandbox
318323elif [ " $image_format " == " writable" ]; then
319- new_container_name=${new_container_name} .img
320- singularity build --writable ${new_container_name} $build_sandbox
324+ new_container_name=${new_container_name} .simg
325+ singularity build ${options} --writable ${new_container_name} $build_sandbox
321326else
322327 mv $build_sandbox $new_container_name
323328fi
0 commit comments