Skip to content

Commit 04c465d

Browse files
authored
Merge pull request #19 from jdidion/patch-1
Extend fix for #10 to Alpine as well as Busybox
2 parents c856128 + d523361 commit 04c465d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docker2singularity.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,15 @@ fi
174174
# making sure that any user can read and execute everything in the container
175175
echo "(7/9) Fixing permissions..."
176176
singularity 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 '{}' \;"
177-
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 '{}' \;"
177+
buildname=$(head -n 1 /etc/issue)
178+
if [[ $buildname =~ Buildroot|Alpine ]] ; then
179+
# we're running on a Builroot container and need to use Busybox's find
180+
echo "We're running on BusyBox/Buildroot"
181+
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 '{}' \;"
182+
else
183+
echo "We're not running on BusyBox/Buildroot"
184+
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 '{}' \;"
185+
fi
178186

179187
echo "(8/9) Stopping and removing the container..."
180188
docker stop $container_id

0 commit comments

Comments
 (0)