summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2003-01-11 19:12:35 +0000
committerJonas Smedegaard <dr@jones.dk>2003-01-11 19:12:35 +0000
commitecfe46ec71f08aed24d0cdb7890b07f2e892f63c (patch)
treed731601fdbd0b1002dbe67c94c618250a98df027
parent3258357eb442590d32967e788ff84efbb6f3c231 (diff)
New script localeztemplateget to extract template from eZ 2.2.x site.
-rwxr-xr-xlocaleztemplateget53
1 files changed, 53 insertions, 0 deletions
diff --git a/localeztemplateget b/localeztemplateget
new file mode 100755
index 0000000..320f1f4
--- /dev/null
+++ b/localeztemplateget
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# /usr/local/bin/localeztemplategrab
+# Copyright 2003 Jonas Smedegaard <dr@jones.dk>
+#
+# $Id: localeztemplateget,v 1.1 2003-01-11 19:12:35 jonas Exp $
+#
+# Extract template from eZ Publish 2.2.x site and save as separate tarball
+#
+
+#set -e
+
+prg=`basename $0`
+
+if [ -z "$1" -o -z "$2" ]; then
+ echo "$prg: Extract template from eZ Publish 2.2.x site"
+ echo " and save as separate tarball"
+ echo
+ echo "Usage: $prg template origdir [targetfile]"
+ echo
+ echo "Options:"
+ echo " template: name of template to extract"
+ echo " origdir: Base directory for eZ Publish website"
+ echo " targetfile: Where to store template tarball"
+ echo
+ echo
+ echo "If targetfile not provided, it is named after the template and saved in"
+ echo "current directory."
+ exit 1
+fi
+
+template=$1
+origdir=$2
+targetfile=${3:-$template.tar.gz}
+
+if [ ! -d "$origdir" ]; then
+ echo "ERROR: eZ directory \"$origdir\" doesn't exist!"
+ echo "Aborting..."
+ exit 1
+fi
+if echo "$targetfile" | egrep -vq '\.(tar\.gz|tgz$)' ; then
+ targetfile="$targetfile.tar.gz"
+ echo "WARNING: appending extensions to targetfile. New name: \"$targetfile\""
+fi
+if [ -f "$targetfile" ]; then
+ echo "ERROR: targetfile \"$targetfile\" already exists!"
+ echo "Aborting...!"
+ exit 1
+fi
+
+tar --create --to-stdout --mode='a=r,u+w,a+X' --directory=$origdir `cd $origdir && find * -type f | grep -v cache | grep "/$template/"` | gzip --best > $targetfile
+
+echo "Done! Templates are in \"$targetfile\""