head	1.8;
access;
symbols
	START:1.1.1.1 BSDI:1.1.1;
locks; strict;
comment	@# @;


1.8
date	2002.12.22.20.04.49;	author murray;	state Exp;
branches;
next	1.7;

1.7
date	2000.12.19.12.36.30;	author murray;	state Exp;
branches;
next	1.6;

1.6
date	2000.11.25.05.12.31;	author murray;	state Exp;
branches;
next	1.5;

1.5
date	2000.11.22.10.40.35;	author murray;	state Exp;
branches;
next	1.4;

1.4
date	2000.11.20.21.18.18;	author murray;	state Exp;
branches;
next	1.3;

1.3
date	2000.11.11.02.40.14;	author murray;	state Exp;
branches;
next	1.2;

1.2
date	2000.11.10.01.03.10;	author murray;	state Exp;
branches;
next	1.1;

1.1
date	2000.11.08.21.25.56;	author murray;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.11.08.21.25.56;	author murray;	state Exp;
branches;
next	;


desc
@@


1.8
log
@Correct library paths so that this will build with a recent
PostgreSQL.

Submitted by:	"Simon L. Nielsen" <simon@@nitro.dk>
@
text
@#
# Makefile for auto-updates 
#
# Murray Stokely
#
# $FreeBSD$
#

CC      = gcc
CFLAGS  = -g -Wall -I../common/
#CFLAGS = -g $(BDECFLAGS)
OBJS    = authentication.o profiles.o config.o help.o
COMMON  = ../common/wrappers.o
SQLOBJS = sql.o
LIBS    = -lssl -lcrypto

.if defined(CHECKMEM)
LIBS+= /usr/local/lib/libc_mp.a
.endif

## Comment this out if compiling on a system without Jordan's property.c in libutil
HAVE_LIBUTIL_PROPERTY = 1
HAVE_GNU_READLINE = 1  ## XXX This is currently a requirement (FIXME)
HAVE_STRLCPY = 1

## MySQL Support
MYSQLLIBS = -L/usr/local/lib/mysql -lmysqlclient
MYSQLINCS = -I/usr/local/include/mysql
MYSQLOBJS = mysql.o

## PostgreSQL Support
PGSQLLIBS = -L/usr/local/lib -lpq
PGSQLINCS = -I/usr/local/include
PGSQLOBJS = pgsql.o

.if defined(WITH_PGSQL) || exists(/usr/local/pgsql/)
HAVE_PGSQL= yes
SQLOBJS += $(PGSQLOBJS)
LIBS += $(PGSQLLIBS)
CFLAGS += -DHAVE_PGSQL
.endif
.if defined(WITH_MYSQL) || exists(/usr/local/lib/mysql/)
HAVE_MYSQL= yes
SQLOBJS += $(MYSQLOBJS)
LIBS += $(MYSQLLIBS)
CFLAGS += -DHAVE_MYSQL
.endif

.if defined(HAVE_LIBUTIL_PROPERTY)
CFLAGS += -DHAVE_LIBUTIL_PROPERTY
LIBS += -lutil
.else
COMMON += ../common/property.o
.endif

.if defined(HAVE_GNU_READLINE)
CFLAGS += -DHAVE_GNU_READLINE
LIBS += -lreadline
.else
.error "XXX The GNU Readline library is currently required (Fixme!)"
.endif

.if defined(HAVE_STRLCPY)
CFLAGS += -DHAVE_STRLCPY
.endif

OBJS += $(SQLOBJS)

all: updated setupdb

updated: updated.h updated.c $(OBJS)
	$(CC) $(CFLAGS) $(OBJS) $(COMMON) $(LIBS) -o updated updated.c

setupdb: updated.h setupdb.c $(SQLOBJS)
	$(CC) $(CFLAGS) $(SQLOBJS) $(COMMON) config.o $(LIBS) -o setupdb setupdb.c

pgsql.o: updated.h pgsql.c
	$(CC) $(CFLAGS) $(PGSQLINCS) -c pgsql.c

mysql.o: updated.h mysql.c
	$(CC) $(CFLAGS) $(MYSQLINCS) -c mysql.c

sql.o:	updated.h sql.c
	$(CC) $(CFLAGS) -c sql.c

help.o:	updated.h help.c
	$(CC) $(CFLAGS) -c help.c

config.o: updated.h config.c
	$(CC) $(CFLAGS) -c config.c

clean:
	rm $(OBJS) $(MYSQLOBJS) $(PGSQLOBJS) *~ updated setupdb
@


1.7
log
@
  Write a signal handler to catch SIGINFO and print out information
from the dynamic memory list about regions that have been malloced but
not freed.  This handler found many small leaks in the very
heap-intensive sql abstraction code.  When the program is in good
shape, the only output of ^T should be to print that the initial
malloc of the database handle has not been freed yet :

load: 0.06  cmd: updated 43670 [running] 0.01u 0.00s 0% 1600k
Memory leak from the malloc at mysql.c:66

  All of the memory-checking code can be disabled by uncommenting
'MEMCHECK' in wrappers.h
@
text
@d6 2
d32 2
a33 2
PGSQLLIBS = -L/usr/local/pgsql/lib -lpq
PGSQLINCS = -I/usr/local/pgsql/include
@


1.6
log
@
Remove property code from the server specific directory and update the
Makefile to point to the new location for this code in the common
area.
@
text
@d15 4
@


1.5
log
@Add #include "wrappers.h" in a few places to make the server
completely -Wall clean again.
@
text
@d47 1
a47 1
OBJS += properties.o
d87 1
a87 1
	rm $(OBJS) *~ updated setupdb
@


1.4
log
@Tell the server to look for the common network wrapper code in a
seperate directory.
@
text
@d8 1
a8 1
CFLAGS  = -g -Wall
@


1.3
log
@  * Enhanced MySQL support so that others in this office who are
    evaluating this work can use MySQL instead of Postgres (what I
    prefer).

  I'm using a relational database for this first cut to store the
profile, component, and manifest information so that I can very easily
make major changes to the way that the data is laid out without having
to implement an efficient data storage method myself.  The other needs
of concurrency and multiple-access make this project suited for a
database at least initially until the data structures have been
finalized.
@
text
@d7 2
a8 2
CC     = gcc
CFLAGS = -g -Wall
d10 2
a11 1
OBJS   = wrappers.o authentication.o profiles.o config.o help.o
d13 1
a13 1
LIBS   = -lssl -lcrypto
d65 2
a66 1
wrappers.o: updated.h makefile
d68 2
a69 2
updated: updated.h makefile updated.c $(OBJS)
	$(CC) $(CFLAGS) $(OBJS) $(LIBS) -o updated updated.c
d71 1
a71 4
setupdb: updated.h makefile setupdb.c $(SQLOBJS) wrappers.c
	$(CC) $(CFLAGS) $(SQLOBJS) wrappers.o config.o $(LIBS) -o setupdb setupdb.c

pgsql.o: updated.h makefile pgsql.c
d74 1
a74 1
mysql.o: updated.h makefile mysql.c
d77 1
a77 1
sql.o:	updated.h makefile sql.c
d80 1
a80 1
help.o:	updated.h makefile help.c
d83 1
a83 1
config.o: updated.h makefile config.c
d87 1
a87 1
	rm $(OBJS) *~ updated
@


1.2
log
@With this commit a simple client on a barebones/uninstalled system
could talk to the server and download all the necessary files to mimic
a complete system as specified by one of the profiles.

Now its on to the interesting stuff (comparing manifest information
and sending deltas for proper upgrades).
@
text
@d10 2
a11 1
OBJS   = wrappers.o authentication.o profiles.o config.o sql.o help.o
d31 1
a31 1
OBJS += $(PGSQLOBJS)
d37 1
a37 1
OBJS += $(MYSQLOBJS)
d60 3
a62 1
all: updated
d68 3
@


1.1
log
@Initial revision
@
text
@d11 1
@


1.1.1.1
log
@Initial commit of my FreeBSD Binary Update code
-----------------------------------------------

NOTES       - Initial design discussions and some implementation details
              (kinda sparse at the moment, but its a start.  

updated.c   - The main network server source - forks a daemon, opens
              syslog, listens for connections in an event loop, etc..

updated.h   - Contains all of the data structures for the database
              abstraction layer, function prototypes, and portability defines

profiles.c  - The code that deals with the concept (or data structure)
              of a profile as defined in NOTES.  These routines are
              called by the main server loop in updated.c and it deals
              extensively with the sql abstration layer to get the
              information it needs in a non database-specific way.

sql.c       - The database abstraction layer which initializes the database
              object's function pointers to the specific
              implementation required.  Also contains generic result
              processing code.

mysql.c	    - MySQL specific code (75% implemented)

pgsql.c	    - PostgresSQL specific code (functional)

makefile    - Makefile with conditional compiles depending on the
              existance of database client libraries, the existance of
              libutil/find_property, and strlcpy.  This should be
              enough to compile on Linux or NetBSD.  No claims about anything
              further than that.

wrappers.c  - wrappers for safe malloc, convenient network i/o, etc..

authentication.c - the unimplemented authentication mechanism

config.c    - Reads/write the configuration file from "./.updated" if it
              exists or prompt the users for answers if not.  This currently
              requires GNU readline but that will be resolved soon.

help.c	    - Implements the basic help functionality for the protocol,
	      mostly for the benefit of adventurous souls telnetting directly
	      to the server's port.

setupdb.pl  - Creates the tables necessary in the given database

populate.pl - Fills in the database tables for the RELEASE-4.0
              profile (or any other).

property.h  - snippet of libutil.h for systems that don't supply it

property.c  - the find_property, etc functions from libutil for systems
              that don't supply it.

@
text
@@
