From 5f65d68abd76e2f6d81e43d1d54032089a7ee9ef Mon Sep 17 00:00:00 2001 From: Budleigh Salterton driving a Miura Date: Thu, 31 Mar 2016 22:06:23 +0200 Subject: [PATCH 1/5] usb privileged version --- Dockerfile | 0 run.sh | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) mode change 100644 => 100755 Dockerfile diff --git a/Dockerfile b/Dockerfile old mode 100644 new mode 100755 diff --git a/run.sh b/run.sh index 6a359a8..861b8dc 100755 --- a/run.sh +++ b/run.sh @@ -11,8 +11,8 @@ TAG=cm-13.0 FORCE_BUILD=0 # Create shared folders -mkdir -p $SOURCE -mkdir -p $CCACHE +[[ -e "$SOURCE" ]] || mkdir -p $SOURCE +[[ -e "$CCACHE" ]] || mkdir -p $CCACHE # Build image if needed IMAGE_EXISTS=$(docker images $REPOSITORY) @@ -42,7 +42,7 @@ if [[ $IS_RUNNING == "true" ]]; then elif [[ $IS_RUNNING == "false" ]]; then docker start -i $CONTAINER else - docker run -v $SOURCE:$CONTAINER_HOME/android -v $CCACHE:/srv/ccache -i -t --name $CONTAINER $REPOSITORY:$TAG + docker run --privileged -v $SOURCE:$CONTAINER_HOME/android -v $CCACHE:/srv/ccache -v /dev/bus/usb:/dev/bus/usb -i -t --name $CONTAINER $REPOSITORY:$TAG fi exit $? From b9ac69cf577d53bc5849cc1002c2f582320b60d1 Mon Sep 17 00:00:00 2001 From: Budleigh Salterton driving a Miura Date: Mon, 4 Apr 2016 17:54:27 +0200 Subject: [PATCH 2/5] privileged is now switchable --- run.sh | 22 +++++++++++++++++++++- startup.sh | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/run.sh b/run.sh index 861b8dc..af0095d 100755 --- a/run.sh +++ b/run.sh @@ -9,6 +9,26 @@ CONTAINER=cyanogenmod REPOSITORY=stucki/cyanogenmod TAG=cm-13.0 FORCE_BUILD=0 +PRIVILEGED= + +while [[ $# > 0 ]] +do +key="$1" + +case $key in + -r|--rebuild) + FORCE_BUILD=1 + ;; + -p|--privileged) + PRIVILEGED="--privileged -v /dev/bus/usb:/dev/bus/usb" + ;; + *) + shift # past argument or value + ;; +esac +shift + +done # Create shared folders [[ -e "$SOURCE" ]] || mkdir -p $SOURCE @@ -42,7 +62,7 @@ if [[ $IS_RUNNING == "true" ]]; then elif [[ $IS_RUNNING == "false" ]]; then docker start -i $CONTAINER else - docker run --privileged -v $SOURCE:$CONTAINER_HOME/android -v $CCACHE:/srv/ccache -v /dev/bus/usb:/dev/bus/usb -i -t --name $CONTAINER $REPOSITORY:$TAG + docker run $PRIVILEGED -v $SOURCE:$CONTAINER_HOME/android -v $CCACHE:/srv/ccache -i -t --name $CONTAINER $REPOSITORY:$TAG fi exit $? diff --git a/startup.sh b/startup.sh index 6c8dec1..de3362c 100644 --- a/startup.sh +++ b/startup.sh @@ -9,4 +9,4 @@ fi export USER="cmbuild" # Launch screen session -screen -s /bin/bash +/bin/bash --login From c1566b3432883c2b112d334e9e9cccdc92b129d3 Mon Sep 17 00:00:00 2001 From: Budleigh Salterton driving a Miura Date: Mon, 4 Apr 2016 17:55:06 +0200 Subject: [PATCH 3/5] remove unnecessary check --- run.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run.sh b/run.sh index af0095d..e65c831 100755 --- a/run.sh +++ b/run.sh @@ -31,8 +31,8 @@ shift done # Create shared folders -[[ -e "$SOURCE" ]] || mkdir -p $SOURCE -[[ -e "$CCACHE" ]] || mkdir -p $CCACHE +mkdir -p $SOURCE +mkdir -p $CCACHE # Build image if needed IMAGE_EXISTS=$(docker images $REPOSITORY) From 0abac4367c79c24a96483d0287e3ac0d62dd482b Mon Sep 17 00:00:00 2001 From: Budleigh Salterton driving a Miura Date: Mon, 4 Apr 2016 18:55:21 +0200 Subject: [PATCH 4/5] workaround for docker issue #8755 --- README.md | 5 +++++ startup.sh | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d2b0ba4..a720fa9 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,11 @@ cd docker-cyanogenmod ./run.sh ``` +The `run.sh` script accepts the following switches: + +* -p|--privileged - runs the container in privileged mode (this way you can use usb debugging right from the container) +* -r|--rebuild - force rebuild the image from scratch + The container uses "screen" to run the shell. This means that you will be able to open additional shells using [screen keyboard shortcuts][Screen_Shortcuts]. ### How to build CyanogenMod for your device diff --git a/startup.sh b/startup.sh index de3362c..b706fba 100644 --- a/startup.sh +++ b/startup.sh @@ -9,4 +9,5 @@ fi export USER="cmbuild" # Launch screen session -/bin/bash --login +#/bin/bash --login +script -qc "screen -s /bin/bash" /dev/null From 26d309fe9612d34dd82502dad8e4a13138539840 Mon Sep 17 00:00:00 2001 From: Budleigh Salterton driving a Miura Date: Mon, 4 Apr 2016 19:00:56 +0200 Subject: [PATCH 5/5] removed workaround, changed switch from -p to -u (--enable-usb) --- README.md | 2 +- run.sh | 2 +- startup.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a720fa9..25c6b6d 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ cd docker-cyanogenmod The `run.sh` script accepts the following switches: -* -p|--privileged - runs the container in privileged mode (this way you can use usb debugging right from the container) +* -u|--enable-usb - runs the container in privileged mode (this way you can use usb debugging right from the container) * -r|--rebuild - force rebuild the image from scratch The container uses "screen" to run the shell. This means that you will be able to open additional shells using [screen keyboard shortcuts][Screen_Shortcuts]. diff --git a/run.sh b/run.sh index e65c831..7fba4ba 100755 --- a/run.sh +++ b/run.sh @@ -19,7 +19,7 @@ case $key in -r|--rebuild) FORCE_BUILD=1 ;; - -p|--privileged) + -u|--enable-usb) PRIVILEGED="--privileged -v /dev/bus/usb:/dev/bus/usb" ;; *) diff --git a/startup.sh b/startup.sh index b706fba..5e5c366 100644 --- a/startup.sh +++ b/startup.sh @@ -10,4 +10,4 @@ export USER="cmbuild" # Launch screen session #/bin/bash --login -script -qc "screen -s /bin/bash" /dev/null +screen -s /bin/bash