@@ -45,7 +45,7 @@ image_name=`docker inspect --format="{{.Config.Image}}" $container_id`
4545
4646# using bash substitution
4747# removing special chars [perhaps echo + sed would be better for other chars]
48- image_name=${image_name/ \/ / _}
48+ image_name=${image_name// \/ / _}
4949image_name=${image_name/:/ _}
5050
5151# following is the date of the container, not the docker image.
@@ -146,7 +146,14 @@ singularity exec --writable --contain $new_container_name /bin/sh -c "mkdir -p m
146146# making sure that any user can read and execute everything in the container
147147echo " (7/9) Fixing permissions..."
148148singularity exec --writable --contain $new_container_name /bin/sh -c " find /* -maxdepth 0 -not -path '/dev*' -not -path '/proc*' -not -path '/sys*' -exec chmod a+r -R '{}' \;"
149- singularity exec --writable --contain $new_container_name /bin/sh -c " find / -executable -perm -u+x,o-x -not -path '/dev*' -not -path '/proc*' -not -path '/sys*' -exec chmod a+x '{}' \;"
149+ grep -q Buildroot /etc/issue
150+ if [[ $? -eq 0 ]] ; then
151+ # we're running on a Builroot container and need to use Busybox's find
152+ echo " We're running on BusyBox/Buildroot"
153+ singularity exec --writable --contain $new_container_name /bin/sh -c " find / -type f -or -type d -perm -u+x,o-x -not -path '/dev*' -not -path '/proc*' -not -path '/sys*' -exec chmod a+x '{}' \;"
154+ else
155+ singularity exec --writable --contain $new_container_name /bin/sh -c " find / -executable -perm -u+x,o-x -not -path '/dev*' -not -path '/proc*' -not -path '/sys*' -exec chmod a+x '{}' \;"
156+ fi
150157
151158echo " (8/9) Stopping and removing the container..."
152159docker stop $container_id
0 commit comments