Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (51 loc) · 1.96 KB
/
Copy pathMakefile
File metadata and controls
68 lines (51 loc) · 1.96 KB
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
.PHONY: build-img build-deb install build clean
.DELETE_ON_ERROR:
BASE_IMG_URL := http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2016-03-18/2016-03-18-raspbian-jessie-lite.zip
BASE_IMG_NAME := $(basename $(notdir $(BASE_IMG_URL))).img
SPRINGBOARD := build/root/usr/share/tingbot/springboard.tingapp
SPRINGBOARD_COMMIT := v1.2.0
SPRINGBOARD_TARBALL := dl/springboard-$(SPRINGBOARD_COMMIT).tgz
build/tingbot-os.deb: build/root
dpkg -b build/root build/tingbot-os.deb
build/root: $(SPRINGBOARD_TARBALL) $(shell find root ! -lname "*")
mkdir -p build
rm -rf build/root
cp -R root build/root
# clean up .DS_Store files
find build/root -name ".DS_Store" -delete
# unarchive springboard tarfile to build/springboard
rm -rf build/springboard
mkdir -p build/springboard
tar -xzf $(SPRINGBOARD_TARBALL) -C build/springboard
# move springboard into place
rm -rf $(SPRINGBOARD)
mkdir -p $(dir $(SPRINGBOARD))
mv build/springboard/*/springboard.tingapp $(SPRINGBOARD)
$(SPRINGBOARD_TARBALL):
# download springboard
mkdir -p dl
curl -L http://github.com/tingbot/springboard/tarball/$(SPRINGBOARD_COMMIT) -o $(SPRINGBOARD_TARBALL)
build/disk.img: dl/$(BASE_IMG_NAME) build/tingbot-os.deb vm-setup.expect vm-build.expect vm-cleanup.expect
mkdir -p build
cp dl/$(BASE_IMG_NAME) build/disk.img
# add 200M to the disk image (1,048,576 = 1m)
dd if=/dev/zero count=200 bs=1048576 >> build/disk.img
chmod 600 tingbot.key
expect -f vm-setup.expect
expect -f vm-resize.expect
expect -f vm-build.expect
expect -f vm-cleanup.expect
build/disk.img.zip: build/disk.img
cd build; zip disk.img.zip disk.img
build-img: build/disk.img build/disk.img.zip
build-deb: build/tingbot-os.deb
build: build-img build-deb
install: build/tingbot-os.deb
dpkg -i build/tingbot-os.deb
clean:
rm -rf build
dl/$(BASE_IMG_NAME):
mkdir -p dl
curl --location -o dl/$(BASE_IMG_NAME).zip $(BASE_IMG_URL)
unzip dl/$(BASE_IMG_NAME).zip -d dl/zipfile
mv dl/zipfile/*.img dl/$(BASE_IMG_NAME)