2024-02-09 13:11:02 +01:00
|
|
|
PACKER_VERSION := 1.10.1
|
2023-09-22 07:50:11 +02:00
|
|
|
PWN_HOSTNAME := pwnagotchi
|
2024-02-08 21:40:28 +01:00
|
|
|
PWN_VERSION := $(shell cut -d"'" -f2 < pwnagotchi/_version.py)
|
2023-09-22 07:50:11 +02:00
|
|
|
|
|
|
|
MACHINE_TYPE := $(shell uname -m)
|
|
|
|
ifneq (,$(filter x86_64,$(MACHINE_TYPE)))
|
|
|
|
GOARCH := amd64
|
|
|
|
else ifneq (,$(filter i686,$(MACHINE_TYPE)))
|
|
|
|
GOARCH := 386
|
|
|
|
else ifneq (,$(filter arm64% aarch64%,$(MACHINE_TYPE)))
|
|
|
|
GOARCH := arm64
|
|
|
|
else ifneq (,$(filter arm%,$(MACHINE_TYPE)))
|
|
|
|
GOARCH := arm
|
|
|
|
else
|
|
|
|
GOARCH := amd64
|
|
|
|
$(warning Unable to detect CPU arch from machine type $(MACHINE_TYPE), assuming $(GOARCH))
|
|
|
|
endif
|
2019-10-02 17:26:29 +01:00
|
|
|
|
2023-08-24 11:49:40 +02:00
|
|
|
# The Ansible part of the build can inadvertently change the active hostname of
|
|
|
|
# the build machine while updating the permanent hostname of the build image.
|
|
|
|
# If the unshare command is available, use it to create a separate namespace
|
|
|
|
# so hostname changes won't affect the build machine.
|
|
|
|
UNSHARE := $(shell command -v unshare)
|
|
|
|
ifneq (,$(UNSHARE))
|
|
|
|
UNSHARE := $(UNSHARE) --uts
|
|
|
|
endif
|
|
|
|
|
2023-11-15 10:09:33 +01:00
|
|
|
all: clean image clean
|
2019-10-02 17:26:29 +01:00
|
|
|
|
2023-11-16 21:44:26 +01:00
|
|
|
update_langs:
|
|
|
|
@for lang in pwnagotchi/locale/*/; do\
|
|
|
|
echo "updating language: $$lang ..."; \
|
|
|
|
./scripts/language.sh update $$(basename $$lang); \
|
|
|
|
done
|
|
|
|
|
|
|
|
compile_langs:
|
2021-04-18 16:22:29 +02:00
|
|
|
@for lang in pwnagotchi/locale/*/; do\
|
|
|
|
echo "compiling language: $$lang ..."; \
|
|
|
|
./scripts/language.sh compile $$(basename $$lang); \
|
2023-08-24 11:49:40 +02:00
|
|
|
done
|
|
|
|
|
2024-02-25 10:06:35 +01:00
|
|
|
packer:
|
|
|
|
curl https://releases.hashicorp.com/packer/$(PACKER_VERSION)/packer_$(PACKER_VERSION)_linux_amd64.zip -o /tmp/packer.zip
|
|
|
|
unzip /tmp/packer.zip -d /tmp
|
|
|
|
sudo mv /tmp/packer /usr/bin/packer
|
|
|
|
git clone https://github.com/solo-io/packer-builder-arm-image /tmp/packer-builder-arm-image
|
|
|
|
cd /tmp/packer-builder-arm-image && go get -d ./... && go build
|
|
|
|
|
|
|
|
image:
|
|
|
|
cd builder && /usr/bin/packer init pwnagotchi.json.pkr.hcl && sudo $(UNSHARE) /usr/bin/packer build -var "pwn_hostname=$(PWN_HOSTNAME)" -var "pwn_version=$(PWN_VERSION)" pwnagotchi.json.pkr.hcl
|
2023-08-24 11:49:40 +02:00
|
|
|
|
2019-10-02 17:26:29 +01:00
|
|
|
clean:
|
2024-02-06 12:53:45 -05:00
|
|
|
- rm -rf dist pwnagotchi.egg-info
|
|
|
|
- rm -f $(PACKER)
|