From 890758b95c7893f96a219e3ee9fea1cdb629e3b3 Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Fri, 18 Apr 2003 18:55:53 +0000
Subject: [PATCH] Initial commit.

---
 ChangeLog    | 10 ++++++++++
 Makefile.am  | 30 ++++++++++++++++++++++++++++++
 NEWS         |  1 +
 README       | 32 ++++++++++++++++++++++++++++++++
 bootstrap.sh | 10 ++++++++++
 configure.ac | 34 ++++++++++++++++++++++++++++++++++
 createdb.sql | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 sqltypes.sed | 13 +++++++++++++
 8 files changed, 180 insertions(+)
 create mode 100644 ChangeLog
 create mode 100644 Makefile.am
 create mode 100644 NEWS
 create mode 100644 README
 create mode 100755 bootstrap.sh
 create mode 100644 configure.ac
 create mode 100644 createdb.sql
 create mode 100644 sqltypes.sed

diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..2a6c5cb
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,10 @@
+2003-04-18  Per Cederqvist  <ceder@ceder.dyndns.org>
+
+	* AUTHORS: New file.
+	* Makefile.am: New file.
+	* NEWS: New file.
+	* README: New file.
+	* bootstrap.sh: New file.
+	* configure.ac: New file.
+	* createdb.sql: New file.
+	* sqltypes.sed: New file.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..e8ae3fe
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,30 @@
+#  isoonline - Backup static hierarchies to ISO images with online index.
+#  Copyright (C) 2003 Per Cederqvist
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+## Process this file with ./bootstrap.sh.
+
+MYSQL = @MYSQL@
+pkgpython_PYTHON = scanner.py
+
+all:
+
+recreate_db: Makefile $(srcdir)/sqltypes.sed $(srcdir)/createdb.sql
+	sed -f $(srcdir)/sqltypes.sed < $(srcdir)/createdb.sql \
+		| $(MYSQL)
+optimize_db: Makefile $(srcdir)/sqltypes.sed $(srcdir)/optimize.sql
+	sed -f $(srcdir)/sqltypes.sed < $(srcdir)/optimize.sql \
+		| $(MYSQL) gpgpathfinder
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..cb4a3a3
--- /dev/null
+++ b/NEWS
@@ -0,0 +1 @@
+Nothing to report yet.
diff --git a/README b/README
new file mode 100644
index 0000000..11a5d1a
--- /dev/null
+++ b/README
@@ -0,0 +1,32 @@
+Yet another CD-R backup utility.
+
+Features: the files to be backed up are permanent files that are never
+removed or altered (such as your photo album or music collection).
+Each file is saved on at least two different ISO images.  An on-line
+index keeps track of all ISO images and all files.  The index contains
+an SHA-1 fingerprint of each file, for easy verification of both the
+online files and the ISO images.  The system keeps track of when each
+media was last verified.
+
+The name "isoonline" is a very bad one.  Google finds 1330 matches (as
+of 2003-04-18).  But I need a name -- any name -- to be able to create
+a CVS repository.  If I ever make a release of this I will probably
+have to come up with a better name, but for now, the highest priority
+is to make a backup copy of my photos.  Figuring out a good name for
+the backup system will have to wait.
+
+Installation
+============
+
+Log in as the mysql "root" user and run this command, substituting
+"ceder" to whatever name you plan to run the program as:
+
+    GRANT ALL ON isoonline.* to ceder@localhost;
+
+Then do the normal "./configure && make && make install" thing.
+Finally, if this is a first-time install, run "make recreate_db".
+
+Bootstrapping from CVS
+======================
+
+Use the bootstrap.sh script to create a configure script.
diff --git a/bootstrap.sh b/bootstrap.sh
new file mode 100755
index 0000000..41599d9
--- /dev/null
+++ b/bootstrap.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+#  This file is probably useful only to the maintainer.
+#  Create "configure" and all the files it needs.
+#  This file was created by Per Cederqvist and placed in the public domain.
+
+aclocal
+autoconf
+# autoheader
+automake -a
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..bb7a7ee
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,34 @@
+dnl  isoonline - Backup static hierarchies to ISO images with online index.
+dnl  Copyright (C) 2003 Per Cederqvist
+dnl
+dnl  This program is free software; you can redistribute it and/or modify
+dnl  it under the terms of the GNU General Public License as published by
+dnl  the Free Software Foundation; either version 2 of the License, or
+dnl  (at your option) any later version.
+dnl
+dnl  This program is distributed in the hope that it will be useful,
+dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl  GNU General Public License for more details.
+dnl
+dnl  You should have received a copy of the GNU General Public License
+dnl  along with this program; if not, write to the Free Software
+dnl  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+dnl Process this file with ./bootstrap to produce a configure script.
+
+AC_INIT(isoonline.cfg)
+AM_INIT_AUTOMAKE(isoonline, 0.0)
+
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+
+AM_PATH_PYTHON
+
+AC_PATH_PROG(MYSQL, mysql, nomysql)
+[if test "$MYSQL" = nomysql
+then]
+    AC_ERROR([cannot find mysql in \$PATH, which is set to $PATH])
+[fi]
+
+AC_OUTPUT(Makefile)
diff --git a/createdb.sql b/createdb.sql
new file mode 100644
index 0000000..ab1606e
--- /dev/null
+++ b/createdb.sql
@@ -0,0 +1,50 @@
+# Create the database tables needed by isoonline.  Please note that
+# this removes the database if it already exists.
+
+drop database if exists isoonline;
+create database isoonline;
+use isoonline;
+
+create table base (
+	dir_id int64 auto_increment	primary key not null,
+	dir_name varchar(255)		not null,
+	active bool			not null,
+	last_scanned datetime		null,
+	first_scanned datetime		null,
+
+	UNIQUE(dir_name),
+	INDEX(active, last_scanned)
+);
+
+create table file (
+	file_id int64 auto_increment	primary key not null,
+	filename varchar(255)		not null,
+	dir_id int64			not null references base(dir_id),
+	ctime datetime			not null,
+	atime datetime			not null,
+	size int64			not null,
+	md5sum char(32)			not null,
+
+	INDEX(filename),
+	UNIQUE(filename, size, ctime, atime, md5sum),
+	INDEX(md5sum),
+	INDEX(size)
+);
+
+create table media (
+	media_id int32 auto_increment	primary key not null,
+	written datetime		not null,
+	verified datetime		null,
+	broken bool			not null,
+
+	INDEX(written),
+	INDEX(verified)
+);
+
+create table contents (
+	media int32			not null references media(media_id),
+	file int64			not null references file(file_id),
+
+	INDEX(file),
+	INDEX(media)
+);
diff --git a/sqltypes.sed b/sqltypes.sed
new file mode 100644
index 0000000..fdaf09e
--- /dev/null
+++ b/sqltypes.sed
@@ -0,0 +1,13 @@
+s/[ 	][ 	]*/ /g
+s/bool/tinyint unsigned/g
+s/uint8/tinyint unsigned/g
+s/uint16/smallint unsigned/g
+s/uint24/mediumint unsigned/g
+s/uint32/integer unsigned/g
+s/uint64/bigint unsigned/g
+s/int8/tinyint/g
+s/int16/smallint/g
+s/int24/mediumint/g
+s/int32/integer/g
+s/int64/bigint/g
+s/#.*//g
-- 
GitLab