[source:1] Added file name transformation functionality to workaround Sun Cloud iss
- From: gbrunett@kenai.com
- To: commits@zfs-backup-to-s3.kenai.com
- Subject: [source:1] Added file name transformation functionality to workaround Sun Cloud iss
- Date: Tue, 28 Apr 2009 20:14:48 +0000 (GMT)
Repository: source
Revision: 1
Author: gbrunett@localhost
Date: 2009-04-28 20:14:20 UTC
Link:
http://kenai.com/projects/zfs-backup-to-s3/sources/source/revision/1
Log Message:
-----------
Added file name transformation functionality to workaround Sun Cloud
issues storing files with "@" or ":" characters.
Modified Paths:
--------------
zfs-backup-to-s3.dfl
zfs-backup-to-s3.sh
Diffs:
-----
diff -r df535990a7af -r 4db9d744c6f4 zfs-backup-to-s3.dfl
--- a/zfs-backup-to-s3.dfl Mon Apr 27 14:47:28 2009 -0400
+++ b/zfs-backup-to-s3.dfl Tue Apr 28 16:14:20 2009 -0400
@@ -20,11 +20,11 @@
# a PKCS#11 token.
KEY_LABEL=
-# S3_CMD_PATH defines the path name of the directory in which the
-# S3 command line interface (and associated dependents) live. This
-# parameter is needed to call the back-end program that performs
-# the actual Amazon S3 GET/PUT operations.
-S3_CMD_PATH=""
+# S3_CLI_CMD_NAME defines the name of the program to use as the
+# S3 command line interface. This parameter is needed to call the
+# back-end program that performs the actual Amazon S3 GET/PUT
+# operations.
+S3_CLI_CMD_NAME=""
# S3_ACCESS_KEY_ID defines the Amazon Simple Storage Service (S3)
# Access Key to be used for the storage of the encrypted snapshots.
diff -r df535990a7af -r 4db9d744c6f4 zfs-backup-to-s3.sh
--- a/zfs-backup-to-s3.sh Mon Apr 27 14:47:28 2009 -0400
+++ b/zfs-backup-to-s3.sh Tue Apr 28 16:14:20 2009 -0400
@@ -30,7 +30,7 @@
KEY_STRING=""
# Amazon S3 specific parameters.
-S3_CMD_PATH=""
+S3_CLI_CMD_NAME=""
S3_ACCESS_KEY_ID=""
S3_SECRET_ACCESS_KEY=""
S3_BUCKET=""
@@ -94,11 +94,11 @@
exit 1
fi
-if [ ! -x ${S3_CMD_PATH}/s3 ]; then
- echo "S3 command path did not point to s3 command: ${S3_CMD_PATH}"
+if [ ! -x ${S3_CLI_CMD_NAME} ]; then
+ echo "S3 command path did not point to s3 command:
${S3_CLI_CMD_NAME}"
exit 1
else
- PATH=$PATH:${S3_CMD_PATH}
+ PATH=$PATH:`dirname ${S3_CLI_CMD_NAME}`
export PATH
fi
@@ -116,10 +116,19 @@
# Create a temporary file to house the content received from the ZFS
auto-
# snapshot service. The name of the file containing the encrypted
content
# will be the same as the ZFS snapshot name except that '/' characters
will
-# be changed to '~' characters and a '.enc' suffix will be added.
+# be changed to the string '~slash~' and a '.enc' suffix will be
added.
+#
+# NOTE: Sun Cloud does not permit the following characters in the name
of
+# files stored: "@" or ":". As a result, those characters will be
changed
+# to "~at~" and "~colon~" respectively.
#
***********************************************************************
*****
-tmp_file="${tmp_dir}/`echo ${LAST_SNAP} | sed 's|/|~|g'`.enc"
+new_name=`echo ${LAST_SNAP} |\
+ sed 's|/|~slash~|g' |\
+ sed 's|@|~at~|g' |\
+ sed 's|:|~colon~|g'`
+
+tmp_file="${tmp_dir}/${new_name}.enc"
#
***********************************************************************
*****
# Stream the content through an encryption filter and store as a file.
@@ -139,7 +148,7 @@
#
***********************************************************************
*****
if [ -s ${tmp_file} ]; then
- ${S3_CMD_PATH}/s3 put ${S3_BUCKET} `basename ${tmp_file}`
${tmp_file}
+ ${S3_CLI_CMD_NAME} put ${S3_BUCKET} `basename ${tmp_file}`
${tmp_file}
fi
#
***********************************************************************
*****
|
[source:1] Added file name transformation functionality to workaround Sun Cloud iss |
gbrunett | 04/28/2009 |





