]> git.proxmox.com Git - pve-installer.git/blob - Makefile
bump version to 8.1.8
[pve-installer.git] / Makefile
1 include /usr/share/dpkg/default.mk
2
3 PACKAGE = proxmox-installer
4 BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
5
6 DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
7 DSC=$(PACKAGE)_$(DEB_VERSION).dsc
8
9 CARGO ?= cargo
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
17 INSTALLER_SOURCES=$(shell git ls-files) country.dat
18
19 PREFIX = /usr
20 BINDIR = $(PREFIX)/bin
21 USR_BIN := proxmox-tui-installer
22
23 COMPILED_BINS := \
24 $(addprefix $(CARGO_COMPILEDIR)/,$(USR_BIN))
25
26 all:
27
28 $(BUILDDIR):
29 rm -rf $@ $@.tmp; mkdir $@.tmp
30 cp -a \
31 .cargo \
32 Cargo.toml \
33 Makefile \
34 Proxmox/ \
35 Xdefaults \
36 banner/ \
37 checktime \
38 country.pl \
39 fake-start-stop-daemon \
40 html/ \
41 interfaces \
42 policy-disable-rc.d \
43 proxinstall \
44 proxmox-low-level-installer \
45 proxmox-tui-installer/ \
46 proxmox-installer-common/ \
47 spice-vdagent.sh \
48 test/ \
49 unconfigured.sh \
50 xinitrc \
51 $@.tmp
52 cp -a debian $@.tmp/
53 mv $@.tmp $@
54
55 country.dat: country.pl
56 ./country.pl > country.dat.tmp
57 mv country.dat.tmp country.dat
58
59 deb: $(DEB)
60 $(DEB): $(BUILDDIR)
61 cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
62 lintian $(DEB)
63
64 test-$(DEB): $(INSTALLER_SOURCES)
65 rsync --exclude='test*.img' --exclude='*.deb' --exclude='build' -a * build
66 cd build; dpkg-buildpackage -b -us -uc -nc
67 mv $(DEB) test-$(DEB)
68
69 dsc: $(DSC)
70 $(MAKE) clean
71 $(MAKE) $(DSC)
72 lintian $(DSC)
73
74 $(DSC): $(BUILDDIR)
75 cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
76
77 sbuild: $(DSC)
78 sbuild $(DSC)
79
80 .PHONY: prepare-test-env
81 prepare-test-env: cd-info.test country.dat test.img
82 rm -rf testdir
83 mkdir -p testdir/var/lib/proxmox-installer/
84 cp -v country.dat testdir/var/lib/proxmox-installer/
85 ./proxmox-low-level-installer -t test.img dump-env
86
87 .PHONY: test
88 test: prepare-test-env
89 $(MAKE) -C test check
90 $(CARGO) test --workspace $(CARGO_BUILD_ARGS)
91
92 DESTDIR=
93 VARLIBDIR=$(DESTDIR)/var/lib/proxmox-installer
94 HTMLDIR=$(VARLIBDIR)/html/common
95
96 .PHONY: install
97 install: $(INSTALLER_SOURCES) $(CARGO_COMPILEDIR)/proxmox-tui-installer
98 $(MAKE) -C banner install
99 $(MAKE) -C Proxmox install
100 install -D -m 644 interfaces $(DESTDIR)/etc/network/interfaces
101 install -D -m 755 fake-start-stop-daemon $(VARLIBDIR)/fake-start-stop-daemon
102 install -D -m 755 policy-disable-rc.d $(VARLIBDIR)/policy-disable-rc.d
103 install -D -m 644 country.dat $(VARLIBDIR)/country.dat
104 install -D -m 755 unconfigured.sh $(DESTDIR)/sbin/unconfigured.sh
105 install -D -m 755 proxinstall $(DESTDIR)/usr/bin/proxinstall
106 install -D -m 755 proxmox-low-level-installer $(DESTDIR)/$(BINDIR)/proxmox-low-level-installer
107 $(foreach i,$(USR_BIN), install -m755 $(CARGO_COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;)
108 install -D -m 755 checktime $(DESTDIR)/usr/bin/checktime
109 install -D -m 644 xinitrc $(DESTDIR)/.xinitrc
110 install -D -m 755 spice-vdagent.sh $(DESTDIR)/.spice-vdagent.sh
111 install -D -m 644 Xdefaults $(DESTDIR)/.Xdefaults
112
113 $(COMPILED_BINS): cargo-build
114 .PHONY: cargo-build
115 cargo-build:
116 $(CARGO) build --package proxmox-tui-installer --bin proxmox-tui-installer $(CARGO_BUILD_ARGS)
117
118 %-banner.png: %-banner.svg
119 rsvg-convert -o $@ $<
120
121 .PHONY: upload
122 upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
123 upload: $(DEB)
124 tar cf - $(DEB) | ssh -X repoman@repo.proxmox.com -- upload --product pve,pmg,pbs --dist $(UPLOAD_DIST)
125
126 %.img:
127 truncate -s 2G $@
128
129 %.big.img:
130 truncate -s 8G $@
131
132 .PHONY: prepare-check-env
133 prepare-check-env: test-$(DEB)
134 rm -rf testdir
135 dpkg -X test-$(DEB) testdir
136 mkdir -p testdir/run/proxmox-installer/
137
138 cd-info.test: PRODUCT ?= pve
139 cd-info.test:
140 printf '%s\n' "PRODUCT='$(or $(PRODUCT), pve)'" >$@.tmp
141 printf '%s\n' "PRODUCTLONG='$(or $(PRODUCTLONG), Proxmox VE)'" >>$@.tmp
142 printf '%s\n' "RELEASE='$(or $(RELEASE), 42.1)'" >>$@.tmp
143 printf '%s\n' "ISORELEASE='$(or $(ISORELEASE), 1)'" >>$@.tmp
144 printf '%s\n' "ISONAME='$(or $(ISONAME), proxmox-ve)'" >>$@.tmp
145 mv $@.tmp $@
146
147 check-pve: prepare-check-env test.img
148 rm -f cd-info.test; $(MAKE) cd-info.test
149 ./proxmox-low-level-installer dump-env -t test.img
150 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
151
152 check-pve-multidisks: prepare-check-env test.img test2.img test3.img test4.img test5.big.img
153 rm -f cd-info.test; $(MAKE) cd-info.test
154 ./proxmox-low-level-installer dump-env -t test.img,test2.img,test3.img,test4.img,test5.big.img
155 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
156
157 check-pve-tui: prepare-check-env test.img
158 rm -f cd-info.test; $(MAKE) cd-info.test
159 ./proxmox-low-level-installer dump-env -t test.img
160 testdir/usr/bin/proxmox-tui-installer -t test.img 2>testdir/run/stderr
161
162 check-pve-tui-multidisks: prepare-check-env test.img test2.img test3.img test4.img test5.big.img
163 rm -f cd-info.test; $(MAKE) cd-info.test
164 ./proxmox-low-level-installer dump-env -t test.img,test2.img,test3.img,test4.img,test5.big.img
165 testdir/usr/bin/proxmox-tui-installer -t test.img,test2.img,test3.img,test4.img,test5.big.img
166
167 prepare-check-pmg: prepare-check-env test.img
168 rm -f cd-info.test; $(MAKE) \
169 PRODUCT=pmg \
170 PRODUCTLONG="Proxmox Mail Gateway" \
171 ISONAME='proxmox-mail-gateway' \
172 cd-info.test
173 ./proxmox-low-level-installer dump-env -t test.img
174
175 check-pmg: prepare-check-pmg
176 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
177
178 check-pmg-tui: prepare-check-pmg
179 testdir/usr/bin/proxmox-tui-installer -t test.img 2>testdir/run/stderr
180
181 prepare-check-pbs: prepare-check-env test.img
182 rm -f cd-info.test; $(MAKE) \
183 PRODUCT='pbs' \
184 PRODUCTLONG='Proxmox Backup Server' \
185 ISONAME='proxmox-backup-server' \
186 cd-info.test
187 ./proxmox-low-level-installer dump-env -t test.img
188
189 check-pbs: prepare-check-pbs
190 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
191
192 check-pbs-tui: prepare-check-pbs
193 testdir/usr/bin/proxmox-tui-installer -t test.img 2>testdir/run/stderr
194
195 .phony: clean
196 clean:
197 rm -rf target build $(PACKAGE)-[0-9]* testdir
198 rm -f $(PACKAGE)*.tar* *.deb packages packages.tmp *.build *.dsc *.buildinfo *.changes
199 rm -f test*.img pve-final.pkglist country.dat final.pkglist cd-info.test
200 find . -name '*~' -exec rm {} ';'