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