]> git.proxmox.com Git - pve-installer.git/blame - Makefile
package rust based TUI installer prototype
[pve-installer.git] / Makefile
CommitLineData
aee9344c 1include /usr/share/dpkg/default.mk
6db9b06a 2
9cdfeefc 3PACKAGE = proxmox-installer
aee9344c 4DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
e70f1b2f 5
9cdfeefc 6CARGO ?= cargo
e70f1b2f
CH
7ifeq ($(BUILD_MODE), release)
8CARGO_BUILD_ARGS += --release
9CARGO_COMPILEDIR := target/release
10else
11CARGO_COMPILEDIR := target/debug
12endif
13
f3521633 14INSTALLER_SOURCES=$(shell git ls-files) country.dat
89a12446 15
aee9344c
TL
16PREFIX = /usr
17BINDIR = $(PREFIX)/bin
18USR_BIN := proxmox-tui-installer
19
20COMPILED_BINS := \
21 $(addprefix $(CARGO_COMPILEDIR)/,$(USR_BIN))
22
f3521633 23all:
f0583fd4
DM
24
25country.dat: country.pl
fc2c6d3e
TL
26 ./country.pl > country.dat.tmp
27 mv country.dat.tmp country.dat
780479c5 28
c2f72dd6 29deb: ${DEB}
f3521633 30${DEB}: ${INSTALLER_SOURCES}
bf1de878 31 rsync --exclude='test*.img' -a * build
c5582ca4 32 cd build; dpkg-buildpackage -b -us -uc
c2f72dd6
TL
33 lintian ${DEB}
34
35DESTDIR=
36VARLIBDIR=$(DESTDIR)/var/lib/proxmox-installer
37HTMLDIR=$(VARLIBDIR)/html/common
89a12446 38
c2f72dd6 39.PHONY: install
aee9344c 40install: ${INSTALLER_SOURCES} $(CARGO_COMPILEDIR)/proxmox-tui-installer
c2f72dd6 41 $(MAKE) -C banner install
ab97da2c 42 $(MAKE) -C Proxmox install
89a12446 43 install -D -m 644 interfaces ${DESTDIR}/etc/network/interfaces
c2f72dd6
TL
44 install -D -m 755 fake-start-stop-daemon ${VARLIBDIR}/fake-start-stop-daemon
45 install -D -m 755 policy-disable-rc.d $(VARLIBDIR)/policy-disable-rc.d
46 install -D -m 644 country.dat $(VARLIBDIR)/country.dat
89a12446
DM
47 install -D -m 755 unconfigured.sh ${DESTDIR}/sbin/unconfigured.sh
48 install -D -m 755 proxinstall ${DESTDIR}/usr/bin/proxinstall
aee9344c
TL
49 install -D -m 755 proxmox-low-level-installer $(DESTDIR)/$(BINDIR)/proxmox-low-level-installer
50 $(foreach i,$(USR_BIN), install -m755 $(CARGO_COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/)
89a12446
DM
51 install -D -m 755 checktime ${DESTDIR}/usr/bin/checktime
52 install -D -m 644 xinitrc ${DESTDIR}/.xinitrc
fb7bdbd4 53 install -D -m 755 spice-vdagent.sh ${DESTDIR}/.spice-vdagent.sh
89a12446 54 install -D -m 644 Xdefaults ${DESTDIR}/.Xdefaults
89a12446 55
aee9344c
TL
56$(COMPILED_BINS):
57 $(CARGO) build --package proxmox-tui-installer --bin proxmox-tui-installer $(CARGO_BUILD_ARGS)
58
c2f72dd6 59%-banner.png: %-banner.svg
9b9ddfce 60 rsvg-convert -o $@ $<
782b4acd 61
c2f72dd6 62.PHONY: upload
e23aeee4
TL
63upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
64upload: $(DEB)
65 tar cf - ${DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pve,pmg,pbs --dist $(UPLOAD_DIST)
89a12446 66
76960140
TL
67%.img:
68 truncate -s 2G $@
89a12446 69
4a96f472
TL
70%.big.img:
71 truncate -s 8G $@
72
c2f72dd6
TL
73.PHONY: prepare-check-env
74prepare-check-env: $(DEB)
56510a19 75 umount -Rd testdir || true
92cbd446 76 rm -rf testdir
c2f72dd6
TL
77 dpkg -X $(DEB) testdir
78
29f32406
TL
79cd-info.test: PRODUCT ?= pve
80cd-info.test:
413ca90b
TL
81 printf '%s\n' "PRODUCT='$(or $(PRODUCT), pve)'" >$@.tmp
82 printf '%s\n' "PRODUCTLONG='$(or $(PRODUCTLONG), Proxmox VE)'" >>$@.tmp
83 printf '%s\n' "RELEASE='$(or $(RELEASE), 42.1)'" >>$@.tmp
84 printf '%s\n' "ISORELEASE='$(or $(ISORELEASE), 1)'" >>$@.tmp
85 printf '%s\n' "ISONAME='$(or $(ISONAME), proxmox-ve)'" >>$@.tmp
29f32406
TL
86 mv $@.tmp $@
87
c2f72dd6 88check-pve: prepare-check-env test.img
413ca90b 89 rm -f cd-info.test; $(MAKE) cd-info.test
92cbd446 90 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
89a12446 91
4a96f472 92check-pve-multidisks: prepare-check-env test.img test2.img test3.img test4.img test5.big.img
413ca90b 93 rm -f cd-info.test; $(MAKE) cd-info.test
4a96f472 94 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 95
c2f72dd6 96check-pmg: prepare-check-env test.img
413ca90b
TL
97 rm -f cd-info.test; $(MAKE) \
98 PRODUCT=pmg \
99 PRODUCTLONG="Proxmox Mail Gateway" \
100 ISONAME='proxmox-mail-gateway' \
101 cd-info.test
a8213c0e
DM
102 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
103
c2f72dd6 104check-pbs: prepare-check-env test.img
413ca90b
TL
105 rm -f cd-info.test; $(MAKE) \
106 PRODUCT='pbs' \
107 PRODUCTLONG='Proxmox Backup Server' \
108 ISONAME='proxmox-backup-server' \
109 cd-info.test
53748662
OB
110 G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
111
112
89a12446
DM
113.phony: clean
114clean:
56510a19 115 umount -Rd testdir || true
c9b46f90
TL
116 rm -rf *~ *.deb target build packages packages.tmp testdir test*.img pve-final.pkglist \
117 *.buildinfo *.changes country.dat final.pkglist cd-info.test
b1e23923 118 find . -name '*~' -exec rm {} ';'