]> git.proxmox.com Git - pve-installer.git/blame_incremental - Makefile
unconfigured.sh: set serial to a number to prevent warning
[pve-installer.git] / Makefile
... / ...
CommitLineData
1include /usr/share/dpkg/default.mk
2
3PACKAGE = proxmox-installer
4BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
5
6DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
7DSC=$(PACKAGE)_$(DEB_VERSION).dsc
8
9CARGO ?= cargo
10ifeq ($(BUILD_MODE), release)
11CARGO_BUILD_ARGS += --release
12CARGO_COMPILEDIR := target/release
13else
14CARGO_COMPILEDIR := target/debug
15endif
16
17INSTALLER_SOURCES=$(shell git ls-files) country.dat
18
19PREFIX = /usr
20BINDIR = $(PREFIX)/bin
21USR_BIN := proxmox-tui-installer
22
23COMPILED_BINS := \
24 $(addprefix $(CARGO_COMPILEDIR)/,$(USR_BIN))
25
26all:
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
55country.dat: country.pl
56 ./country.pl > country.dat.tmp
57 mv country.dat.tmp country.dat
58
59deb: $(DEB)
60$(DEB): $(BUILDDIR)
61 cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
62 lintian $(DEB)
63
64test-$(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
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
80.PHONY: test
81test:
82 $(MAKE) -C test check
83 $(CARGO) test --workspace $(CARGO_BUILD_ARGS)
84
85DESTDIR=
86VARLIBDIR=$(DESTDIR)/var/lib/proxmox-installer
87HTMLDIR=$(VARLIBDIR)/html/common
88
89.PHONY: install
90install: $(INSTALLER_SOURCES) $(CARGO_COMPILEDIR)/proxmox-tui-installer
91 $(MAKE) -C banner install
92 $(MAKE) -C Proxmox install
93 install -D -m 644 interfaces $(DESTDIR)/etc/network/interfaces
94 install -D -m 755 fake-start-stop-daemon $(VARLIBDIR)/fake-start-stop-daemon
95 install -D -m 755 policy-disable-rc.d $(VARLIBDIR)/policy-disable-rc.d
96 install -D -m 644 country.dat $(VARLIBDIR)/country.dat
97 install -D -m 755 unconfigured.sh $(DESTDIR)/sbin/unconfigured.sh
98 install -D -m 755 proxinstall $(DESTDIR)/usr/bin/proxinstall
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)/)
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
105
106$(COMPILED_BINS): cargo-build
107.PHONY: cargo-build
108cargo-build:
109 $(CARGO) build --package proxmox-tui-installer --bin proxmox-tui-installer $(CARGO_BUILD_ARGS)
110
111%-banner.png: %-banner.svg
112 rsvg-convert -o $@ $<
113
114.PHONY: upload
115upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
116upload: $(DEB)
117 tar cf - $(DEB) | ssh -X repoman@repo.proxmox.com -- upload --product pve,pmg,pbs --dist $(UPLOAD_DIST)
118
119%.img:
120 truncate -s 2G $@
121
122%.big.img:
123 truncate -s 8G $@
124
125.PHONY: prepare-check-env
126prepare-check-env: test-$(DEB)
127 rm -rf testdir
128 dpkg -X test-$(DEB) testdir
129 mkdir -p testdir/run/proxmox-installer/
130
131cd-info.test: PRODUCT ?= pve
132cd-info.test:
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
138 mv $@.tmp $@
139
140check-pve: prepare-check-env test.img
141 rm -f cd-info.test; $(MAKE) cd-info.test
142 ./proxmox-low-level-installer dump-env -t test.img
143 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
144
145check-pve-multidisks: prepare-check-env test.img test2.img test3.img test4.img test5.big.img
146 rm -f cd-info.test; $(MAKE) cd-info.test
147 ./proxmox-low-level-installer dump-env -t test.img,test2.img,test3.img,test4.img,test5.big.img
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
149
150check-pve-tui: prepare-check-env test.img
151 rm -f cd-info.test; $(MAKE) cd-info.test
152 ./proxmox-low-level-installer dump-env -t test.img
153 testdir/usr/bin/proxmox-tui-installer -t test.img 2>testdir/run/stderr
154
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
160prepare-check-pmg: prepare-check-env test.img
161 rm -f cd-info.test; $(MAKE) \
162 PRODUCT=pmg \
163 PRODUCTLONG="Proxmox Mail Gateway" \
164 ISONAME='proxmox-mail-gateway' \
165 cd-info.test
166 ./proxmox-low-level-installer dump-env -t test.img
167
168check-pmg: prepare-check-pmg
169 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
170
171check-pmg-tui: prepare-check-pmg
172 testdir/usr/bin/proxmox-tui-installer -t test.img 2>testdir/run/stderr
173
174prepare-check-pbs: prepare-check-env test.img
175 rm -f cd-info.test; $(MAKE) \
176 PRODUCT='pbs' \
177 PRODUCTLONG='Proxmox Backup Server' \
178 ISONAME='proxmox-backup-server' \
179 cd-info.test
180 ./proxmox-low-level-installer dump-env -t test.img
181
182check-pbs: prepare-check-pbs
183 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
184
185check-pbs-tui: prepare-check-pbs
186 testdir/usr/bin/proxmox-tui-installer -t test.img 2>testdir/run/stderr
187
188.phony: clean
189clean:
190 rm -rf target build $(PACKAGE)-[0-9]* testdir
191 rm -f $(PACKAGE)*.tar* *.deb packages packages.tmp *.build *.dsc *.buildinfo *.changes
192 rm -f test*.img pve-final.pkglist country.dat final.pkglist cd-info.test
193 find . -name '*~' -exec rm {} ';'