don't hardcode /usr/share paths
Add a defines.mk file defining the standard default layout for installation (PREFIX, DATAROOTDIR, LIBDIR etc.). Add a $(JSDIR) variable and use env!("JSDIR") in place of the hardcoded /usr/share/javascript/proxmox-backup path. Have defines.mk include an *optional* local.mak to override JSDIR to www/ during local development. Add `make install` targets and remove debian/install. Note that service files are now in $libdir/proxmox-backup/ as there's usually no point in starting them from the command line, so /usr/sbin makes no sense. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
9fa03fa2d3
commit
6285b251e7
47
Makefile
47
Makefile
|
@ -1,14 +1,31 @@
|
||||||
PACKAGE=proxmox-backup
|
include defines.mk
|
||||||
PKGVER=0.1
|
|
||||||
PKGREL=1
|
|
||||||
|
|
||||||
ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
|
ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
|
||||||
GITVERSION:=$(shell git rev-parse HEAD)
|
GITVERSION:=$(shell git rev-parse HEAD)
|
||||||
|
|
||||||
|
# Binaries usable by users
|
||||||
|
USR_BIN := \
|
||||||
|
proxmox-backup-client \
|
||||||
|
catar
|
||||||
|
|
||||||
|
# Binaries usable by admins
|
||||||
|
USR_SBIN := proxmox-backup-manager
|
||||||
|
|
||||||
|
# Binaries for services:
|
||||||
|
SERVICE_BIN := \
|
||||||
|
proxmox-backup-api \
|
||||||
|
proxmox-backup-proxy
|
||||||
|
|
||||||
|
COMPILEDIR := target/release
|
||||||
|
COMPILED_BINS := \
|
||||||
|
$(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN))
|
||||||
|
|
||||||
export PROXMOX_PKG_VERSION=${PKGVER}
|
export PROXMOX_PKG_VERSION=${PKGVER}
|
||||||
export PROXMOX_PKG_RELEASE=${PKGREL}
|
export PROXMOX_PKG_RELEASE=${PKGREL}
|
||||||
export PROXMOX_PKG_REPOID=${GITVERSION}
|
export PROXMOX_PKG_REPOID=${GITVERSION}
|
||||||
|
|
||||||
|
export PROXMOX_JSDIR := $(JSDIR)
|
||||||
|
|
||||||
DEB=${PACKAGE}_${PKGVER}-${PKGREL}_${ARCH}.deb
|
DEB=${PACKAGE}_${PKGVER}-${PKGREL}_${ARCH}.deb
|
||||||
|
|
||||||
DESTDIR=
|
DESTDIR=
|
||||||
|
@ -24,15 +41,15 @@ deb ${DEB}:
|
||||||
rm -rf build
|
rm -rf build
|
||||||
# build here to cache results
|
# build here to cache results
|
||||||
cargo build --release
|
cargo build --release
|
||||||
make -C www
|
$(MAKE) -C www
|
||||||
rsync -a debian Cargo.lock Cargo.toml src www target build
|
rsync -a debian Cargo.toml src www etc target build
|
||||||
cd build; dpkg-buildpackage -b -us -uc
|
cd build; dpkg-buildpackage -b -us -uc
|
||||||
|
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
make -C www clean
|
$(MAKE) -C www clean
|
||||||
cargo clean
|
cargo clean
|
||||||
rm -rf *.deb *.buildinfo *.changes build
|
rm -rf *.deb *.buildinfo *.changes build
|
||||||
find . -name '*~' -exec rm {} ';'
|
find . -name '*~' -exec rm {} ';'
|
||||||
|
@ -40,3 +57,21 @@ clean:
|
||||||
.PHONY: dinstall
|
.PHONY: dinstall
|
||||||
dinstall: ${DEB}
|
dinstall: ${DEB}
|
||||||
dpkg -i ${DEB}
|
dpkg -i ${DEB}
|
||||||
|
|
||||||
|
.PHONY: build-release
|
||||||
|
build-release:
|
||||||
|
cargo build --release
|
||||||
|
|
||||||
|
$(COMPILED_BINS): build-release
|
||||||
|
|
||||||
|
install: $(COMPILED_BINS)
|
||||||
|
install -dm755 $(DESTDIR)$(BINDIR)
|
||||||
|
$(foreach i,$(USR_BIN), \
|
||||||
|
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;)
|
||||||
|
install -dm755 $(DESTDIR)$(SBINDIR)
|
||||||
|
$(foreach i,$(USR_SBIN), \
|
||||||
|
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ;)
|
||||||
|
install -dm755 $(DESTDIR)$(LIBDIR)/proxmox-backup
|
||||||
|
$(foreach i,$(SERVICE_BIN), \
|
||||||
|
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBDIR)/proxmox-backup/ ;)
|
||||||
|
$(MAKE) -C www install
|
||||||
|
|
|
@ -1,8 +1,2 @@
|
||||||
target/release/proxmox-backup-api /usr/sbin
|
etc/proxmox-backup.service /lib/systemd/system/
|
||||||
target/release/proxmox-backup-proxy /usr/bin
|
etc/proxmox-backup-proxy.service /lib/systemd/system/
|
||||||
target/release/proxmox-backup-manager /usr/sbin
|
|
||||||
target/release/proxmox-backup-client /usr/sbin
|
|
||||||
target/release/catar /usr/sbin
|
|
||||||
www/images/logo-128.png /usr/share/javascript/proxmox-backup/images/
|
|
||||||
www/images/proxmox_logo.png /usr/share/javascript/proxmox-backup/images/
|
|
||||||
www/js/proxmox-backup-gui.js /usr/share/javascript/proxmox-backup/js/
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Proxmox API Proxy Server
|
|
||||||
ConditionPathExists=/usr/bin/proxmox-backup-proxy
|
|
||||||
Wants=proxmox-backup.service
|
|
||||||
After=syslog.service
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
User=www-data
|
|
||||||
Group=www-data
|
|
||||||
ExecStart=/usr/bin/proxmox-backup-proxy start
|
|
||||||
Type=simple
|
|
||||||
Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,13 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Proxmox API Test Server
|
|
||||||
ConditionPathExists=/usr/sbin/proxmox-backup-api
|
|
||||||
After=syslog.service
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=/usr/sbin/proxmox-backup-api start
|
|
||||||
Type=simple
|
|
||||||
Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -7,6 +7,8 @@
|
||||||
%:
|
%:
|
||||||
dh $@ --with=systemd --with=bash-completion
|
dh $@ --with=systemd --with=bash-completion
|
||||||
|
|
||||||
|
override_dh_autobuild:
|
||||||
|
make PROXY_USER=www-data
|
||||||
|
|
||||||
override_dh_installinit:
|
override_dh_installinit:
|
||||||
dh_installinit
|
dh_installinit
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
PACKAGE := proxmox-backup
|
||||||
|
PKGVER := 0.1
|
||||||
|
PKGREL := 1
|
||||||
|
|
||||||
|
PREFIX := /usr
|
||||||
|
BINDIR := $(PREFIX)/bin
|
||||||
|
SBINDIR := $(PREFIX)/sbin
|
||||||
|
LIBDIR := $(PREFIX)/lib
|
||||||
|
DATAROOTDIR := $(PREFIX)/share
|
||||||
|
JSDIR := $(DATAROOTDIR)/javascript/proxmox-backup
|
||||||
|
|
||||||
|
# For local overrides
|
||||||
|
-include local.mak
|
|
@ -0,0 +1,18 @@
|
||||||
|
include ../defines.mk
|
||||||
|
|
||||||
|
UNITS := \
|
||||||
|
proxmox-backup.service \
|
||||||
|
proxmox-backup-proxy.service
|
||||||
|
|
||||||
|
all: $(UNITS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(UNITS)
|
||||||
|
|
||||||
|
.SUFFIXES: .service.in .service
|
||||||
|
.service.in.service:
|
||||||
|
sed \
|
||||||
|
-e 's!%LIBDIR%!$(LIBDIR)!g' \
|
||||||
|
-e 's!%PROXY_USER%!$(PROXY_USER)!g' \
|
||||||
|
$< >$@.tmp
|
||||||
|
mv $@.tmp $@
|
|
@ -0,0 +1,15 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Proxmox Backup API Proxy Server
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network.target syslog.service
|
||||||
|
Requires=proxmox-backup.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=%LIBDIR%/proxmox-backup/proxmox-backup-proxy
|
||||||
|
Restart=on-failure
|
||||||
|
User=%PROXY_USER%
|
||||||
|
Group=%PROXY_USER%
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -0,0 +1,12 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Proxmox Backup API Server
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network.target syslog.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=%LIBDIR%/proxmox-backup/proxmox-backup-api
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -41,7 +41,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
let config = ApiConfig::new(
|
let config = ApiConfig::new(
|
||||||
"/usr/share/javascript/proxmox-backup", &ROUTER, RpcEnvironmentType::PRIVILEDGED);
|
env!("PROXMOX_JSDIR"), &ROUTER, RpcEnvironmentType::PRIVILEDGED);
|
||||||
|
|
||||||
let rest_server = RestServer::new(config);
|
let rest_server = RestServer::new(config);
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut config = ApiConfig::new(
|
let mut config = ApiConfig::new(
|
||||||
"/usr/share/javascript/proxmox-backup", &ROUTER, RpcEnvironmentType::PUBLIC);
|
env!("PROXMOX_JSDIR"), &ROUTER, RpcEnvironmentType::PUBLIC);
|
||||||
|
|
||||||
// add default dirs which includes jquery and bootstrap
|
// add default dirs which includes jquery and bootstrap
|
||||||
// my $base = '/usr/share/libpve-http-server-perl';
|
// my $base = '/usr/share/libpve-http-server-perl';
|
||||||
|
|
14
www/Makefile
14
www/Makefile
|
@ -1,3 +1,9 @@
|
||||||
|
include ../defines.mk
|
||||||
|
|
||||||
|
IMAGES := \
|
||||||
|
images/logo-128.png \
|
||||||
|
images/proxmox_logo.png
|
||||||
|
|
||||||
JSSRC= \
|
JSSRC= \
|
||||||
Utils.js \
|
Utils.js \
|
||||||
Logo.js \
|
Logo.js \
|
||||||
|
@ -24,3 +30,11 @@ js/proxmox-backup-gui.js: js OnlineHelpInfo.js ${JSSRC}
|
||||||
clean:
|
clean:
|
||||||
find . -name '*~' -exec rm {} ';'
|
find . -name '*~' -exec rm {} ';'
|
||||||
rm -rf js
|
rm -rf js
|
||||||
|
|
||||||
|
install: js/proxmox-backup-gui.js
|
||||||
|
install -dm755 $(DESTDIR)$(JSDIR)
|
||||||
|
install -dm755 $(DESTDIR)$(JSDIR)/js
|
||||||
|
install -m644 js/proxmox-backup-gui.js $(DESTDIR)$(JSDIR)/js/
|
||||||
|
install -dm755 $(DESTDIR)$(JSDIR)/images
|
||||||
|
$(foreach i,$(IMAGES), \
|
||||||
|
install -m644 $(i) $(DESTDIR)$(JSDIR)/images/ ;)
|
||||||
|
|
Loading…
Reference in New Issue