Skip to content

Commit

Permalink
dev.mk: support Darwin for dev-shell
Browse files Browse the repository at this point in the history
  • Loading branch information
ayufan committed Sep 29, 2018
1 parent 3aaead0 commit bbb0534
Showing 1 changed file with 41 additions and 17 deletions.
58 changes: 41 additions & 17 deletions dev-shell
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,44 @@

CURDIR="$PWD"

exec docker run \
--rm \
-it \
-e HOME -v "${HOME}:${HOME}" \
-e USER \
-u "$(id -u):$(id -g)" \
$(id -Gz | xargs -0 -n1 -I{} echo "--group-add={}") \
-v /etc/passwd:/etc/passwd:ro \
-v /dev/bus/usb:/dev/bus/usb \
-v "${SSH_AUTH_SOCK}:${SSH_AUTH_SOCK}" \
-e SSH_AUTH_SOCK \
--privileged \
-h rock64-build-env \
-v "${CURDIR}:${CURDIR}" \
-w "${CURDIR}" \
ayufan/rock64-dockerfiles:x86_64 \
"$@"
case $(uname -s) in
Darwin)
exec docker run \
--rm \
-it \
-e HOME -v "${HOME}:${HOME}" \
-e USER \
-u "$(id -u):$(id -g)" \
--privileged \
-h rock64-build-env \
-v "${CURDIR}:${CURDIR}" \
-w "${CURDIR}" \
ayufan/rock64-dockerfiles:x86_64 \
"$@"
;;

Linux)
exec docker run \
--rm \
-it \
-e HOME -v "${HOME}:${HOME}" \
-e USER \
-u "$(id -u):$(id -g)" \
$(id -Gz | xargs -0 -n1 -I{} echo "--group-add={}") \
-v /etc/passwd:/etc/passwd:ro \
-v /dev/bus/usb:/dev/bus/usb \
-v "${SSH_AUTH_SOCK}:${SSH_AUTH_SOCK}" \
-e SSH_AUTH_SOCK \
--privileged \
-h rock64-build-env \
-v "${CURDIR}:${CURDIR}" \
-w "${CURDIR}" \
ayufan/rock64-dockerfiles:x86_64 \
"$@"
;;

*)
echo "Not supported: $(uname -s)"
exit 1
;;
esac

0 comments on commit bbb0534

Please sign in to comment.