-
Notifications
You must be signed in to change notification settings - Fork 0
/
kodi-docker.mk
executable file
·77 lines (71 loc) · 2.28 KB
/
kodi-docker.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/make -f
TAG=latest
IMAGE_NAME=outlyernet/kodi
VOLUME_NAME=kodi
launch:
@# Possibly useful additional arguments
@# --user $(shell id -u):$(shell id -g) \
@# -v /etc/passwd:/etc/passwd:ro \
exec docker run --rm -it \
-v /tmp/.X11-unix/:/tmp/.X11-unix/:ro \
-v /etc/localtime:/etc/localtime:ro \
-v $(VOLUME_NAME):/root/.kodi \
-v $(HOME):/root/$(shell id -un)-home:ro \
-e DISPLAY \
--device /dev/snd \
--device /dev/dri \
$(IMAGE_NAME):$(TAG)
build:
docker build -t $(IMAGE_NAME):$(TAG) .
tag: # build # No longer depends on build so that the pulled version can be tagged
@echo 'Trying to tag with the appropriate version'
@# The full package version
@# (Tag names cannot contain plus signs)
docker tag $(IMAGE_NAME):$(TAG) $(IMAGE_NAME):$(shell docker run --rm \
--entrypoint /usr/bin/dpkg-query \
$(IMAGE_NAME) \
-f='$${Version}' -W kodi \
| cut -d: -f2- \
| sed 's/+/-/g')
@# Major/Minor version
docker tag $(IMAGE_NAME):$(TAG) $(IMAGE_NAME):$(shell docker run --rm \
--entrypoint /usr/bin/dpkg-query \
$(IMAGE_NAME) \
-f='$${Version}' -W kodi \
| cut -d: -f2- \
| cut -d+ -f1 )
@# Major version
docker tag $(IMAGE_NAME):$(TAG) $(IMAGE_NAME):$(shell docker run --rm \
--entrypoint /usr/bin/dpkg-query \
$(IMAGE_NAME) \
-f='$${Version}' -W kodi \
| cut -d: -f2 \
| cut -d. -f1 )
@# Tag with (known) codename
case $(shell docker run --rm \
--entrypoint /usr/bin/dpkg-query \
$(IMAGE_NAME) \
-f='$${Version}' -W kodi \
| cut -d: -f2- \
| cut -d. -f1 ) \
in \
16) docker tag $(IMAGE_NAME):$(TAG) $(IMAGE_NAME):jarvis ;;\
17) docker tag $(IMAGE_NAME):$(TAG) $(IMAGE_NAME):krypton ;;\
18) docker tag $(IMAGE_NAME):$(TAG) $(IMAGE_NAME):leia ;;\
19) docker tag $(IMAGE_NAME):$(TAG) $(IMAGE_NAME):matrix ;;\
esac
# Helper rule to build older versions without overwriting :latest
build-tag-%:
docker build -t $(IMAGE_NAME):$* .
# Launch a shell within a container, helpful for testing changes
shell:
exec docker run --rm -it \
-v /tmp/.X11-unix/:/tmp/.X11-unix/:ro \
-v /etc/localtime:/etc/localtime:ro \
-v $(VOLUME_NAME):/root/.kodi \
-v $(HOME):/root/$(shell id -un)-home:ro \
-e DISPLAY \
--device /dev/snd \
--device /dev/dri \
--entrypoint /bin/bash \
$(IMAGE_NAME):$(TAG)