From d2a19b200912fe4a78211a3d6212b143ece5e064 Mon Sep 17 00:00:00 2001 From: Karl MacMillan Date: Tue, 9 Oct 2007 16:25:38 -0400 Subject: Karl MacMillan wrote: > > This largish patch makes the build and installation work on 64bit > > machines. The only catch here is that to get a 64bit build you need to > > set LIBDIR on make: > > > > make install LIBDIR=/usr/lib64 > > > > The spec file does this correctly. I couldn't find any reliable way to > > guess this that works both on real systems and in the almost entirely > > empty rpm build root (you can't, for example, check for the existence > > of /usr/lib64). --- Makefile | 9 --------- ipa-server/Makefile | 7 ++----- ipa-server/Makefile.common | 21 +++++++++++++++++++++ ipa-server/freeipa-server.spec | 4 ++-- ipa-server/freeipa-server.spec.in | 4 ++-- ipa-server/ipa-gui/Makefile | 7 +++---- ipa-server/ipa-install/Makefile | 11 +++++++---- ipa-server/ipa-install/ipa-server-install | 12 ++++++++++-- ipa-server/ipa-install/share/Makefile | 9 --------- ipa-server/ipa-kpasswd/Makefile | 10 ++++------ ipa-server/ipa-slapi-plugins/dna/Makefile | 15 +++------------ ipa-server/ipa-slapi-plugins/ipa-memberof/Makefile | 15 +++------------ ipa-server/ipa-slapi-plugins/ipa-pwd-extop/Makefile | 15 +++------------ ipa-server/ipaserver/dsinstance.py | 6 +++++- ipa-server/ipaserver/krbinstance.py | 4 ++-- ipa-server/xmlrpc-server/Makefile | 10 +++++----- 16 files changed, 72 insertions(+), 87 deletions(-) create mode 100644 ipa-server/Makefile.common diff --git a/Makefile b/Makefile index f15c9dea3..dc2a4837f 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,6 @@ PRJ_PREFIX=freeipa RPMBUILD ?= $(PWD)/rpmbuild -# set to 1 to produce a debug build of all subprojects -#DEBUG=1 - # Version numbers - this is for the entire server. After # updating this you should run the version-update # target. @@ -38,12 +35,6 @@ CLI_VERSION=$(CLI_MAJOR).$(CLI_MINOR).$(CLI_RELEASE) CLI_TARBALL_PREFIX=$(PRJ_PREFIX)-client-$(CLI_VERSION) CLI_TARBALL=$(CLI_TARBALL_PREFIX).tgz -ifeq ($(DEBUG),1) - export CFLAGS = -g -Wall -Wshadow - export LDFLAGS = -g -endif - - all: @for subdir in $(SUBDIRS); do \ (cd $$subdir && $(MAKE) $@) || exit 1; \ diff --git a/ipa-server/Makefile b/ipa-server/Makefile index 4b1fe14bc..dacba8485 100644 --- a/ipa-server/Makefile +++ b/ipa-server/Makefile @@ -1,9 +1,6 @@ -SUBDIRS=ipa-install xmlrpc-server ipa-kpasswd ipa-slapi-plugins ipa-gui - -SHAREDIR=$(DESTDIR)/usr/share/ipa -PYTHONDIR=$(SHAREDIR)/ipaserver -SBINDIR=$(DESTDIR)/usr/sbin +include Makefile.common +SUBDIRS=ipa-install xmlrpc-server ipa-kpasswd ipa-slapi-plugins ipa-gui all: @for subdir in $(SUBDIRS); do \ diff --git a/ipa-server/Makefile.common b/ipa-server/Makefile.common new file mode 100644 index 000000000..0ca3e2130 --- /dev/null +++ b/ipa-server/Makefile.common @@ -0,0 +1,21 @@ +# set to 1 to produce a debug build of all subprojects +#export DEBUG=1 + +# set to 1 to build for 64bit +#export BUILD64=0 + +ifeq ($(DEBUG),1) + export CFLAGS = -g -Wall -Wshadow + export LDFLAGS = -g +else + export CFLAGS = -O2 -Wall -Wshadow +endif + +DIRSRV=dirsrv +PREFIX?=$(DESTDIR)/usr +LIBDIR?=$(DESTDIR)/usr/lib +SHAREDIR?=$(PREFIX)/share/ipa +PLUGINDIR?=$(LIBDIR)/$(DIRSRV)/plugins +SBINDIR?=$(PREFIX)/sbin +INITDIR?=$(DESTDIR)/etc/rc.d/init.d +PYTHONDIR?=$(SHAREDIR)/ipaserver \ No newline at end of file diff --git a/ipa-server/freeipa-server.spec b/ipa-server/freeipa-server.spec index 2cfd32742..0519c8191 100755 --- a/ipa-server/freeipa-server.spec +++ b/ipa-server/freeipa-server.spec @@ -14,7 +14,7 @@ BuildRequires: fedora-ds-base-devel openldap-devel krb5-devel nss-devel mozldap- Requires: python fedora-ds-base krb5-server krb5-server-ldap nss-tools openldap-clients httpd mod_python mod_auth_kerb python-ldap freeipa-python ntp cyrus-sasl-gssapi nss TurboGears %define httpd_conf /etc/httpd/conf.d -%define plugin_dir /usr/lib/dirsrv/plugins +%define plugin_dir %{_libdir}/dirsrv/plugins %description FreeIPA is a server for identity, policy, and audit. @@ -31,7 +31,7 @@ rm -rf %{buildroot} mkdir -p %{buildroot}%{_sbindir} mkdir -p %{buildroot}%{plugin_dir} -make install DESTDIR=%{buildroot} +make install DESTDIR=%{buildroot} LIBDIR=%{buildroot}%{_libdir} %clean diff --git a/ipa-server/freeipa-server.spec.in b/ipa-server/freeipa-server.spec.in index dbae4fedd..914a7c051 100644 --- a/ipa-server/freeipa-server.spec.in +++ b/ipa-server/freeipa-server.spec.in @@ -14,7 +14,7 @@ BuildRequires: fedora-ds-base-devel openldap-devel krb5-devel nss-devel mozldap- Requires: python fedora-ds-base krb5-server krb5-server-ldap nss-tools openldap-clients httpd mod_python mod_auth_kerb python-ldap freeipa-python ntp cyrus-sasl-gssapi nss TurboGears %define httpd_conf /etc/httpd/conf.d -%define plugin_dir /usr/lib/dirsrv/plugins +%define plugin_dir %{_libdir}/dirsrv/plugins %description FreeIPA is a server for identity, policy, and audit. @@ -31,7 +31,7 @@ rm -rf %{buildroot} mkdir -p %{buildroot}%{_sbindir} mkdir -p %{buildroot}%{plugin_dir} -make install DESTDIR=%{buildroot} +make install DESTDIR=%{buildroot} LIBDIR=%{buildroot}%{_libdir} %clean diff --git a/ipa-server/ipa-gui/Makefile b/ipa-server/ipa-gui/Makefile index ba641d282..26ee7d313 100644 --- a/ipa-server/ipa-gui/Makefile +++ b/ipa-server/ipa-gui/Makefile @@ -1,8 +1,6 @@ -SHAREDIR=$(DESTDIR)/usr/share/ipa -SBINDIR=$(DESTDIR)/usr/sbin -INITDIR = $(DESTDIR)/etc/rc.d/init.d +include ../Makefile.common -IPAGUI_SUBDIRS=config forms helpers templates +IPAGUI_SUBDIRS=config forms helpers templates subcontrollers STATIC_SUBDIRS=css images javascript all: ; @@ -20,6 +18,7 @@ install: done install -m 644 ipagui/config/*.cfg $(SHAREDIR)/ipagui/config + install -m 644 ipagui/templates/*.kid $(SHAREDIR)/ipagui/templates -mkdir -p $(SHAREDIR)/ipagui/static @for subdir in $(STATIC_SUBDIRS); do \ diff --git a/ipa-server/ipa-install/Makefile b/ipa-server/ipa-install/Makefile index 40a39b576..46be2c721 100644 --- a/ipa-server/ipa-install/Makefile +++ b/ipa-server/ipa-install/Makefile @@ -1,5 +1,4 @@ -SHAREDIR=$(DESTDIR)/usr/share/ipa -SBINDIR=$(DESTDIR)/usr/sbin +include ../Makefile.common all: ; @@ -7,9 +6,13 @@ install: -mkdir $(SBINDIR) install -m 755 ipa-server-install $(SBINDIR) install -m 755 ipa-server-setupssl $(SHAREDIR) - $(MAKE) -C share $@ + + -mkdir -p $(SHAREDIR) + install -m 644 share/*.ldif $(SHAREDIR) + install -m 644 share/*.template $(SHAREDIR) + $(MAKE) -C test $@ clean: - $(MAKE) -C share $@ rm -f *~ *.pyc + rm -f share/*~ diff --git a/ipa-server/ipa-install/ipa-server-install b/ipa-server/ipa-install/ipa-server-install index 462774ba2..34666af55 100644 --- a/ipa-server/ipa-install/ipa-server-install +++ b/ipa-server/ipa-install/ipa-server-install @@ -128,10 +128,15 @@ def check_existing_installation(): yesno = raw_input("Do you wish to remove it and create a new one? [no]: ") if not yesno or yesno.lower()[0] != "y": sys.exit(1) + + try: + run(["/sbin/service", "dirsrv", "stop"]) + except: + pass for d in dirs: serverid = os.path.basename(d).split("slapd-", 1)[1] if serverid: - erase_ds_instance_data (serverid) + erase_ds_instance_data(serverid) def get_fqdn(): fqdn = "" @@ -531,4 +536,7 @@ def main(): return 0 -main() +try: + main() +except Exception, e: + print "Unexpected error - see ipaserver-install.log for details:\n %s" % str(e) diff --git a/ipa-server/ipa-install/share/Makefile b/ipa-server/ipa-install/share/Makefile index 380480bcf..e69de29bb 100644 --- a/ipa-server/ipa-install/share/Makefile +++ b/ipa-server/ipa-install/share/Makefile @@ -1,9 +0,0 @@ -SHAREDIR = $(DESTDIR)/usr/share/ipa - -install: - -mkdir -p $(SHAREDIR) - install -m 644 *.ldif $(SHAREDIR) - install -m 644 *.template $(SHAREDIR) - -clean: - rm -f *~ diff --git a/ipa-server/ipa-kpasswd/Makefile b/ipa-server/ipa-kpasswd/Makefile index 5fd90a69e..918f74d04 100644 --- a/ipa-server/ipa-kpasswd/Makefile +++ b/ipa-server/ipa-kpasswd/Makefile @@ -1,9 +1,6 @@ -PREFIX ?= $(DESTDIR)/usr -SBIN = $(PREFIX)/sbin -INITDIR = $(DESTDIR)/etc/rc.d/init.d +include ../Makefile.common LDFLAGS +=-lkrb5 -llber -lldap -CFLAGS ?= -g -Wall -Wshadow OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) @@ -14,8 +11,9 @@ all: $(OBJS) $(CC) $(CFLAGS) -c -o $@ $< install: - -mkdir -p $(SBIN) - install -m 755 ipa_kpasswd $(SBIN) + echo $(SBINDIR) + -mkdir -p $(SBINDIR) + install -m 755 ipa_kpasswd $(SBINDIR) -mkdir -p $(INITDIR) install -m 755 ipa-kpasswd.init $(INITDIR)/ipa-kpasswd diff --git a/ipa-server/ipa-slapi-plugins/dna/Makefile b/ipa-server/ipa-slapi-plugins/dna/Makefile index a4fccab23..1e37d7793 100644 --- a/ipa-server/ipa-slapi-plugins/dna/Makefile +++ b/ipa-server/ipa-slapi-plugins/dna/Makefile @@ -1,12 +1,7 @@ -DIRSRV ?= dirsrv -PREFIX ?= $(DESTDIR)/usr -LIBDIR ?= $(PREFIX)/lib/$(DIRSRV)/plugins -LIB64DIR ?= $(PREFIX)/lib64/$(DIRSRV)/plugins -SHAREDIR = $(DESTDIR)/usr/share/ipa +include ../../Makefile.common SONAME = libipa-dna-plugin.so LDFLAGS += -llber -CFLAGS ?= -g -Wall -Wshadow CFLAGS += -I/usr/include/$(DIRSRV) -I/usr/include/nss3 -I/usr/include/mozldap -I/usr/include/nspr4 -fPIC -DPIC OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) @@ -18,12 +13,8 @@ all: $(OBJS) $(CC) $(CFLAGS) -c -o $@ $< install: - -mkdir -p $(LIBDIR) - if [ -e $(PREFIX)/lib/$(DIRSRV) ]; then \ - install -m 644 $(SONAME) $(LIBDIR); \ - else \ - install -m 644 $(SONAME) $(LIB64DIR); \ - fi + mkdir -p $(PLUGINDIR); \ + install -m 644 $(SONAME) $(PLUGINDIR); \ install -m 644 *.ldif $(SHAREDIR) clean: diff --git a/ipa-server/ipa-slapi-plugins/ipa-memberof/Makefile b/ipa-server/ipa-slapi-plugins/ipa-memberof/Makefile index 71258e6bf..e13446c4b 100644 --- a/ipa-server/ipa-slapi-plugins/ipa-memberof/Makefile +++ b/ipa-server/ipa-slapi-plugins/ipa-memberof/Makefile @@ -1,12 +1,7 @@ -DIRSRV ?= dirsrv -PREFIX ?= $(DESTDIR)/usr -LIBDIR ?= $(PREFIX)/lib/$(DIRSRV)/plugins -LIB64DIR ?= $(PREFIX)/lib64/$(DIRSRV)/plugins -SHAREDIR = $(DESTDIR)/usr/share/ipa +include ../../Makefile.common SONAME = libipa-memberof-plugin.so LDFLAGS += -llber -CFLAGS ?= -g -Wall -Wshadow CFLAGS += -I/usr/include/$(DIRSRV) -I/usr/include/nss3 -I/usr/include/mozldap -I/usr/include/nspr4 -fPIC -DPIC OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) @@ -18,12 +13,8 @@ all: $(OBJS) $(CC) $(CFLAGS) -c -o $@ $< install: - -mkdir -p $(LIBDIR) - if [ -e $(PREFIX)/lib/$(DIRSRV) ]; then \ - install -m 644 $(SONAME) $(LIBDIR); \ - else \ - install -m 644 $(SONAME) $(LIB64DIR); \ - fi + mkdir -p $(PLUGINDIR); \ + install -m 644 $(SONAME) $(PLUGINDIR); \ install -m 644 *.ldif $(SHAREDIR) clean: diff --git a/ipa-server/ipa-slapi-plugins/ipa-pwd-extop/Makefile b/ipa-server/ipa-slapi-plugins/ipa-pwd-extop/Makefile index 7d676146a..034b8e60b 100644 --- a/ipa-server/ipa-slapi-plugins/ipa-pwd-extop/Makefile +++ b/ipa-server/ipa-slapi-plugins/ipa-pwd-extop/Makefile @@ -1,12 +1,7 @@ -DIRSRV ?= dirsrv -PREFIX ?= $(DESTDIR)/usr -LIBDIR = $(PREFIX)/lib/$(DIRSRV)/plugins -LIB64DIR ?= $(PREFIX)/lib64/$(DIRSRV)/plugins -SHAREDIR = $(DESTDIR)/usr/share/ipa +include ../../Makefile.common SONAME = libipa_pwd_extop.so LDFLAGS += -lkrb5 -llber -lldap -llber -lssl -CFLAGS ?= -g -Wall -Wshadow CFLAGS += -I/usr/include/$(DIRSRV) -I/usr/include/nss3 -I/usr/include/mozldap -I/usr/include/nspr4 -fPIC -DPIC OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) @@ -18,12 +13,8 @@ all: $(OBJS) $(CC) $(CFLAGS) -c -o $@ $< install: - -mkdir -p $(LIBDIR) - if [ -e $(PREFIX)/lib/$(DIRSRV) ]; then \ - install -m 644 $(SONAME) $(LIBDIR); \ - else \ - install -m 644 $(SONAME) $(LIB64DIR); \ - fi + mkdir -p $(PLUGINDIR); \ + install -m 644 $(SONAME) $(PLUGINDIR); \ install -m 644 *.ldif $(SHAREDIR) clean: diff --git a/ipa-server/ipaserver/dsinstance.py b/ipa-server/ipaserver/dsinstance.py index 5c59cfa77..30691115e 100644 --- a/ipa-server/ipaserver/dsinstance.py +++ b/ipa-server/ipaserver/dsinstance.py @@ -214,7 +214,11 @@ class DsInstance: def change_admin_password(self, password): logging.debug("Changing admin password") dirname = self.config_dirname() - args = ["/usr/lib/mozldap/ldappasswd", + if dir_exists("/usr/lib64/mozldap"): + app = "/usr/lib64/mozldap/ldappasswd" + else: + app = "/usr/lib/mozldap/ldappasswd" + args = [app, "-D", "cn=Directory Manager", "-w", self.dm_password, "-P", dirname+"/cert8.db", "-ZZZ", "-s", password, "uid=admin,cn=sysaccounts,cn=etc,"+self.suffix] diff --git a/ipa-server/ipaserver/krbinstance.py b/ipa-server/ipaserver/krbinstance.py index be70b0351..03bc9200e 100644 --- a/ipa-server/ipaserver/krbinstance.py +++ b/ipa-server/ipaserver/krbinstance.py @@ -202,7 +202,7 @@ class KrbInstance: def __create_ds_keytab(self): try: os.remove("/etc/dirsrv/ds.keytab") - except os.OSError: + except os.error : print "Failed to remove /etc/dirsrv/ds.keytab." (kwrite, kread, kerr) = os.popen3("/usr/kerberos/sbin/kadmin.local") kwrite.write("addprinc -randkey ldap/"+self.fqdn+"@"+self.realm+"\n") @@ -257,7 +257,7 @@ class KrbInstance: def __create_http_keytab(self): try: os.remove("/etc/httpd/conf/ipa.keytab") - except os.OSError: + except os.error: print "Failed to remove /etc/httpd/conf/ipa.keytab." (kwrite, kread, kerr) = os.popen3("/usr/kerberos/sbin/kadmin.local") kwrite.write("addprinc -randkey HTTP/"+self.fqdn+"@"+self.realm+"\n") diff --git a/ipa-server/xmlrpc-server/Makefile b/ipa-server/xmlrpc-server/Makefile index 4bc657cb9..80c24193a 100644 --- a/ipa-server/xmlrpc-server/Makefile +++ b/ipa-server/xmlrpc-server/Makefile @@ -1,13 +1,13 @@ -SHAREDIR = $(DESTDIR)/usr/share/ipa/ipaserver +include ../Makefile.common all: ; install: -mkdir -p $(SHAREDIR) - -mkdir -p $(SHAREDIR)/../html - install -m 644 *.py $(SHAREDIR) - install -m 644 ipa.conf $(SHAREDIR)/.. - install -m 644 *.html $(SHAREDIR)/../html + -mkdir -p $(SHAREDIR)/html + install -m 644 *.py $(SHAREDIR)/ipaserver + install -m 644 ipa.conf $(SHAREDIR) + install -m 644 *.html $(SHAREDIR)/html clean: rm -f *~ *.pyc -- cgit