pve-installer/Makefile
Thomas Lamprecht aee9344c83 package rust based TUI installer prototype
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-19 12:19:37 +02:00

119 lines
3.8 KiB
Makefile

include /usr/share/dpkg/default.mk
PACKAGE = proxmox-installer
DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
CARGO ?= cargo
ifeq ($(BUILD_MODE), release)
CARGO_BUILD_ARGS += --release
CARGO_COMPILEDIR := target/release
else
CARGO_COMPILEDIR := target/debug
endif
INSTALLER_SOURCES=$(shell git ls-files) country.dat
PREFIX = /usr
BINDIR = $(PREFIX)/bin
USR_BIN := proxmox-tui-installer
COMPILED_BINS := \
$(addprefix $(CARGO_COMPILEDIR)/,$(USR_BIN))
all:
country.dat: country.pl
./country.pl > country.dat.tmp
mv country.dat.tmp country.dat
deb: ${DEB}
${DEB}: ${INSTALLER_SOURCES}
rsync --exclude='test*.img' -a * build
cd build; dpkg-buildpackage -b -us -uc
lintian ${DEB}
DESTDIR=
VARLIBDIR=$(DESTDIR)/var/lib/proxmox-installer
HTMLDIR=$(VARLIBDIR)/html/common
.PHONY: install
install: ${INSTALLER_SOURCES} $(CARGO_COMPILEDIR)/proxmox-tui-installer
$(MAKE) -C banner install
$(MAKE) -C Proxmox install
install -D -m 644 interfaces ${DESTDIR}/etc/network/interfaces
install -D -m 755 fake-start-stop-daemon ${VARLIBDIR}/fake-start-stop-daemon
install -D -m 755 policy-disable-rc.d $(VARLIBDIR)/policy-disable-rc.d
install -D -m 644 country.dat $(VARLIBDIR)/country.dat
install -D -m 755 unconfigured.sh ${DESTDIR}/sbin/unconfigured.sh
install -D -m 755 proxinstall ${DESTDIR}/usr/bin/proxinstall
install -D -m 755 proxmox-low-level-installer $(DESTDIR)/$(BINDIR)/proxmox-low-level-installer
$(foreach i,$(USR_BIN), install -m755 $(CARGO_COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/)
install -D -m 755 checktime ${DESTDIR}/usr/bin/checktime
install -D -m 644 xinitrc ${DESTDIR}/.xinitrc
install -D -m 755 spice-vdagent.sh ${DESTDIR}/.spice-vdagent.sh
install -D -m 644 Xdefaults ${DESTDIR}/.Xdefaults
$(COMPILED_BINS):
$(CARGO) build --package proxmox-tui-installer --bin proxmox-tui-installer $(CARGO_BUILD_ARGS)
%-banner.png: %-banner.svg
rsvg-convert -o $@ $<
.PHONY: upload
upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
upload: $(DEB)
tar cf - ${DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pve,pmg,pbs --dist $(UPLOAD_DIST)
%.img:
truncate -s 2G $@
%.big.img:
truncate -s 8G $@
.PHONY: prepare-check-env
prepare-check-env: $(DEB)
umount -Rd testdir || true
rm -rf testdir
dpkg -X $(DEB) testdir
cd-info.test: PRODUCT ?= pve
cd-info.test:
printf '%s\n' "PRODUCT='$(or $(PRODUCT), pve)'" >$@.tmp
printf '%s\n' "PRODUCTLONG='$(or $(PRODUCTLONG), Proxmox VE)'" >>$@.tmp
printf '%s\n' "RELEASE='$(or $(RELEASE), 42.1)'" >>$@.tmp
printf '%s\n' "ISORELEASE='$(or $(ISORELEASE), 1)'" >>$@.tmp
printf '%s\n' "ISONAME='$(or $(ISONAME), proxmox-ve)'" >>$@.tmp
mv $@.tmp $@
check-pve: prepare-check-env test.img
rm -f cd-info.test; $(MAKE) cd-info.test
G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
check-pve-multidisks: prepare-check-env test.img test2.img test3.img test4.img test5.big.img
rm -f cd-info.test; $(MAKE) cd-info.test
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
check-pmg: prepare-check-env test.img
rm -f cd-info.test; $(MAKE) \
PRODUCT=pmg \
PRODUCTLONG="Proxmox Mail Gateway" \
ISONAME='proxmox-mail-gateway' \
cd-info.test
G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
check-pbs: prepare-check-env test.img
rm -f cd-info.test; $(MAKE) \
PRODUCT='pbs' \
PRODUCTLONG='Proxmox Backup Server' \
ISONAME='proxmox-backup-server' \
cd-info.test
G_SLICE=always-malloc perl -I testdir/usr/share/perl5 testdir/usr/bin/proxinstall -t test.img
.phony: clean
clean:
umount -Rd testdir || true
rm -rf *~ *.deb target build packages packages.tmp testdir test*.img pve-final.pkglist \
*.buildinfo *.changes country.dat final.pkglist cd-info.test
find . -name '*~' -exec rm {} ';'