This repository was archived by the owner on Jun 14, 2026. It is now read-only.
forked from Lakr233/AssppWeb
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (35 loc) · 1.53 KB
/
Copy pathMakefile
File metadata and controls
42 lines (35 loc) · 1.53 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
SHELL := /bin/zsh
DEVICE_HOST ?=
PACKAGE_GLOB := backend-swift/debs/wiki.qaq.unfaird_*_iphoneos-arm64.deb
.PHONY: build package install test clean-package
build:
$(MAKE) -C backend-swift package FINALPACKAGE=1 ASSPPWEB_DIR=.. DEVICE_HOST="$(DEVICE_HOST)"
@ls -t $(PACKAGE_GLOB) | head -n 1
package: build
test:
cd backend-swift && swift test
cd frontend && npm test
install: build
@set -euo pipefail; \
host="$(DEVICE_HOST)"; \
device_ip="$(THEOS_DEVICE_IP)"; \
device_user="$(THEOS_DEVICE_USER)"; \
device_port="$(THEOS_DEVICE_PORT)"; \
if [[ -z "$$device_user" ]]; then device_user="root"; fi; \
if [[ -z "$$host" && -n "$$device_ip" ]]; then \
if [[ "$$device_ip" == *@* ]]; then host="$$device_ip"; else host="$${device_user}@$$device_ip"; fi; \
fi; \
if [[ -z "$$host" ]]; then echo "DEVICE_HOST or THEOS_DEVICE_IP is required" >&2; exit 1; fi; \
scp_args=(); \
ssh_args=(); \
if [[ -n "$$device_port" ]]; then scp_args=(-P "$$device_port"); ssh_args=(-p "$$device_port"); fi; \
deb=$$(ls -t $(PACKAGE_GLOB) | head -n 1); \
remote="/var/tmp/$${deb:t}"; \
scp "$${scp_args[@]}" "$$deb" "$$host:$$remote"; \
ssh "$${ssh_args[@]}" "$$host" "apt install -y '$$remote'"; \
health_host="$${host#*@}"; \
if [[ "$$health_host" == \[*\]* ]]; then health_host="$${health_host#\[}"; health_host="$${health_host%\]}"; fi; \
if [[ "$$health_host" == *:* ]]; then health_host="[$$health_host]"; fi; \
curl -fsS "http://$$health_host:8080/health"
clean-package:
rm -rf backend-swift/debs backend-swift/.theos backend-swift/.build/ios-release