diff --git a/licensing/README.md b/licensing/README.md index 9061f5093..d99c94984 100644 --- a/licensing/README.md +++ b/licensing/README.md @@ -6,7 +6,7 @@ This container runs on a Pinata system and dumps out the GPL code it is running ``` docker build -t license . -docker run -it -v /etc:/etc -v /lib:/lib -v $PWD/output:/output license +docker run -it -v /etc:/hostetc -v /lib:/lib -v $PWD/output:/output license ``` TODO add kernel to this, there is now a patch to get the metadata in. diff --git a/licensing/license.sh b/licensing/license.sh index 51ea21e22..8fe745715 100755 --- a/licensing/license.sh +++ b/licensing/license.sh @@ -1,12 +1,20 @@ #!/bin/sh -set -x -cat /etc/issue | grep -q Moby || ( printf "You must run this script with -v /etc:/etc -v /lib:/lib\n" && exit 1 ) -apk info | grep fuse || ( printf "You must run this script with -v /etc:/etc -v /lib:/lib\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 ) -# [ -f /etc/kernel-version-info ] || ( printf "Missing kernel version info\n" && exit 1 ) +apk info | grep -q fuse || ( printf "You must run this script with -v /etc:/etc -v /lib:/lib\n" && exit 1 ) -# . /etc/kernel-version-info +[ -f /hostetc/kernel-source-info ] || ( printf "Missing kernel source version info\n" && exit 1 ) + +. /hostetc/kernel-source-info + +rm -rf /output/* + +mkdir -p /output/kernel +cd /output/kernel +wget ${KERNEL_SOURCE=} || ( printf "Failed to download kernel source\n" && exit 1 ) + +# XXX download aufs # APORTS=https://github.com/alpinelinux/aports.git # git clone ${APORTS} @@ -20,12 +28,13 @@ do echo $l APORT_PACKAGE=$(echo $l | sed 's/ .*//') APORT_COMMIT=$(echo $l | sed 's/^.* //') + APORT_ORIGIN=$(apk search --origin -x -q ${APORT_PACKAGE}) ( cd /aports - [ ! -d main/${APORT_PACKAGE} ] && ( printf "Cannot find package ${APORT_PACKAGE} in aports\n" && exit 1 ) - git checkout ${APORT_COMMIT} || ( printf "Cannot find commit ${APORT_COMMIT} for ${APORT_PACKAGE} in aports\n" && exit 1 ) + [ ! -d main/${APORT_ORIGIN} ] && ( printf "Cannot find package ${APORT_ORIGIN} in aports\n" && exit 1 ) + git checkout ${APORT_COMMIT} || ( printf "Cannot find commit ${APORT_COMMIT} for ${APORT_ORIGIN} in aports\n" && exit 1 ) export srcdir=/output - cd main/${APORT_PACKAGE} + cd main/${APORT_ORIGIN} . ./APKBUILD mkdir -p "$srcdir"/$pkgname-$pkgver for f in $source