-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmakefile
More file actions
100 lines (91 loc) · 2.86 KB
/
Copy pathmakefile
File metadata and controls
100 lines (91 loc) · 2.86 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
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
# Makefile —— AnduinOS build orchestrator
SHELL := /usr/bin/env bash
.DEFAULT_GOAL := current
DEPS := \
binutils \
curl \
debootstrap \
gnupg \
squashfs-tools \
xorriso \
grub-pc-bin \
grub-efi-amd64 \
grub2-common \
mtools \
dosfstools
.PHONY: current clean bootstrap menuconfig buildtorrent help
help:
@echo "Usage:"
@echo " make (or make current) Build current language"
@echo " make menuconfig Configure build options (TUI)"
@echo " make clean Remove build artifacts"
@echo " make bootstrap Validate environment and deps"
@echo " make buildtorrent Generate torrents for dist/*.iso"
bootstrap:
@if [ "$$(id -u)" -eq 0 ]; then \
echo "Error: Do not run as root"; \
exit 1; \
fi
@if ! lsb_release -i | grep -qE "(Ubuntu|Debian|Tuxedo|Anduin)"; then \
echo "Error: Unsupported OS — only Ubuntu, Debian, Tuxedo or AnduinOS allowed"; \
exit 1; \
fi
@host=$$(lsb_release -cs); \
target=$$(grep -oP 'export TARGET_UBUNTU_VERSION="\K[^"]+' args.sh); \
if [ "$$host" != "$$target" ]; then \
echo "Error: Host codename '$$host' != target '$$target'"; \
echo "Build machine must run the same Ubuntu release as the target ISO."; \
exit 1; \
fi
@sudo -v
@missing="" ; \
for pkg in $(DEPS); do \
if ! dpkg -s $$pkg >/dev/null 2>&1; then \
missing="$$missing $$pkg"; \
fi; \
done; \
if [ -n "$$missing" ]; then \
echo "Missing packages:$$missing"; \
echo "Installing missing dependencies..."; \
sudo apt-get update && sudo apt-get install -y$$missing; \
else \
echo "[MAKE] All required packages are already installed."; \
fi
menuconfig:
@./menuconfig.sh
current: bootstrap
@echo "[MAKE] Building current language..."
@./build.sh
buildtorrent:
@if [ ! -d dist ]; then \
echo "[ERROR] dist/ directory not found. Run 'make' first."; \
exit 1; \
fi; \
shopt -s nullglob; isos=(dist/*.iso); \
if [ $${#isos[@]} -eq 0 ]; then \
echo "[ERROR] No ISO files found in dist/."; \
exit 1; \
fi; \
if ! command -v mktorrent &>/dev/null; then \
echo "[MAKE] Installing mktorrent..."; \
sudo apt-get update && sudo apt-get install -y mktorrent; \
fi; \
tracker=$$(mktemp); \
curl -fsSL -o "$$tracker" https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt; \
mapfile -t raw < "$$tracker"; \
rm "$$tracker"; \
announce_args=(); \
for t in "$${raw[@]}"; do \
[ -n "$$t" ] && announce_args+=(-a "$$t"); \
done; \
for iso in "$${isos[@]}"; do \
base="$${iso%.iso}"; \
echo "[MAKE] Generating torrent for $$(basename "$$iso")..."; \
rm -f "$${base}.torrent"; \
mktorrent "$${announce_args[@]}" -o "$${base}.torrent" "$$iso"; \
done; \
echo "[MAKE] Torrent generation complete."
clean:
@echo "[MAKE] Cleaning build artifacts..."
@./clean_all.sh
@echo "[MAKE] Clean complete."