Skip to content

Commit

Permalink
Initial pgsql-fd import - version 2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
rkorzeniewski committed Jun 15, 2013
1 parent 7f27a20 commit 80e4106
Show file tree
Hide file tree
Showing 28 changed files with 12,234 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@
*.lai
*.la
*.a

pgsql-archlog
pgsql-restore
Makefile
.libs
214 changes: 214 additions & 0 deletions LICENSE.Inteos

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions Makefile.linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#
# Makefile for inteos-pgsql-plugin on Linux
#

# Flags & libs
BACULASRC = bacula.enterprise.git
BACULAVERSION = $(shell grep VERSION= ../$(BACULASRC)/bacula/Makefile|cut -f2 -d'=')
PGSQLVERSION = $(shell grep PLUGIN_VERSION pgsql-fd.c|grep define|awk '{print $$3}')

plugindir = /opt/bacula/plugins
sbindir = /opt/bacula/bin
libdir = /opt/bacula/lib64
confdir = /opt/bacula/etc

CFLAGS = -g -Wall -fno-strict-aliasing -fno-exceptions -fPIC
CPPFLAGS = -g -fno-strict-aliasing -fno-exceptions -fno-rtti -Wall -fPIC
LDFLAGS =
BACULA_H = -I../$(BACULASRC)/bacula/src -I../$(BACULASRC)/bacula/src/filed -I/opt/local/include
DB_H = -I/usr/include/postgresql
BACULA_LIBS = -L$(libdir) -lbac
DB_LIBS = -L/usr/lib -lpq -lcrypt

PGSQLSRC = pgsql-fd.c pgsql-archlog.c pgsql-restore.c pgsqllib.c
PGSQLOBJ = $(PGSQLSRC:.c=.lo)
BACSRC = keylist.c parseconfig.c pluglib.c utils.c
BACOBJ = $(BACSRC:.c=.lo)

all: pgsql Makefile

clean: libtool-clean pgsql-clean
@echo "Cleaning obects ..."
@rm -rf *.o *.lo

%.lo : %.c Makefile
@echo "Compiling $(@:.lo=.c) ..."
@libtool --silent --tag=CXX --mode=compile g++ $(CPPFLAGS) -c $(@:.lo=.c)

$(BACOBJ): Makefile $(BACSRC)
@echo "Compiling BAClib required $(@:.lo=.c) ..."
@libtool --silent --tag=CXX --mode=compile g++ $(CPPFLAGS) $(BACULA_H) -c $(@:.lo=.c)

pgsql: Makefile pgsql-fd.la pgsql-archlog pgsql-restore

$(PGSQLOBJ): Makefile $(PGSQLSRC)
@echo "Compiling PGSQL $(@:.lo=.c) ..."
@libtool --silent --tag=CXX --mode=compile g++ $(CPPFLAGS) $(BACULA_H) $(DB_H) -c $(@:.lo=.c)

pgsql-fd.la: pgsql-fd.lo keylist.lo parseconfig.lo pluglib.lo utils.lo
@echo "Building PGSQL $(@:.la=.so) ..."
@libtool --silent --tag=CXX --mode=link g++ -shared $(LDFLAGS) $^ -o $@ -rpath $(plugindir) -module \
-export-dynamic -avoid-version $(DB_LIBS)

pgsql-archlog: pgsql-archlog.lo parseconfig.lo keylist.lo pgsqllib.lo utils.lo pluglib.lo
@echo "Making $@ ..."
@libtool --silent --tag=CXX --mode=link g++ -o $@ $^ $(BACULA_LIBS) $(DB_LIBS)

pgsql-restore: pgsql-restore.lo parseconfig.lo keylist.lo pgsqllib.lo utils.lo pluglib.lo
@echo "Making $@ ..."
@libtool --silent --tag=CXX --mode=link g++ -o $@ $^ $(BACULA_LIBS) $(DB_LIBS)

pgsql-clean:
@echo "Cleaning pgsql ..."
@rm -f pgsql-archlog pgsql-restore pgsql-fd.so pgsql-fd.la pgsql-fd.lo

libtool-clean:
@echo "Cleaning libtool ..."
@rm -rf .libs _libs

install-pgsql-fd: pgsql-fd.la
@echo "Installing plugin ... $(^:.la=.so)"
@mkdir -p $(DESTDIR)$(plugindir)
@libtool --silent --tag=CXX --mode=install /usr/bin/install -c -m 0750 $^ $(DESTDIR)$(plugindir)
@rm -f $(DESTDIR)$(plugindir)/$^

install-pgsql-utils: pgsql-archlog pgsql-restore
@echo "Installing utils ... $^"
@mkdir -p $(DESTDIR)$(sbindir)
@libtool --silent --tag=CXX --mode=install /usr/bin/install -c -m 0755 $^ $(DESTDIR)$(sbindir)

install-pgsql-config: pgsql.conf
@echo "Installing config ... $^"
@mkdir -p $(DESTDIR)$(confdir)
@libtool --silent --tag=CXX --mode=install /usr/bin/install -c -m 0640 pgsql.conf $(DESTDIR)$(confdir)/pgsql.conf.example

install-pgsql: install-pgsql-fd install-pgsql-config install-pgsql-utils

install: install-pgsql

package-pgsql: install-pgsql inteos-pgsql.spec
@echo "Package pgsql $(PGSQLVERSION) for Bacula $(BACULAVERSION)"
@tar cjvPf ../pgsql-$(PGSQLVERSION)_$(BACULAVERSION).tar.bz2 $(DESTDIR)$(confdir)/pgsql.conf.example $(DESTDIR)$(sbindir)/pgsql-archlog $(DESTDIR)$(sbindir)/pgsql-restore $(DESTDIR)$(plugindir)/pgsql-fd.so
@ cp ../pgsql-$(PGSQLVERSION)_$(BACULAVERSION).tar.bz2 /root/rpmbuild/SOURCES
@rpmbuild -bb inteos-pgsql.spec
87 changes: 87 additions & 0 deletions Makefile.osx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#
# Makefile for inteos-pgsql-plugin on MacOSX
#

# Flags & libs
BACULASRC = bacula.enterprise.git
BACULAVERSION = $(shell grep VERSION= ../$(BACULASRC)/bacula/Makefile|cut -f2 -d'=')
PGSQLVERSION = $(shell grep PLUGIN_VERSION pgsql-fd.c|grep define|awk '{print $$3}')

plugindir = /opt/local/bacula/plugins
sbindir = /opt/local/bacula/sbin
libdir = /opt/local/bacula/lib64
confdir = /opt/local/bacula/etc

CFLAGS = -g -Wall -fno-strict-aliasing -fno-exceptions -fPIC
CPPFLAGS = -g -fno-strict-aliasing -fno-exceptions -fno-rtti -Wall -fPIC
LDFLAGS = -L/opt/local/lib -lintl
BACULA_H = -I../$(BACULASRC)/bacula/src -I../$(BACULASRC)/bacula/src/filed -I/opt/local/include
DB_H = -I/opt/local/include/postgresql90
BACULA_LIBS = -L../$(BACULASRC)/bacula/src/lib/.libs -lbac
DB_LIBS = -L/usr/lib -L/opt/local/lib/postgresql90 -lpq -lcrypto

PGSQLSRC = pgsql-fd.c pgsql-archlog.c pgsql-restore.c pgsqllib.c
PGSQLOBJ = $(PGSQLSRC:.c=.lo)
BACSRC = keylist.c parseconfig.c pluglib.c utils.c
BACOBJ = $(BACSRC:.c=.lo)

all: pgsql Makefile

clean: libtool-clean pgsql-clean
@echo "Cleaning obects ..."
@rm -f *.o *.lo *.dylib

%.lo : %.c Makefile
@echo "Compiling $(@:.lo=.c) ..."
@glibtool --silent --tag=CXX --mode=compile g++ $(CPPFLAGS) -c $(@:.lo=.c)

$(BACOBJ): Makefile $(BACSRC)
@echo "Compiling BAClib required $(@:.lo=.c) ..."
@glibtool --silent --tag=CXX --mode=compile g++ $(CPPFLAGS) $(BACULA_H) -c $(@:.lo=.c)

pgsql: Makefile pgsql-fd.la pgsql-archlog pgsql-restore

$(PGSQLOBJ): Makefile $(PGSQLSRC)
@echo "Compiling PGSQL $(@:.lo=.c) ..."
@glibtool --silent --tag=CXX --mode=compile g++ $(CPPFLAGS) $(BACULA_H) $(DB_H) -c $(@:.lo=.c)

pgsql-fd.la: pgsql-fd.lo keylist.lo parseconfig.lo pluglib.lo utils.lo
@echo "Building PGSQL $(@:.la=.so) ..."
@glibtool --silent --tag=CXX --mode=link g++ -shared $(LDFLAGS) $^ -o $@ -rpath $(plugindir) -module \
-export-dynamic -avoid-version $(DB_LIBS)

pgsql-archlog: pgsql-archlog.lo parseconfig.lo keylist.lo pgsqllib.lo utils.lo pluglib.lo
@echo "Making $@ ..."
@glibtool --silent --tag=CXX --mode=link g++ -o $@ $^ $(BACULA_LIBS) $(DB_LIBS)

pgsql-restore: pgsql-restore.lo parseconfig.lo keylist.lo pgsqllib.lo utils.lo pluglib.lo
@echo "Making $@ ..."
@glibtool --silent --tag=CXX --mode=link g++ -o $@ $^ $(BACULA_LIBS) $(DB_LIBS)

pgsql-clean:
@echo "Cleaning pgsql ..."
@rm -f pgsql-archlog pgsql-restore pgsql-fd.dylib pgsql-fd.la pgsql-fd.lo

libtool-clean:
@echo "Cleaning libtool ..."
@rm -rf .libs _libs

install-pgsql-fd: pgsql-fd.la install-pgsql-config
@echo "Installing plugin ... $(^:.la=.so)"
@mkdir -p $(DESTDIR)$(plugindir)
@glibtool --silent --tag=CXX --mode=install ginstall -c -m 0750 $^ $(DESTDIR)$(plugindir)
@rm -f $(DESTDIR)$(plugindir)/$^

install-pgsql-utils: pgsql-archlog pgsql-restore install-pgsql-config
@echo "Installing utils ... $^"
@mkdir -p $(DESTDIR)$(sbindir)
@glibtool --silent --tag=CXX --mode=install ginstall -c -m 0755 $^ $(DESTDIR)$(sbindir)

install-pgsql-config: pgsql.conf
@echo "Installing config ... $^"
@mkdir -p $(DESTDIR)$(confdir)
@glibtool --silent --tag=CXX --mode=install ginstall -c -m 0640 pgsql.conf $(DESTDIR)$(confdir)

install-pgsql: install-pgsql-fd install-pgsql-utils

install: install-pgsql
62 changes: 62 additions & 0 deletions Makefile.solaris
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#
# Makefile for inteos-pgsql-plugin on Solaris
#

# Flags & libs
BACULASRC = bacula.enterprise.git
BACULAVERSION = $(shell grep VERSION= ../$(BACULASRC)/bacula/Makefile|cut -f2 -d'=')
PGSQLVERSION = $(shell grep PLUGIN_VERSION pgsql-fd.c|grep define|awk '{print $$3}')

plugindir = /opt/local/bacula/plugins
sbindir = /opt/local/bacula/sbin
libdir = /opt/local/bacula/lib64
confdir = /opt/local/bacula/etc

CFLAGS = -g -Wall -fno-strict-aliasing -fno-exceptions -fPIC
CPPFLAGS = -g -fno-strict-aliasing -fno-exceptions -fno-rtti -Wall -fPIC
LDFLAGS = -L/opt/local/lib -lintl
BACULA_H = -I../$(BACULASRC)/bacula/src -I../$(BACULASRC)/bacula/src/filed -I/opt/local/include
DB_H = -I../postgres/9.1-pgdg/include
BACULA_LIBS = -L../$(BACULASRC)/bacula/src/lib/.libs -lbac -lsocket
DB_LIBS = -L../postgres/9.1-pgdg/lib -lpq -lcrypt

PGSQLSRC = pgsql-fd.c pgsql-archlog.c pgsql-restore.c pgsqllib.c
PGSQLOBJ = $(PGSQLSRC:.c=.o)
BACSRC = keylist.c parseconfig.c pluglib.c utils.c
BACOBJ = $(BACSRC:.c=.lo)

all: pgsql Makefile

clean: libtool-clean pgsql-clean
@echo "Cleaning obects ..."
@rm -f *.o

%.o : %.c
@echo "Compiling $@ ..."
@g++ $(CPPFLAGS) $(BACULA_H) -c $< -o $@

pgsql: Makefile pgsql-fd.so pgsql-archlog pgsql-restore

$(PGSQLOBJ): Makefile
@echo "Compiling PG $(@:.o=.c) ..."
@g++ $(CPPFLAGS) $(BACULA_H) $(DB_H) -c $(@:.o=.c) -o $@

pgsql-fd.so: pgsql-fd.o parseconfig.o keylist.o pluglib.o utils.o
@echo "Building $@ ..."
@g++ -shared $^ -o $@ -Wl,-soname,$@ -module $(DB_LIBS) $(BACULA_LIBS)

pgsql-archlog: pgsql-archlog.o parseconfig.o keylist.o pgsqllib.o pluglib.o utils.o
@echo "Making $@ ..."
@g++ -o $@ $^ $(BACULA_LIBS) $(DB_LIBS)

pgsql-restore: pgsql-restore.o parseconfig.o keylist.o pgsqllib.o pluglib.o utils.o
@echo "Making $@ ..."
g++ -o $@ $^ $(BACULA_LIBS) $(DB_LIBS)

pgsql-clean:
@echo "Cleaning pgsql ..."
@rm -f pgsql-archlog pgsql-restore pgsql-fd.so

install: pgsql-fd.so
@echo "Installing plugin ... $^"
@cp $^ $(plugindir)
2 changes: 2 additions & 0 deletions fdapi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/* #define FDAPI 2041 */
#define FDAPI FD_PLUGIN_INTERFACE_VERSION
79 changes: 79 additions & 0 deletions inteos-pgsql.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Bacula RPM spec file
#
# Copyright (C) 2011-2012 Inteos Sp. z o.o.

# Platform Build Configuration
# TODO: merge all plugins into one spec file

# basic defines for every build
%define _release 2
%define _version 2.1
%define _beeversion 6.2.1
%define _packager Radoslaw Korzeniewski <[email protected]>
%define manpage_ext gz

# Don't strip binaries
%define __os_install_post %{nil}
%define __debug_install_post %{nil}
%define debug_package %{nil}

%define base_package_name bacula-enterprise

Summary: Bacula - The Network Backup Solution
Name: bacula-inteos-pgsql-plugin
Version: %{_version}_%{_beeversion}
Release: %{_release}
Group: System Environment/Daemons
License: AGPLv3
BuildRoot: %{_tmppath}/%{name}-root
URL: http://www.inteos.pl/
Vendor: Inteos Sp. z o.o.
Packager: %{_packager}
Prefix: %{_prefix}
Distribution: Bacula Inteos Postgresql Plugin

Source0: pgsql-%{_version}_%{_beeversion}.tar.bz2

Requires: %{base_package_name}-client = %{_beeversion}

# define the basic package description
%define blurb Bacula Inteos Plugin - The Leading Open Source Backup Solution.
%define blurb2 Bacula Inteos Plugin allows you to backup and restore
%define blurb3 a PostgreSQL Database with hot/online mode

Summary: Bacula PostgreSQL Plugin - The Network Backup Solution
Group: System Environment/Daemons

%description
%{blurb}

%{blurb2}
%{blurb3}

This is Bacula Inteos PostgreSQL plugin.

%prep
cd $RPM_BUILD_DIR
rm -rf %{name}-%{_version}_%{_beeversion}
mkdir -p %{name}-%{_version}_%{_beeversion}
cd %{name}-%{_version}_%{_beeversion}
tar xjvf $RPM_SOURCE_DIR/pgsql-%{_version}_%{_beeversion}.tar.bz2

%install
cd $RPM_BUILD_ROOT
mv $RPM_BUILD_DIR/%{name}-%{_version}_%{_beeversion}/opt $RPM_BUILD_ROOT
export QA_RPATHS=$[ 0x0001|0x0010|0x0002 ]


%files
%config(noreplace) /opt/bacula/etc/pgsql.conf.example
%defattr(755,root,-)
/opt/bacula/bin/pgsql-archlog
/opt/bacula/bin/pgsql-restore
/opt/bacula/plugins/pgsql-fd.so

%changelog
* Fri Apr 24 2013 Radoslaw Korzeniewski <[email protected]>
- Update to version 1.9
- Build for PgSQL 9.x
- add RPM Package
Loading

0 comments on commit 80e4106

Please sign in to comment.