From ae084196bccd5edf63c8d4a1571fa1411889d0cd Mon Sep 17 00:00:00 2001 From: Justin Cormack Date: Tue, 5 Apr 2016 12:40:26 +0100 Subject: [PATCH] fix licensing container to fix #70 Signed-off-by: Justin Cormack --- licensing/Dockerfile | 2 +- licensing/license.sh | 67 ++++++++++++++++++++++++++------------------ 2 files changed, 41 insertions(+), 28 deletions(-) diff --git a/licensing/Dockerfile b/licensing/Dockerfile index 17a1c6326..bdef1172b 100644 --- a/licensing/Dockerfile +++ b/licensing/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:3.3 -RUN apk update && apk add lua git +RUN apk update && apk add lua git bash RUN git clone https://github.com/alpinelinux/aports.git diff --git a/licensing/license.sh b/licensing/license.sh index 28f30506c..60492a7f4 100755 --- a/licensing/license.sh +++ b/licensing/license.sh @@ -1,4 +1,10 @@ -#!/bin/sh +#!/bin/bash + +fail() { + printf $1 + printf "\n" + exit 1 +} cat /hostetc/issue | grep -q Moby || ( printf "You must run this script with -v /etc:/hostetc -v /lib:/lib\n" && exit 1 ) @@ -10,22 +16,6 @@ apk info | grep -q fuse || ( printf "You must run this script with -v /etc:/etc rm -rf /output/* -mkdir -p /output/kernel -cd /output/kernel -cp /proc/config.gz . -wget ${KERNEL_SOURCE=} || ( printf "Failed to download kernel source\n" && exit 1 ) - -git clone -b "$AUFS_BRANCH" "$AUFS_REPO" /output/kernel/aufs -cd /output/kernel/aufs -git checkout -q "$AUFS_COMMIT" -# to make it easier to check in the output of this script if necessary -rm -rf .git - -git clone ${AUFS_TOOLS_REPO} /output/aufs-util -cd /output/aufs-util -git checkout "$AUFS_TOOLS_COMMIT" -rm -rf .git - cd /aports git pull @@ -45,17 +35,40 @@ do if [ ! -d "$srcdir"/$pkgname-$pkgver ] then mkdir -p "$srcdir"/$pkgname-$pkgver - for f in $source + while read f do - if [ -f $f ] - then - cp -a $f "$srcdir"/$pkgname-$pkgver/ - else - cd "$srcdir"/$pkgname-$pkgver && \ - wget $f || ( printf "Cannot retrieve $f\n" && exit ) && \ - cd - - fi - done + if [ -n "$(echo $f | tr -d '[[:space:]]')" ] + then + f=$(echo $f | sed 's/^.*:://') + printf "looking for source for: $f\n" + if [ -f $f ] + then + cp -a $f "$srcdir"/$pkgname-$pkgver/ + else + cd "$srcdir"/$pkgname-$pkgver && \ + wget $f || fail "Cannot retrieve $f" && \ + cd - + fi + fi + done <<< "$source" fi ) done + +mkdir -p /output/kernel +cd /output/kernel +cp /proc/config.gz . +wget ${KERNEL_SOURCE=} || ( printf "Failed to download kernel source\n" && exit 1 ) + +git clone -b "$AUFS_BRANCH" "$AUFS_REPO" /output/kernel/aufs +cd /output/kernel/aufs +git checkout -q "$AUFS_COMMIT" +# to make it easier to check in the output of this script if necessary +rm -rf .git + +git clone ${AUFS_TOOLS_REPO} /output/aufs-util +cd /output/aufs-util +git checkout "$AUFS_TOOLS_COMMIT" +rm -rf .git + +printf "All source code now in output/ directory\n'