Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
55 lines (48 loc) · 1.67 KB
/
Copy pathjustfile
File metadata and controls
55 lines (48 loc) · 1.67 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
interface := "en0"
ip := "127.0.0.1"
repo_root := justfile_directory()
scratch := justfile_directory() + "/.scratch"
ipxe_result_link := scratch + "/ipxe-result"
run: make-pxe-efi make-cert make-samples
go run . \
-interface "{{interface}}" \
-netboot-dir "{{scratch}}/samples" \
-tls-cert-file "{{scratch}}/tls.crt" \
-tls-key-file "{{scratch}}/tls.key" \
-dhcpv6-listen-port 20547 \
-http-listen-addr "{{ip}}:20080" \
-https-listen-addr "{{ip}}:20443" \
-tftp-listen-addr "{{ip}}:20069" \
-ipxe-x86-64-efi "{{ipxe_result_link}}/ipxe.efi"
make-pxe-efi: make-scratch
#!/bin/sh
if [ ! -e "{{ipxe_result_link}}/ipxe.efi" ]; then
nix build .#iPXE --out-link "{{ipxe_result_link}}"
else
echo "ipxe.efi: not re-building since it already exists in .scratch"
fi
make-cert: make-scratch
#!/bin/sh
if [ ! -e "{{scratch}}/tls.key" ] || [ ! -e "{{scratch}}/tls.crt" ]; then
openssl req -x509 \
-newkey rsa:4096 \
-nodes \
-keyout "{{scratch}}/tls.key" \
-out "{{scratch}}/tls.crt" \
-sha256 \
-days 1 \
-subj "/CN=dhcpv6macd"
else
echo "scratch TLS key/cert: not recreating them because they exist already"
fi
make-samples: make-scratch
#!/bin/sh
mkdir -p "{{scratch}}/samples/00:00:00:00:00:00"
cd "{{scratch}}/samples/00:00:00:00:00:00"
if [ ! -e "boot.efi" ]; then
yes "dhcpv6macd is a choice" | head -c 52428800 > boot.efi
else
echo "00:00:00:00:00:00 sample: not creating it because it already exists"
fi
make-scratch:
mkdir -p "{{scratch}}"