]> git.proxmox.com Git - pve-installer.git/blame - Makefile
auto installer: rework sys-info struct layout and add more details
[pve-installer.git] / Makefile
CommitLineData
aee9344c 1include /usr/share/dpkg/default.mk
6db9b06a 2
9cdfeefc 3PACKAGE = proxmox-installer
59597871
TL
4BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
5
aee9344c 6DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
d6b9b8ec 7ASSISTANT_DEB=proxmox-auto-install-assistant_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
0190a299 8DSC=$(PACKAGE)_$(DEB_VERSION).dsc
e70f1b2f 9
9cdfeefc 10CARGO ?= cargo
e70f1b2f
CH
11ifeq ($(BUILD_MODE), release)
12CARGO_BUILD_ARGS += --release
13CARGO_COMPILEDIR := target/release
14else
15CARGO_COMPILEDIR := target/debug
16endif
17
f3521633 18INSTALLER_SOURCES=$(shell git ls-files) country.dat
89a12446 19
aee9344c
TL
20PREFIX = /usr
21BINDIR = $(PREFIX)/bin
781f879e 22USR_BIN := \
1e79b3f1 23 proxmox-chroot\
781f879e 24 proxmox-tui-installer\
2949f825 25 proxmox-fetch-answer\
2721bd70 26 proxmox-auto-install-assistant \
781f879e 27 proxmox-auto-installer
aee9344c
TL
28
29COMPILED_BINS := \
30 $(addprefix $(CARGO_COMPILEDIR)/,$(USR_BIN))
31
126379f6
CH
32SHELL_SCRIPTS := \
33 fake-start-stop-daemon \
34 policy-disable-rc.d \
35 spice-vdagent.sh \
36 unconfigured.sh \
37 xinitrc
38
f3521633 39all:
f0583fd4 40
59597871
TL
41$(BUILDDIR):
42 rm -rf $@ $@.tmp; mkdir $@.tmp
43 cp -a \
0a48c149 44 .cargo \
59597871
TL
45 Cargo.toml \
46 Makefile \
47 Proxmox/ \
48 Xdefaults \
49 banner/ \
50 checktime \
51 country.pl \
59597871
TL
52 html/ \
53 interfaces \
59597871
TL
54 proxinstall \
55 proxmox-low-level-installer \
c7edc2e1 56 proxmox-auto-installer/ \
2721bd70 57 proxmox-auto-install-assistant/ \
eedc6521 58 proxmox-fetch-answer/ \
1e79b3f1 59 proxmox-chroot \
59597871 60 proxmox-tui-installer/ \
2f65a616 61 proxmox-installer-common/ \
9a0d66cb 62 test/ \
126379f6 63 $(SHELL_SCRIPTS) \
59597871
TL
64 $@.tmp
65 cp -a debian $@.tmp/
66 mv $@.tmp $@
67
f0583fd4 68country.dat: country.pl
fc2c6d3e
TL
69 ./country.pl > country.dat.tmp
70 mv country.dat.tmp country.dat
780479c5 71
99f0b523 72deb: $(DEB)
d6b9b8ec 73$(ASSISTANT_DEB): $(DEB)
59597871
TL
74$(DEB): $(BUILDDIR)
75 cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
99f0b523 76 lintian $(DEB)
c2f72dd6 77
6ec8d163 78test-$(DEB): $(INSTALLER_SOURCES)
63ce0b1a 79 rsync --exclude='test*.img' --exclude='*.deb' --exclude='build' -a * build
6ec8d163
TL
80 cd build; dpkg-buildpackage -b -us -uc -nc
81 mv $(DEB) test-$(DEB)
82
0190a299
TL
83dsc: $(DSC)
84 $(MAKE) clean
85 $(MAKE) $(DSC)
86 lintian $(DSC)
87
88$(DSC): $(BUILDDIR)
89 cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
90
91sbuild: $(DSC)
92 sbuild $(DSC)
93
0fb71c2c
CH
94.PHONY: prepare-test-env
95prepare-test-env: cd-info.test country.dat test.img
96 rm -rf testdir
97 mkdir -p testdir/var/lib/proxmox-installer/
98 cp -v country.dat testdir/var/lib/proxmox-installer/
99 ./proxmox-low-level-installer -t test.img dump-env
100
9a0d66cb 101.PHONY: test
0fb71c2c 102test: prepare-test-env
126379f6 103 shellcheck $(SHELL_SCRIPTS)
9a0d66cb 104 $(MAKE) -C test check
a199276f
CH
105 $(CARGO) test --workspace $(CARGO_BUILD_ARGS)
106
c2f72dd6
TL
107DESTDIR=
108VARLIBDIR=$(DESTDIR)/var/lib/proxmox-installer
109HTMLDIR=$(VARLIBDIR)/html/common
89a12446 110
c2f72dd6 111.PHONY: install
781f879e 112install: $(INSTALLER_SOURCES) $(COMPILED_BINS)
c2f72dd6 113 $(MAKE) -C banner install
ab97da2c 114 $(MAKE) -C Proxmox install
99f0b523
TL
115 install -D -m 644 interfaces $(DESTDIR)/etc/network/interfaces
116 install -D -m 755 fake-start-stop-daemon $(VARLIBDIR)/fake-start-stop-daemon
c2f72dd6
TL
117 install -D -m 755 policy-disable-rc.d $(VARLIBDIR)/policy-disable-rc.d
118 install -D -m 644 country.dat $(VARLIBDIR)/country.dat
99f0b523
TL
119 install -D -m 755 unconfigured.sh $(DESTDIR)/sbin/unconfigured.sh
120 install -D -m 755 proxinstall $(DESTDIR)/usr/bin/proxinstall
aee9344c 121 install -D -m 755 proxmox-low-level-installer $(DESTDIR)/$(BINDIR)/proxmox-low-level-installer
1458d7a2 122 $(foreach i,$(USR_BIN), install -m755 $(CARGO_COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;)
99f0b523
TL
123 install -D -m 755 checktime $(DESTDIR)/usr/bin/checktime
124 install -D -m 644 xinitrc $(DESTDIR)/.xinitrc
125 install -D -m 755 spice-vdagent.sh $(DESTDIR)/.spice-vdagent.sh
126 install -D -m 644 Xdefaults $(DESTDIR)/.Xdefaults
89a12446 127
0889f35d
TL
128$(COMPILED_BINS): cargo-build
129.PHONY: cargo-build
130cargo-build:
781f879e 131 $(CARGO) build --package proxmox-tui-installer --bin proxmox-tui-installer \
2949f825 132 --package proxmox-auto-installer --bin proxmox-auto-installer \
eedc6521 133 --package proxmox-fetch-answer --bin proxmox-fetch-answer \
2721bd70 134 --package proxmox-auto-install-assistant --bin proxmox-auto-install-assistant \
1e79b3f1 135 --package proxmox-chroot --bin proxmox-chroot $(CARGO_BUILD_ARGS)
aee9344c 136
c2f72dd6 137%-banner.png: %-banner.svg
9b9ddfce 138 rsvg-convert -o $@ $<
782b4acd 139
c2f72dd6 140.PHONY: upload
e23aeee4 141upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
d6b9b8ec
TL
142upload: $(DEB) $(ASSISTANT_DEB)
143 tar cf - $(DEB) $(ASSISTANT_DEB) | ssh -X repoman@repo.proxmox.com -- upload --product pve,pmg,pbs --dist $(UPLOAD_DIST)
89a12446 144
76960140
TL
145%.img:
146 truncate -s 2G $@
89a12446 147
4a96f472
TL
148%.big.img:
149 truncate -s 8G $@
150
c2f72dd6 151.PHONY: prepare-check-env
6ec8d163 152prepare-check-env: test-$(DEB)
92cbd446 153 rm -rf testdir
6ec8d163 154 dpkg -X test-$(DEB) testdir
2630cca4 155 mkdir -p testdir/run/proxmox-installer/
c2f72dd6 156
29f32406
TL
157cd-info.test: PRODUCT ?= pve
158cd-info.test:
413ca90b
TL
159 printf '%s\n' "PRODUCT='$(or $(PRODUCT), pve)'" >$@.tmp
160 printf '%s\n' "PRODUCTLONG='$(or $(PRODUCTLONG), Proxmox VE)'" >>$@.tmp
161 printf '%s\n' "RELEASE='$(or $(RELEASE), 42.1)'" >>$@.tmp
162 printf '%s\n' "ISORELEASE='$(or $(ISORELEASE), 1)'" >>$@.tmp
163 printf '%s\n' "ISONAME='$(or $(ISONAME), proxmox-ve)'" >>$@.tmp
29f32406
TL
164 mv $@.tmp $@
165
c2f72dd6 166check-pve: prepare-check-env test.img
413ca90b 167 rm -f cd-info.test; $(MAKE) cd-info.test
4b4dfa12 168 ./proxmox-low-level-installer dump-env -t test.img
92cbd446 169 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
89a12446 170
4a96f472 171check-pve-multidisks: prepare-check-env test.img test2.img test3.img test4.img test5.big.img
413ca90b 172 rm -f cd-info.test; $(MAKE) cd-info.test
4b4dfa12 173 ./proxmox-low-level-installer dump-env -t test.img,test2.img,test3.img,test4.img,test5.big.img
4a96f472 174 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 175
0cf4be7d
TL
176check-pve-tui: prepare-check-env test.img
177 rm -f cd-info.test; $(MAKE) cd-info.test
4b4dfa12 178 ./proxmox-low-level-installer dump-env -t test.img
9ed18269 179 testdir/usr/bin/proxmox-tui-installer -t test.img 2>testdir/run/stderr
0cf4be7d 180
4b4dfa12
CH
181check-pve-tui-multidisks: prepare-check-env test.img test2.img test3.img test4.img test5.big.img
182 rm -f cd-info.test; $(MAKE) cd-info.test
183 ./proxmox-low-level-installer dump-env -t test.img,test2.img,test3.img,test4.img,test5.big.img
184 testdir/usr/bin/proxmox-tui-installer -t test.img,test2.img,test3.img,test4.img,test5.big.img
185
7e569bd6 186prepare-check-pmg: prepare-check-env test.img
413ca90b
TL
187 rm -f cd-info.test; $(MAKE) \
188 PRODUCT=pmg \
189 PRODUCTLONG="Proxmox Mail Gateway" \
190 ISONAME='proxmox-mail-gateway' \
191 cd-info.test
4b4dfa12 192 ./proxmox-low-level-installer dump-env -t test.img
7e569bd6
TL
193
194check-pmg: prepare-check-pmg
a8213c0e
DM
195 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
196
7e569bd6 197check-pmg-tui: prepare-check-pmg
9ed18269 198 testdir/usr/bin/proxmox-tui-installer -t test.img 2>testdir/run/stderr
7e569bd6 199
ce76d4c0 200prepare-check-pbs: prepare-check-env test.img
413ca90b
TL
201 rm -f cd-info.test; $(MAKE) \
202 PRODUCT='pbs' \
203 PRODUCTLONG='Proxmox Backup Server' \
204 ISONAME='proxmox-backup-server' \
205 cd-info.test
4b4dfa12 206 ./proxmox-low-level-installer dump-env -t test.img
ce76d4c0
TL
207
208check-pbs: prepare-check-pbs
53748662
OB
209 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
210
ce76d4c0 211check-pbs-tui: prepare-check-pbs
9ed18269 212 testdir/usr/bin/proxmox-tui-installer -t test.img 2>testdir/run/stderr
53748662 213
89a12446
DM
214.phony: clean
215clean:
5a947984 216 rm -rf target build $(PACKAGE)-[0-9]* testdir
2d5382e8 217 rm -f $(PACKAGE)*.tar* *.deb packages packages.tmp *.build *.dsc *.buildinfo *.changes
5a947984 218 rm -f test*.img pve-final.pkglist country.dat final.pkglist cd-info.test
b1e23923 219 find . -name '*~' -exec rm {} ';'