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