-
Notifications
You must be signed in to change notification settings - Fork 8
/
justfile
164 lines (140 loc) · 4.33 KB
/
justfile
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
set dotenv-load
export RUGPI_BAKERY_IMAGE := "ghcr.io/silitics/rugpi-bakery:v0.7"
export PREFIX := "tedge_rugpi_"
export IMAGE := "tryboot"
export VERSION := env_var_or_default("VERSION", `date +'%Y%m%d.%H%M'`)
export IMAGE_NAME := PREFIX + IMAGE + "_" + VERSION
export OUTPUT_IMAGE := "build" / IMAGE_NAME + ".img"
# Generate a version name (that can be used in follow up commands)
generate_version:
@echo "{{VERSION}}"
# Show the install paths
show:
@echo "PREFIX={{PREFIX}}"
@echo "IMAGE={{IMAGE}}"
@echo "IMAGE_NAME={{IMAGE_NAME}}"
@echo "VERSION={{VERSION}}"
@echo "OUTPUT_IMAGE={{OUTPUT_IMAGE}}"
# Setup binfmt tools
# Note: technically only arm64,armhf are required, however install 'all' avoids the error message
# on arm64 hosts
setup:
docker run --privileged --rm tonistiigi/binfmt --install all >/dev/null
# Clean rugpi repository cache (to force running recipes to build an image)
clean-cache:
@rm -Rf .rugpi/repositories
# Clean rugpi cache and build folders
clean-all:
@rm -Rf .rugpi
@rm -Rf build/
# Create the image that can be flashed to an SD card or applied using the rugpi interface
build: setup
mkdir -p "{{parent_directory(OUTPUT_IMAGE)}}"
echo "{{IMAGE_NAME}}" > {{justfile_directory()}}/.image
./run-bakery bake image {{IMAGE}} {{OUTPUT_IMAGE}}
just VERSION={{VERSION}} IMAGE={{IMAGE}} compress
# Compress
compress:
@echo "Compressing image"
scripts/compress.sh "{{OUTPUT_IMAGE}}"
@echo ""
@echo ""
@echo "Image created successfully. Check below for options on how to use the image"
@echo ""
@echo "Option 1: Use the Raspberry Pi Imager to flash the image to an SD card"
@echo ""
@echo " {{justfile_directory()}}/{{OUTPUT_IMAGE}}.xz"
@echo ""
@echo "Option 2: If the device is already running a rugpi image, open the http://tedge-rugpi:8088 website and install the following image:"
@echo ""
@echo " {{justfile_directory()}}/{{OUTPUT_IMAGE}}.xz"
@echo ""
# Publish latest image to Cumulocity
publish:
cd {{justfile_directory()}} && ./scripts/upload-c8y.sh
# Publish a given github release to Cumulocity (using external urls)
publish-external tag *args="":
cd {{justfile_directory()}} && ./scripts/c8y-publish-release.sh {{tag}} {{args}}
# Publish a given github release to Cumulocity (using external urls) but convert an existing draft to a prerelease beforehand
publish-external-prerelease tag:
cd {{justfile_directory()}} && ./scripts/c8y-publish-release.sh {{tag}} --pre-release
# Trigger a release (by creating a tag)
release:
git tag -a "{{VERSION}}" -m "{{VERSION}}"
git push origin "{{VERSION}}"
@echo
@echo "Created release (tag): {{VERSION}}"
@echo
#
# Help users to select the correct image for them
#
build-pi1:
just IMAGE=rpi-u-boot-armhf build
@echo
@echo "This image can be applied to"
@echo " * pi1"
@echo " * pi2 (early models)"
@echo " * pizero"
@echo
build-pizero:
just IMAGE=rpi-u-boot-armhf build
@echo
@echo "This image can be applied to"
@echo " * pi1"
@echo " * pi2 (early models)"
@echo " * pizero"
@echo
build-pi2:
just IMAGE=rpi-u-boot build
@echo
@echo "This image can be applied to"
@echo " * pi2"
@echo " * pi3"
@echo " * pizero2w"
@echo
build-pi3:
just IMAGE=rpi-u-boot build
@echo
@echo "This image can be applied to"
@echo " * pi2"
@echo " * pi3"
@echo " * pizero2w"
@echo
build-pizero2w:
just IMAGE=rpi-u-boot build
@echo
@echo "This image can be applied to"
@echo " * pi2"
@echo " * pi3"
@echo " * pizero2w"
@echo
build-pi4:
just IMAGE=rpi-tryboot build
@echo
@echo "This image can be applied to"
@echo " * pi4"
@echo " * pi5"
@echo
build-pi4-include-firmware:
just IMAGE=rpi-tryboot-pi4 build
@echo
@echo "This image can be applied to"
@echo " * pi4"
@echo
build-pi5:
just IMAGE=rpi-tryboot build
@echo
@echo "This image can be applied to"
@echo " * pi4"
@echo " * pi5"
@echo
build-debian-amd64-vm:
just IMAGE=debian-amd64-vm build
@echo
@echo "This image can be applied to any EFI-compatible device"
@echo
build-debian-arm64-vm:
just IMAGE=debian-arm64-vm build
@echo
@echo "This image can be applied to any EFI-compatible device"
@echo