Permalink
Browse files

Add vars for prefix use in Makefile

  • Loading branch information...
1 parent f841ebc commit 980cd2ac326532b93b423da31d73f6ac92fde398 @Toubib Toubib committed Jun 19, 2011
Showing with 18 additions and 7 deletions.
  1. +9 −3 Makefile
  2. +9 −4 backup-manager
View
@@ -27,7 +27,7 @@
# Overwrite that variable if you need to prefix the destination
# (needed for vendors).
DESTDIR?=
-PREFIX?=/usr
+PREFIX?=/usr/local
# Overwrite that variable with the Perl vendorlib Config value if
# you package Backup Manager
@@ -36,8 +36,9 @@ PERL5DIR?="$(DESTDIR)$(shell perl -MConfig -e 'print "$$Config{sitelib}"')"
# Some static paths, specific to backup-manager
BINDIR=$(PREFIX)/bin
SBINDIR=$(PREFIX)/sbin
+VARDIR=$(PREFIX)/var
-LIBDIR=$(DESTDIR)/$(PREFIX)/share/backup-manager
+LIBDIR=$(DESTDIR)/$(PREFIX)/lib/backup-manager
CONTRIB=$(LIBDIR)/contrib
SHAREDIR=$(DESTDIR)/$(PREFIX)/share/backup-manager
SHFILES=\
@@ -107,7 +108,12 @@ install_bin:
install -o root -g 0 -m 0755 backup-manager-purge $(DESTDIR)/$(BINDIR)
install -o root -g 0 -m 0755 backup-manager-upload $(DESTDIR)/$(BINDIR)
install -o root -g 0 -m 0644 backup-manager.conf.tpl $(SHAREDIR)
-
+
+ # Set PREFIX to backup-manager binary
+ sed "s#^BIN_PREFIX=.*#BIN_PREFIX=$(DESTDIR)/$(BINDIR)#" -i $(DESTDIR)/$(SBINDIR)/backup-manager
+ sed "s#^LIB_PREFIX=.*#LIB_PREFIX=$(DESTDIR)/$(PREFIX)/lib#" -i $(DESTDIR)/$(SBINDIR)/backup-manager
+ sed "s#^VAR_PREFIX=.*#VAR_PREFIX=$(VARDIR)#" -i $(DESTDIR)/$(SBINDIR)/backup-manager
+
mkdir -p $(PERL5DIR)
mkdir -p $(PERL5DIR)/BackupManager
install -o root -g 0 -m 0644 BackupManager/*.pm $(PERL5DIR)/BackupManager
View
@@ -29,11 +29,16 @@ RELEASE="true"
REVISION='$Revision$'
VERSION="0.7.10"
+#Set prefix for paths
+BIN_PREFIX=/usr/bin
+LIB_PREFIX=/usr/lib
+VAR_PREFIX=/var/lib
+
# All the paths we provide
-libdir="/usr/share/backup-manager"
-vardir="/var/lib/backup-manager"
-bmu="/usr/bin/backup-manager-upload"
-bmp="/usr/bin/backup-manager-purge"
+libdir="$LIB_PREFIX/backup-manager"
+vardir="$VAR_PREFIX/backup-manager"
+bmu="$BIN_PREFIX/backup-manager-upload"
+bmp="$BIN_PREFIX/backup-manager-purge"
# Find which lockfile to use
# If we are called by an unprivileged user, use a lockfile inside the user's home;

0 comments on commit 980cd2a

Please sign in to comment.