[Fedora-directory-commits] ldapserver/ldap/admin/src create_instance.c, 1.43, 1.44 create_instance.h, 1.14, 1.15 ds_newinst.pl.in, 1.2, 1.3
Richard Allen Megginson (rmeggins)
fedora-directory-commits at redhat.com
Fri Feb 9 22:34:01 UTC 2007
- Previous message (by thread): [Fedora-directory-commits] ldapserver Makefile.am, 1.22, 1.23 configure.ac, 1.15, 1.16 aclocal.m4, 1.15, 1.16 missing, 1.10, 1.11 install-sh, 1.10, 1.11 depcomp, 1.10, 1.11 compile, 1.10, 1.11 config.guess, 1.9, 1.10 config.sub, 1.9, 1.10 Makefile.in, 1.25, 1.26 configure, 1.24, 1.25
- Next message (by thread): [Fedora-directory-commits] ldapserver/wrappers initscript.in, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: rmeggins
Update of /cvs/dirsec/ldapserver/ldap/admin/src
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5558/ldapserver/ldap/admin/src
Modified Files:
create_instance.c create_instance.h ds_newinst.pl.in
Log Message:
Resolves: bug 160235
Bug Description: Add support for /etc/init scripts
Reviewed by: nkinder (Thanks!)
Fix Description: Add the new initscript. The initscript is called $PACKAGE_NAME which by
default is fedora-ds. This script is created from wrappers/initscript.in,
sed'd by the fixupcmd in Makefile.am during make install. The way it works is
this: service fedora-ds cmd will execute the cmd on all instances (found in
/etc/fedora-ds by default). service fedora-ds cmd instance will execute cmd on
only that instance. So if you have
/etc/fedora-ds/slapd-foo
/etc/fedora-ds/slapd-bar
and you do
service start fedora-ds
it will start up both slapd-foo and slapd-bar. If you do
service start fedora-ds bar
it will start up only slapd-bar. If you do
service start fedora-ds biff
you will get an error message. The initdir is platform specific (e.g.
/etc/rc.d/init.d on linux, /etc/init.d on Solaris) so the
definition was added to the platform dependent section of configure.ac.
The init script is explicitly branded, including the filename. I needed to add
support to the autotool files so that we could change the name of the file.
Since package_name is defined when you use the AC_INIT macro in configure.ac,
we don't need to define it elsewhere (e.g. #define BRAND_DS). So I added the
branding and other information to the autotool files, and changed
create_instance to use package_name instead of brand_ds to be consistent.
Having the package_name defined in much fewer places should make it much easier
to change in the future if necessary.
I also fixed a compiler warning in ldaprot.h.
Platforms tested: RHEL4, FC6
Flag Day: no
Doc impact: Yes. We need to document how to use the initscript, and how to enable startup on boot - chkconfig fedora-ds on
Index: create_instance.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/create_instance.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- create_instance.c 8 Feb 2007 18:40:12 -0000 1.43
+++ create_instance.c 9 Feb 2007 22:33:58 -0000 1.44
@@ -709,7 +709,7 @@
}
PR_snprintf(ofn, sizeof(ofn), "%s%c%s%cscript-templates%ctemplate-%s",
- cf->datadir, FILE_PATHSEP, cf->brand_ds,
+ cf->datadir, FILE_PATHSEP, cf->package_name,
FILE_PATHSEP, FILE_PATHSEP, name);
PR_snprintf(fn, sizeof(fn), "%s%c%s", cs_path, FILE_PATHSEP, name);
create_instance_mkdir(cs_path, NEWDIR_MODE);
@@ -724,7 +724,7 @@
table[0][0] = "DS-ROOT";
table[0][1] = cf->prefix;
table[1][0] = "DS-BRAND";
- table[1][1] = cf->brand_ds;
+ table[1][1] = cf->package_name;
table[2][0] = "SEP";
table[2][1] = FILE_PATHSEPP;
table[3][0] = "SERVER-NAME";
@@ -3419,13 +3419,13 @@
/* install certmap.conf at <configdir> */
PR_snprintf(src, sizeof(src), "%s%c%s%c/config/certmap.conf",
- cf->sysconfdir, FILE_PATHSEP, cf->brand_ds, FILE_PATHSEP);
+ cf->sysconfdir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP);
PR_snprintf(dest, sizeof(dest), "%s/certmap.conf", cf->config_dir);
create_instance_copy(src, dest, 0600, 0 );
/* generate <confdir>/slapd-collations.conf */
PR_snprintf(src, sizeof(src), "%s%c%s%c/config/%s-collations.conf",
- cf->sysconfdir, FILE_PATHSEP, cf->brand_ds,
+ cf->sysconfdir, FILE_PATHSEP, cf->package_name,
FILE_PATHSEP, PRODUCT_NAME);
PR_snprintf(dest, sizeof(dest), "%s%c%s-collations.conf",
cf->config_dir, FILE_PATHSEP, PRODUCT_NAME);
@@ -3448,16 +3448,16 @@
fclose(f);
/*
- * <sysconfdir>/BRAND_DS/schema to schema_dir
+ * <sysconfdir>/PACKAGE_NAME/schema to schema_dir
*/
PR_snprintf(src, sizeof(src), "%s%c%s%cschema",
- cf->sysconfdir, FILE_PATHSEP, cf->brand_ds, FILE_PATHSEP);
+ cf->sysconfdir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP);
if (NULL != (t = ds_copy_group_files_using_mode_owner(src, cf->schema_dir, 0, NEWFILE_MODE, pw)))
return t;
#if defined (BUILD_PRESENCE)
PR_snprintf(src, sizeof(src), "%s%c%s%c/config/presence",
- cf->sysconfdir, FILE_PATHSEP, cf->brand_ds, FILE_PATHSEP);
+ cf->sysconfdir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP);
PR_snprintf(dest, sizeof(dest), "%s/presence", cf->config_dir);
if (t = ds_copy_group_files(src, dest, 0))
return t;
@@ -4234,7 +4234,7 @@
/*
* FHS description
* cf->prefix: %{_prefix}
- * cf->sroot: %{_libdir}/BRAND_DS
+ * cf->sroot: %{_libdir}/PACKAGE_NAME
* cf->localstatedir: %{_localstatedir}
* cf->sysconfdir: %{_sysconfdir}
* cf->bindir: %{_bindir}
@@ -4242,16 +4242,16 @@
* cf->datadir: %{_datadir}
* cf->docdir: %{_docdir}
* cf->inst_dir: <sroot>/slapd-<servid>
- * cf->config_dir: <localstatedir>/lib/BRAND_DS/slapd-<servid>
- * cf->schema_dir: <localstatedir>/lib/BRAND_DS/slapd-<servid>/schema
- * cf->lock_dir: <localstatedir>/lock/BRAND_DS/slapd-<servid>
- * cf->log_dir: <localstatedir>/log/BRAND_DS/slapd-<servid>
- * cf->run_dir: <localstatedir>/run/BRAND_DS (slapd-instance.pid slapd-instance.startpid files)
- * cf->db_dir: <localstatedir>/lib/BRAND_DS/slapd-<servid>/db
- * cf->bak_dir: <localstatedir>/lib/BRAND_DS/slapd-<servid>/bak
- * cf->tmp_dir: <localstatedir>/tmp/BRAND_DS/slapd-<servid>
+ * cf->config_dir: <localstatedir>/lib/PACKAGE_NAME/slapd-<servid>
+ * cf->schema_dir: <localstatedir>/lib/PACKAGE_NAME/slapd-<servid>/schema
+ * cf->lock_dir: <localstatedir>/lock/PACKAGE_NAME/slapd-<servid>
+ * cf->log_dir: <localstatedir>/log/PACKAGE_NAME/slapd-<servid>
+ * cf->run_dir: <localstatedir>/run/PACKAGE_NAME (slapd-instance.pid slapd-instance.startpid files)
+ * cf->db_dir: <localstatedir>/lib/PACKAGE_NAME/slapd-<servid>/db
+ * cf->bak_dir: <localstatedir>/lib/PACKAGE_NAME/slapd-<servid>/bak
+ * cf->tmp_dir: <localstatedir>/tmp/PACKAGE_NAME/slapd-<servid>
* cf->ldif_dir: <datadir>/<brand-ds>/ldif
- * cf->cert_dir: <sysconfdir>/BRAND_DS/slapd-<servid>
+ * cf->cert_dir: <sysconfdir>/PACKAGE_NAME/slapd-<servid>
* cf->sasl_path: <sroot>/sasl2
* cf->plugin_dir: <sroot>/plugins
*
@@ -4274,7 +4274,7 @@
int prefixlen = 0;
LDAPURLDesc *desc = 0;
- cf->brand_ds = BRAND_DS;
+ cf->package_name = PACKAGE_NAME;
if (rm && qs && !strcmp(rm, "GET"))
{
ds_get_begin(qs);
@@ -4301,7 +4301,7 @@
}
cf->sroot = PR_smprintf("%s%s%c%s",
- prefix, LIBDIR, FILE_PATHSEP, cf->brand_ds);
+ prefix, LIBDIR, FILE_PATHSEP, cf->package_name);
temp = ds_a_get_cgi_var("sasl_path", NULL, NULL);
if (NULL != temp) {
/* if sasl_path is given, we set it in the conf file regardless of
@@ -4487,7 +4487,7 @@
if (NULL == temp) {
cf->config_dir = PR_smprintf("%s%c%s%c%s-%s",
cf->sysconfdir, FILE_PATHSEP,
- cf->brand_ds, FILE_PATHSEP,
+ cf->package_name, FILE_PATHSEP,
PRODUCT_NAME, cf->servid);
} else {
cf->config_dir = PL_strdup(temp);
@@ -4500,7 +4500,7 @@
if (NULL == temp) {
cf->schema_dir = PR_smprintf("%s%c%s%c%s-%s%cschema",
cf->sysconfdir, FILE_PATHSEP,
- cf->brand_ds, FILE_PATHSEP,
+ cf->package_name, FILE_PATHSEP,
PRODUCT_NAME, cf->servid, FILE_PATHSEP);
} else {
cf->schema_dir = PL_strdup(temp);
@@ -4510,7 +4510,7 @@
if (NULL == temp) {
cf->lock_dir = PR_smprintf("%s%clock%c%s%c%s-%s",
cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- cf->brand_ds, FILE_PATHSEP,
+ cf->package_name, FILE_PATHSEP,
PRODUCT_NAME, cf->servid);
} else {
cf->lock_dir = PL_strdup(temp);
@@ -4520,7 +4520,7 @@
if (NULL == temp) {
cf->log_dir = PR_smprintf("%s%clog%c%s%c%s-%s",
cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- cf->brand_ds, FILE_PATHSEP,
+ cf->package_name, FILE_PATHSEP,
PRODUCT_NAME, cf->servid);
} else {
cf->log_dir = PL_strdup(temp);
@@ -4530,7 +4530,7 @@
if (NULL == temp) {
cf->run_dir = PR_smprintf("%s%crun%c%s",
cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- cf->brand_ds);
+ cf->package_name);
} else {
cf->run_dir = PL_strdup(temp);
}
@@ -4541,7 +4541,7 @@
if (NULL == temp) {
cf->db_dir = PR_smprintf("%s%clib%c%s%c%s-%s%cdb",
cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- cf->brand_ds, FILE_PATHSEP,
+ cf->package_name, FILE_PATHSEP,
PRODUCT_NAME, cf->servid, FILE_PATHSEP);
} else {
cf->db_dir = PL_strdup(temp);
@@ -4551,7 +4551,7 @@
if (NULL == temp) {
cf->bak_dir = PR_smprintf("%s%clib%c%s%c%s-%s%cbak",
cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- cf->brand_ds, FILE_PATHSEP,
+ cf->package_name, FILE_PATHSEP,
PRODUCT_NAME, cf->servid, FILE_PATHSEP);
} else {
cf->bak_dir = PL_strdup(temp);
@@ -4562,7 +4562,7 @@
temp = ds_a_get_cgi_var("ldif_dir", NULL, NULL);
if (NULL == temp) {
cf->ldif_dir = PR_smprintf("%s%c%s%cldif",
- cf->datadir, FILE_PATHSEP, cf->brand_ds, FILE_PATHSEP);
+ cf->datadir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP);
} else {
cf->ldif_dir = PL_strdup(temp);
}
@@ -4571,7 +4571,7 @@
if (NULL == temp) {
cf->tmp_dir = PR_smprintf("%s%ctmp%c%s%c%s-%s",
cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- cf->brand_ds, FILE_PATHSEP,
+ cf->package_name, FILE_PATHSEP,
PRODUCT_NAME, cf->servid);
} else {
cf->tmp_dir = PL_strdup(temp);
Index: create_instance.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/create_instance.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- create_instance.h 7 Feb 2007 23:57:40 -0000 1.14
+++ create_instance.h 9 Feb 2007 22:33:59 -0000 1.15
@@ -54,8 +54,8 @@
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
-#ifndef BRAND_DS
-#define BRAND_DS "fedora-ds"
+#ifndef PACKAGE_NAME
+#define PACKAGE_NAME "fedora-ds"
#endif
#ifdef XP_UNIX
@@ -121,7 +121,7 @@
char *datadir;
char *docdir;
- char *brand_ds;
+ char *package_name;
char *lang;
char *servname;
Index: ds_newinst.pl.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/ds_newinst.pl.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ds_newinst.pl.in 7 Feb 2007 23:57:40 -0000 1.2
+++ ds_newinst.pl.in 9 Feb 2007 22:33:59 -0000 1.3
@@ -165,7 +165,7 @@
# next, construct a hash table with our arguments
my %cgiargs = ();
-my $brand_ds = "fedora-ds";
+my $package_name = "@package_name@";
# the following items are always required
addAndCheck(\%cgiargs, "sroot", \%table, "General", "ServerRoot");
@@ -238,8 +238,8 @@
}
$cgiargs{prefix} = $prefix;
-if ($table{General}->{BrandDs}) {
- $brand_ds = $table{General}->{BrandDs};
+if ($table{General}->{PackageName}) {
+ $package_name = $table{General}->{PackageName};
}
# populate the DS with this file - the suffix in this file must
@@ -256,7 +256,7 @@
my $prog = "@bindir@/ds_newinst";
if (! -x $prog) {
- $prog = "@libdir@/$brand_ds/ds_newinst";
+ $prog = "@libdir@/$package_name/ds_newinst";
}
my $rc = &cgiFake($sroot, $verbose,
- Previous message (by thread): [Fedora-directory-commits] ldapserver Makefile.am, 1.22, 1.23 configure.ac, 1.15, 1.16 aclocal.m4, 1.15, 1.16 missing, 1.10, 1.11 install-sh, 1.10, 1.11 depcomp, 1.10, 1.11 compile, 1.10, 1.11 config.guess, 1.9, 1.10 config.sub, 1.9, 1.10 Makefile.in, 1.25, 1.26 configure, 1.24, 1.25
- Next message (by thread): [Fedora-directory-commits] ldapserver/wrappers initscript.in, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Fedora-directory-commits
mailing list