From 878341057382c9502aa322b65d5a5c5135966ed0 Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Mon, 6 Nov 2017 17:36:42 +0100
Subject: [PATCH] use shorter file names

---
 bin/account-manager-client.pl.in               |  2 +-
 bin/account-manager-web.pl.in                  |  2 +-
 conf/Makefile.am                               | 18 ++++++++++++++----
 ...{IdPAccountManager.conf => manager.conf.in} |  4 ++--
 configure.ac                                   |  8 ++++----
 5 files changed, 22 insertions(+), 12 deletions(-)
 rename conf/{IdPAccountManager.conf => manager.conf.in} (94%)

diff --git a/bin/account-manager-client.pl.in b/bin/account-manager-client.pl.in
index 5076fb7..793ebc4 100755
--- a/bin/account-manager-client.pl.in
+++ b/bin/account-manager-client.pl.in
@@ -46,7 +46,7 @@ pod2usage(
 ) unless $action;
 
 my $configuration = IdPAccountManager::Configuration->new(
-    file => '@sysconfdir@/IdPAccountManager.conf'
+    file => '@sysconfdir@/manager.conf'
 );
 
 IdPAccountManager::DB->register_db(
diff --git a/bin/account-manager-web.pl.in b/bin/account-manager-web.pl.in
index bd996d7..865f20f 100755
--- a/bin/account-manager-web.pl.in
+++ b/bin/account-manager-web.pl.in
@@ -9,7 +9,7 @@ use IdPAccountManager::Configuration;
 use IdPAccountManager::WebRequest;
 
 my $configuration = IdPAccountManager::Configuration->new(
-    file => '@sysconfdir@/IdPAccountManager.conf'
+    file => '@sysconfdir@/manager.conf'
 );
 
 my $request = new IdPAccountManager::WebRequest(
diff --git a/conf/Makefile.am b/conf/Makefile.am
index 97dbed6..17045c5 100644
--- a/conf/Makefile.am
+++ b/conf/Makefile.am
@@ -1,8 +1,18 @@
-noinst_DATA = IdPAccountManager.conf
+noinst_DATA = manager.conf
+
+extra_DIST = manager.conf.in
+
+manager.conf: Makefile manager.conf.in
+	sed \
+		-e 's|[@]templatesdir[@]|$(templatesdir)|' \
+		-e 's|[@]sysconfdir[@]|$(sysconfdir)|' \
+		< $(srcdir)/$@.in > $@
+	chmod +x $@
+
 
 install-data-local:
-	if [ -f $(DESTDIR)$(sysconfdir)/IdPAccountManager.conf ]; then                                           \
-	    $(INSTALL_DATA) $(srcdir)/IdPAccountManager.conf $(DESTDIR)$(sysconfdir)/IdPAccountManager.conf.new; \
+	if [ -f $(DESTDIR)$(sysconfdir)/manager.conf ]; then                                           \
+	    $(INSTALL_DATA) $(srcdir)/manager.conf $(DESTDIR)$(sysconfdir)/manager.conf.new; \
 	else                                                                                                     \
-	    $(INSTALL_DATA) $(srcdir)/IdPAccountManager.conf $(DESTDIR)$(sysconfdir)/IdPAccountManager.conf;     \
+	    $(INSTALL_DATA) $(srcdir)/manager.conf $(DESTDIR)$(sysconfdir)/manager.conf;     \
 	fi
diff --git a/conf/IdPAccountManager.conf b/conf/manager.conf.in
similarity index 94%
rename from conf/IdPAccountManager.conf
rename to conf/manager.conf.in
index ba6538f..242db66 100644
--- a/conf/IdPAccountManager.conf
+++ b/conf/manager.conf.in
@@ -26,7 +26,7 @@ idp_displayname = eduGAIN Access Check
 root_ssp_dir = /opt/testidp/simplesamlphp
 
 # Templates directory
-templates_dir = templates
+templates_dir = @templatesdir@
 
 # Database type refers to a Perl Database Driver name
 # However only a subset of existing DBDs are supported by Rose::DB::Object:
@@ -71,7 +71,7 @@ dev_sp_contact = john@my.fqdn, sarah@my.fqdn
 notice_from = edugain-access-check.fqdn
 
 # federation metadata local copy path
-federation_metadata_file_path = /opt/testidp/IdPAccountManager/conf/edugain-md.xml
+federation_metadata_file_path = @sysconfdir@/edugain-md.xml
 
 # Valid account profiles
 account_profiles = fullset1, limitedset1, generic1, student1, student2, teacher1, teacher2, alumni1, librarywalkin1, employee1, researcher1
diff --git a/configure.ac b/configure.ac
index d0fb9d9..1b3f350 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
 AC_PREREQ(2.59)
-AC_INIT([IdP Account Manager], 0.1)
+AC_INIT([Account Manager], 0.1)
 AM_INIT_AUTOMAKE([foreign])
 
-wwwdir=$datadir/idp-account-manager/www
-modulesdir=$datadir/idp-account-manager/lib
-templatesdir=$datadir/idp-account-manager/templates
+wwwdir=$datadir/account-manager/www
+modulesdir=$datadir/account-manager/lib
+templatesdir=$datadir/account-manager/templates
 
 AC_SUBST(wwwdir)
 AC_SUBST(modulesdir)
-- 
GitLab