From ae71c4c41b9242fd65fe680f237ae1214d2ddc46 Mon Sep 17 00:00:00 2001 From: Budleigh Salterton driving a Miura Date: Thu, 31 Mar 2016 21:51:28 +0200 Subject: [PATCH 1/2] Add -f switch, dont remove containers --- CHANGELOG.md | 3 +++ run.sh | 28 +++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) mode change 100644 => 100755 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100644 new mode 100755 index a5a2f4f..6ddef3f --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased][unreleased] +### Added +- Use -f to force rebuild the source. +- If build fails don't remove intermediate containers ## [0.5.0] - 2016-03-14 ### Added diff --git a/run.sh b/run.sh index 6a359a8..653df21 100755 --- a/run.sh +++ b/run.sh @@ -2,14 +2,31 @@ cd $(dirname $0) -SOURCE=$(pwd)/android -CCACHE=$(pwd)/ccache +SOURCE=$(readlink -f $(pwd)/android) +CCACHE=$(readlink -f $(pwd)/ccache) CONTAINER_HOME=/home/cmbuild CONTAINER=cyanogenmod REPOSITORY=stucki/cyanogenmod TAG=cm-13.0 FORCE_BUILD=0 + +while [[ $# > 0 ]] +do +key="$1" + +case $key in + -r|--rebuild) + FORCE_BUILD=1 + ;; + *) + shift # past argument or value + ;; +esac +shift + +done + # Create shared folders mkdir -p $SOURCE mkdir -p $CCACHE @@ -26,14 +43,19 @@ elif [[ $FORCE_BUILD = 1 ]] || ! echo "$IMAGE_EXISTS" | grep -q "$TAG"; then echo "Building Docker image $REPOSITORY:$TAG..." docker build -t $REPOSITORY:$TAG . + OK=$? # After successful build, delete existing containers IS_EXISTING=$(docker inspect -f '{{.Id}}' $CONTAINER 2>/dev/null) - if [[ -n "$IS_EXISTING" ]]; then + if [[ $OK -eq 0 ]] && [[ -n "$IS_EXISTING" ]]; then docker rm $CONTAINER fi fi +if [[ $OK -ne 0 ]]; then + exit 1; +fi + # With the given name $CONTAINER, reconnect to running container, start # an existing/stopped container or run a new one if one does not exist. IS_RUNNING=$(docker inspect -f '{{.State.Running}}' $CONTAINER 2>/dev/null) From 029736b5e623074c6daa1bb9d89f5883fd7bb072 Mon Sep 17 00:00:00 2001 From: Budleigh Salterton driving a Miura Date: Thu, 31 Mar 2016 21:54:13 +0200 Subject: [PATCH 2/2] add android completion --- CHANGELOG.md | 2 ++ Dockerfile | 3 ++- bash_completion | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) mode change 100644 => 100755 Dockerfile create mode 100644 bash_completion diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ddef3f..de1f1a9 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Added - Use -f to force rebuild the source. - If build fails don't remove intermediate containers +- Added bash completion, wget and nano +- Simplier home creation ## [0.5.0] - 2016-03-14 ### Added diff --git a/Dockerfile b/Dockerfile old mode 100644 new mode 100755 index a155801..95ec876 --- a/Dockerfile +++ b/Dockerfile @@ -17,8 +17,9 @@ RUN apt-get install -y g++-multilib gcc-multilib lib32ncurses5-dev lib32readline RUN apt-get install -y ccache rsync tig RUN apt-get install -y android-tools-adb android-tools-fastboot RUN apt-get install -y bc bsdmainutils file screen +RUN apt-get install -y bash-completion wget nano -RUN mkdir -p /home/cmbuild && useradd --no-create-home cmbuild && rsync -a /etc/skel/ /home/cmbuild/ +RUN useradd cmbuild && rsync -a /etc/skel/ /home/cmbuild/ RUN mkdir /home/cmbuild/bin RUN curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > /home/cmbuild/bin/repo diff --git a/bash_completion b/bash_completion new file mode 100644 index 0000000..f637ae9 --- /dev/null +++ b/bash_completion @@ -0,0 +1,2 @@ +. android-completion/android +. android-completion/repo