summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGavin Romig-Koch <gavin@localhost.localdomain>2009-08-20 12:18:33 -0400
committerGavin Romig-Koch <gavin@localhost.localdomain>2009-08-20 12:18:33 -0400
commit71842a8b96792ee7478b817927e6b1b1ee3e223c (patch)
tree60fd149614522a79f8efbc817a0763f0cc7e693c
parentc238b074feb5cc0fcd7bcac331036b09aa80a7a1 (diff)
downloadfastback-71842a8b96792ee7478b817927e6b1b1ee3e223c.tar.gz
fastback-71842a8b96792ee7478b817927e6b1b1ee3e223c.tar.xz
fastback-71842a8b96792ee7478b817927e6b1b1ee3e223c.zip
changes needed to push it public
-rw-r--r--FIXME4
-rw-r--r--README2
-rwxr-xr-xfastback-check23
-rwxr-xr-xfastback-unload-receipt9
-rw-r--r--fastback.conf11
-rw-r--r--fastback.cpp19
-rwxr-xr-xfetch-from-indus8
-rwxr-xr-xfetch-from-remote22
-rwxr-xr-xsetup-fastback-server2
9 files changed, 72 insertions, 28 deletions
diff --git a/FIXME b/FIXME
index a30c34d..bc6fb59 100644
--- a/FIXME
+++ b/FIXME
@@ -1,11 +1,11 @@
+* add the ticketname to the filename
+
* config file comments can only be on a line by themselves
* config file strings can't have nested double quotes
* must catch the case that the given file is not a flat file
-* get rid of fastback_default_URLDIR, error out if no URLDIR is
- given in config file.
diff --git a/README b/README
index 6620f3b..489bac3 100644
--- a/README
+++ b/README
@@ -4,8 +4,6 @@ BuildRequires:
libcurl-devel
g++
-
-
Requires:
openssl
libcurl
diff --git a/fastback-check b/fastback-check
index 4e8b549..ca3c56f 100755
--- a/fastback-check
+++ b/fastback-check
@@ -1,5 +1,26 @@
#!/bin/bash
+#
+# This file can be used to check that fastback and fastback-unload-receipt
+# are working IF you can write a script that fetches the file back from
+# the remote ftp server: see ./fetch-from-remote
+#
+# You must rewrite fetch-from-remote for this to work correctly
+#
+#
+
+# ./fastback-check FILE [encrypt] [TICKET]
+#
+# where
+# FILE is the name of the file to test with
+# TICKET is the name of the ticket or the string "new" to
+# indicate that you what to specify "-n" to fastback
+# if specified as the second argument "encrypt" will cause -e to be
+# passed to fastback
+# the second and third arguments are optional
+#
+
+
ORIG=$1
if [ ! -e $ORIG ]; then
@@ -48,7 +69,7 @@ cat $RECEIPT | while read FIRST REST ; do
exit 2
fi
- ./fetch-from-indus $FILE
+ ./fetch-from-remote $FILE
fastback-unload-receipt $RECEIPT
diff --git a/fastback-unload-receipt b/fastback-unload-receipt
index b9b2f61..97619b9 100755
--- a/fastback-unload-receipt
+++ b/fastback-unload-receipt
@@ -1,5 +1,12 @@
#!/bin/bash
-
+#
+# ./fastback-unload-receipt RECEIPT
+# where RECEIPT is the name of the file containing the receipt
+# output by fastback
+#
+# will check the md5sum of the file, and decript it if it is encrypted
+# the file must have already been downloaded to the local directory
+#
RECEIPT=$1
if [ "$2" = "" ]; then
diff --git a/fastback.conf b/fastback.conf
index bb59955..d529d74 100644
--- a/fastback.conf
+++ b/fastback.conf
@@ -1,8 +1,11 @@
# this is a config file for fastback
-URLDIR = ftp://indus.usersys.redhat.com/incoming/
-LOGFILE = fastback-logfile
+# Set URLDIR to the directory where you want files sent
+# fastback will append the name of the file to this
+# URLDIR = ftp://example.com/incoming/
-# ERROR = 103
-# error
+# Set LOGFILE to the name of the file where you want logs written
+# this can be absolute or relative to the directory where fastback
+# is run
+LOGFILE = fastback-logfile
diff --git a/fastback.cpp b/fastback.cpp
index 747566f..3597b8c 100644
--- a/fastback.cpp
+++ b/fastback.cpp
@@ -57,6 +57,7 @@ typedef std::string string;
static const char fastback_name[] = "fastback";
+static const char fastback_config_file[] = "/etc/fastback.conf";
// These are command line options
// if set they must be malloc'ed memory.
@@ -82,11 +83,6 @@ static string fastback_tmpdir;
-//static const char* fastback_default_URLDIR = "ftp://dropbox.redhat.com/incoming/";
-static const char* fastback_default_URLDIR = "ftp://indus.usersys.redhat.com/incoming";
-
-
-
static size_t
fastback_read(void *buffer, size_t size, size_t nmemb, void *userp)
@@ -573,7 +569,7 @@ main(int argc, char** argv)
exit(2);
}
- if (parse_config("/etc/fastback.conf"))
+ if (parse_config(fastback_config_file))
exit(2);
if (fastback_conf_LOGFILE)
@@ -589,13 +585,18 @@ main(int argc, char** argv)
}
}
- if (!fastback_URLDIR)
- fastback_URLDIR = strdup(fastback_default_URLDIR);
+ if (!fastback_URLDIR || !strcmp(fastback_URLDIR,""))
+ {
+ fprintf(stderr,
+ "%s: error: URLDIR not set in: %s\n",
+ fastback_name, fastback_config_file);
+ exit(3);
+ }
if (!readable(fastback_filename))
{
string msg = fastback_name;
- msg += ": error: could not open: ";
+ msg += ": error: could not read: ";
msg += fastback_filename;
perror(msg.c_str());
exit(3);
diff --git a/fetch-from-indus b/fetch-from-indus
deleted file mode 100755
index cae7ee1..0000000
--- a/fetch-from-indus
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-
-
-scp root@indus.usersys.redhat.com:/var/ftp/incoming/$1 .
-#echo "this is junk" >$1
-
-
diff --git a/fetch-from-remote b/fetch-from-remote
new file mode 100755
index 0000000..94ebf17
--- /dev/null
+++ b/fetch-from-remote
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# MUST BE EDITED before it will work
+# this file is used as part of fastback-check
+# it is used to fetch the file from the remote server
+# typically the ftp server is set up to disallow fetching by
+# normal users, so you have to have some special privilages
+#
+
+
+# scp root@example.com:/var/ftp/incoming/$1 .
+
+
+#
+# The following line is used to test that check that
+# fastback-unload-reciept's error checking is working
+# after downloading the file, we mangle it so that
+# fastback-unload-reciept will see a mangled file
+#
+# echo "this is junk" >$1
+
+
diff --git a/setup-fastback-server b/setup-fastback-server
index 7a88ff7..1b36dc1 100755
--- a/setup-fastback-server
+++ b/setup-fastback-server
@@ -1,5 +1,5 @@
# run this as root on the machine you want to setup as your
-# test anonymous server
+# test FTP anonymous server
yum install -y vsftpd
mkdir -p /var/ftp/incoming