mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-22 10:31:35 +00:00
initial program to extract GPL source from running Moby for #45
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
cbd7af5e1d
commit
3907ec30b1
9
licensing/Dockerfile
Normal file
9
licensing/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
FROM alpine:3.3
|
||||||
|
|
||||||
|
RUN apk update && apk add lua git
|
||||||
|
|
||||||
|
RUN git clone https://github.com/alpinelinux/aports.git
|
||||||
|
|
||||||
|
ADD license.sh gpl.lua /usr/bin/
|
||||||
|
|
||||||
|
CMD license.sh
|
12
licensing/README.md
Normal file
12
licensing/README.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Extract GPL source from Moby
|
||||||
|
|
||||||
|
WORK IN PROGRESS SOME ISSUES STILL
|
||||||
|
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
TODO add kernel to this, there is now a patch to get the metadata in.
|
18
licensing/gpl.lua
Executable file
18
licensing/gpl.lua
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/lua
|
||||||
|
|
||||||
|
p = {}
|
||||||
|
f = io.open("/lib/apk/db/installed")
|
||||||
|
|
||||||
|
for line in f:lines() do
|
||||||
|
if line == "" then
|
||||||
|
if p.L:match("[Gg][Pg][Ll]") then
|
||||||
|
print(p.P, p.L, p.c)
|
||||||
|
end
|
||||||
|
p = {}
|
||||||
|
else
|
||||||
|
k, v = line:match("(%a):(.*)")
|
||||||
|
if k then
|
||||||
|
p[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
43
licensing/license.sh
Executable file
43
licensing/license.sh
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#!/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 )
|
||||||
|
|
||||||
|
# [ -f /etc/kernel-version-info ] || ( printf "Missing kernel version info\n" && exit 1 )
|
||||||
|
|
||||||
|
# . /etc/kernel-version-info
|
||||||
|
|
||||||
|
# APORTS=https://github.com/alpinelinux/aports.git
|
||||||
|
# git clone ${APORTS}
|
||||||
|
|
||||||
|
mkdir -p /output
|
||||||
|
|
||||||
|
cd /output
|
||||||
|
|
||||||
|
gpl.lua | while read l
|
||||||
|
do
|
||||||
|
echo $l
|
||||||
|
APORT_PACKAGE=$(echo $l | sed 's/ .*//')
|
||||||
|
APORT_COMMIT=$(echo $l | sed 's/^.* //')
|
||||||
|
(
|
||||||
|
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 )
|
||||||
|
export srcdir=/output
|
||||||
|
cd main/${APORT_PACKAGE}
|
||||||
|
. ./APKBUILD
|
||||||
|
mkdir -p "$srcdir"/$pkgname-$pkgver
|
||||||
|
for f in $source
|
||||||
|
do
|
||||||
|
if [ -f $f ]
|
||||||
|
then
|
||||||
|
cp -a $f "$srcdir"/$pkgname-$pkgver/
|
||||||
|
else
|
||||||
|
( cd "$srcdir"/$pkgname-$pkgver && \
|
||||||
|
wget $f || ( printf "Cannot retrieve $f\n" && exit )
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user