]>
Commit | Line | Data |
---|---|---|
aee9344c | 1 | include /usr/share/dpkg/default.mk |
6db9b06a | 2 | |
9cdfeefc | 3 | PACKAGE = proxmox-installer |
59597871 TL |
4 | BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM) |
5 | ||
aee9344c | 6 | DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb |
0190a299 | 7 | DSC=$(PACKAGE)_$(DEB_VERSION).dsc |
e70f1b2f | 8 | |
9cdfeefc | 9 | CARGO ?= cargo |
e70f1b2f CH |
10 | ifeq ($(BUILD_MODE), release) |
11 | CARGO_BUILD_ARGS += --release | |
12 | CARGO_COMPILEDIR := target/release | |
13 | else | |
14 | CARGO_COMPILEDIR := target/debug | |
15 | endif | |
16 | ||
f3521633 | 17 | INSTALLER_SOURCES=$(shell git ls-files) country.dat |
89a12446 | 18 | |
aee9344c TL |
19 | PREFIX = /usr |
20 | BINDIR = $(PREFIX)/bin | |
21 | USR_BIN := proxmox-tui-installer | |
22 | ||
23 | COMPILED_BINS := \ | |
24 | $(addprefix $(CARGO_COMPILEDIR)/,$(USR_BIN)) | |
25 | ||
f3521633 | 26 | all: |
f0583fd4 | 27 | |
59597871 TL |
28 | $(BUILDDIR): |
29 | rm -rf $@ $@.tmp; mkdir $@.tmp | |
30 | cp -a \ | |
31 | Cargo.toml \ | |
32 | Makefile \ | |
33 | Proxmox/ \ | |
34 | Xdefaults \ | |
35 | banner/ \ | |
36 | checktime \ | |
37 | country.pl \ | |
38 | fake-start-stop-daemon \ | |
39 | html/ \ | |
40 | interfaces \ | |
41 | policy-disable-rc.d \ | |
42 | proxinstall \ | |
43 | proxmox-low-level-installer \ | |
44 | proxmox-tui-installer/ \ | |
45 | spice-vdagent.sh \ | |
46 | unconfigured.sh \ | |
47 | xinitrc \ | |
48 | $@.tmp | |
49 | cp -a debian $@.tmp/ | |
50 | mv $@.tmp $@ | |
51 | ||
f0583fd4 | 52 | country.dat: country.pl |
fc2c6d3e TL |
53 | ./country.pl > country.dat.tmp |
54 | mv country.dat.tmp country.dat | |
780479c5 | 55 | |
99f0b523 | 56 | deb: $(DEB) |
59597871 TL |
57 | $(DEB): $(BUILDDIR) |
58 | cd $(BUILDDIR); dpkg-buildpackage -b -us -uc | |
99f0b523 | 59 | lintian $(DEB) |
c2f72dd6 | 60 | |
6ec8d163 | 61 | test-$(DEB): $(INSTALLER_SOURCES) |
63ce0b1a | 62 | rsync --exclude='test*.img' --exclude='*.deb' --exclude='build' -a * build |
6ec8d163 TL |
63 | cd build; dpkg-buildpackage -b -us -uc -nc |
64 | mv $(DEB) test-$(DEB) | |
65 | ||
0190a299 TL |
66 | dsc: $(DSC) |
67 | $(MAKE) clean | |
68 | $(MAKE) $(DSC) | |
69 | lintian $(DSC) | |
70 | ||
71 | $(DSC): $(BUILDDIR) | |
72 | cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d | |
73 | ||
74 | sbuild: $(DSC) | |
75 | sbuild $(DSC) | |
76 | ||
c2f72dd6 TL |
77 | DESTDIR= |
78 | VARLIBDIR=$(DESTDIR)/var/lib/proxmox-installer | |
79 | HTMLDIR=$(VARLIBDIR)/html/common | |
89a12446 | 80 | |
c2f72dd6 | 81 | .PHONY: install |
99f0b523 | 82 | install: $(INSTALLER_SOURCES) $(CARGO_COMPILEDIR)/proxmox-tui-installer |
c2f72dd6 | 83 | $(MAKE) -C banner install |
ab97da2c | 84 | $(MAKE) -C Proxmox install |
99f0b523 TL |
85 | install -D -m 644 interfaces $(DESTDIR)/etc/network/interfaces |
86 | install -D -m 755 fake-start-stop-daemon $(VARLIBDIR)/fake-start-stop-daemon | |
c2f72dd6 TL |
87 | install -D -m 755 policy-disable-rc.d $(VARLIBDIR)/policy-disable-rc.d |
88 | install -D -m 644 country.dat $(VARLIBDIR)/country.dat | |
99f0b523 TL |
89 | install -D -m 755 unconfigured.sh $(DESTDIR)/sbin/unconfigured.sh |
90 | install -D -m 755 proxinstall $(DESTDIR)/usr/bin/proxinstall | |
aee9344c TL |
91 | install -D -m 755 proxmox-low-level-installer $(DESTDIR)/$(BINDIR)/proxmox-low-level-installer |
92 | $(foreach i,$(USR_BIN), install -m755 $(CARGO_COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/) | |
99f0b523 TL |
93 | install -D -m 755 checktime $(DESTDIR)/usr/bin/checktime |
94 | install -D -m 644 xinitrc $(DESTDIR)/.xinitrc | |
95 | install -D -m 755 spice-vdagent.sh $(DESTDIR)/.spice-vdagent.sh | |
96 | install -D -m 644 Xdefaults $(DESTDIR)/.Xdefaults | |
89a12446 | 97 | |
0889f35d TL |
98 | $(COMPILED_BINS): cargo-build |
99 | .PHONY: cargo-build | |
100 | cargo-build: | |
aee9344c TL |
101 | $(CARGO) build --package proxmox-tui-installer --bin proxmox-tui-installer $(CARGO_BUILD_ARGS) |
102 | ||
c2f72dd6 | 103 | %-banner.png: %-banner.svg |
9b9ddfce | 104 | rsvg-convert -o $@ $< |
782b4acd | 105 | |
c2f72dd6 | 106 | .PHONY: upload |
e23aeee4 TL |
107 | upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION) |
108 | upload: $(DEB) | |
99f0b523 | 109 | tar cf - $(DEB) | ssh -X repoman@repo.proxmox.com -- upload --product pve,pmg,pbs --dist $(UPLOAD_DIST) |
89a12446 | 110 | |
76960140 TL |
111 | %.img: |
112 | truncate -s 2G $@ | |
89a12446 | 113 | |
4a96f472 TL |
114 | %.big.img: |
115 | truncate -s 8G $@ | |
116 | ||
c2f72dd6 | 117 | .PHONY: prepare-check-env |
6ec8d163 | 118 | prepare-check-env: test-$(DEB) |
92cbd446 | 119 | rm -rf testdir |
6ec8d163 | 120 | dpkg -X test-$(DEB) testdir |
c2f72dd6 | 121 | |
29f32406 TL |
122 | cd-info.test: PRODUCT ?= pve |
123 | cd-info.test: | |
413ca90b TL |
124 | printf '%s\n' "PRODUCT='$(or $(PRODUCT), pve)'" >$@.tmp |
125 | printf '%s\n' "PRODUCTLONG='$(or $(PRODUCTLONG), Proxmox VE)'" >>$@.tmp | |
126 | printf '%s\n' "RELEASE='$(or $(RELEASE), 42.1)'" >>$@.tmp | |
127 | printf '%s\n' "ISORELEASE='$(or $(ISORELEASE), 1)'" >>$@.tmp | |
128 | printf '%s\n' "ISONAME='$(or $(ISONAME), proxmox-ve)'" >>$@.tmp | |
29f32406 TL |
129 | mv $@.tmp $@ |
130 | ||
c2f72dd6 | 131 | check-pve: prepare-check-env test.img |
413ca90b | 132 | rm -f cd-info.test; $(MAKE) cd-info.test |
92cbd446 | 133 | G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img |
89a12446 | 134 | |
4a96f472 | 135 | check-pve-multidisks: prepare-check-env test.img test2.img test3.img test4.img test5.big.img |
413ca90b | 136 | rm -f cd-info.test; $(MAKE) cd-info.test |
4a96f472 | 137 | G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img,test2.img,test3.img,test4.img,test5.big.img |
76960140 | 138 | |
0cf4be7d TL |
139 | check-pve-tui: prepare-check-env test.img |
140 | rm -f cd-info.test; $(MAKE) cd-info.test | |
141 | ./proxmox-low-level-installer dump-env -t | |
142 | testdir/usr/bin/proxmox-tui-installer -t test.img | |
143 | ||
c2f72dd6 | 144 | check-pmg: prepare-check-env test.img |
413ca90b TL |
145 | rm -f cd-info.test; $(MAKE) \ |
146 | PRODUCT=pmg \ | |
147 | PRODUCTLONG="Proxmox Mail Gateway" \ | |
148 | ISONAME='proxmox-mail-gateway' \ | |
149 | cd-info.test | |
a8213c0e DM |
150 | G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img |
151 | ||
c2f72dd6 | 152 | check-pbs: prepare-check-env test.img |
413ca90b TL |
153 | rm -f cd-info.test; $(MAKE) \ |
154 | PRODUCT='pbs' \ | |
155 | PRODUCTLONG='Proxmox Backup Server' \ | |
156 | ISONAME='proxmox-backup-server' \ | |
157 | cd-info.test | |
53748662 OB |
158 | G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img |
159 | ||
160 | ||
89a12446 DM |
161 | .phony: clean |
162 | clean: | |
2d5382e8 TL |
163 | rm -rf target build $(PACKAGE)-[0-9]* |
164 | rm -f $(PACKAGE)*.tar* *.deb packages packages.tmp *.build *.dsc *.buildinfo *.changes | |
165 | rm -f testdir test*.img pve-final.pkglist country.dat final.pkglist cd-info.test | |
b1e23923 | 166 | find . -name '*~' -exec rm {} ';' |