From ecfe46ec71f08aed24d0cdb7890b07f2e892f63c Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 11 Jan 2003 19:12:35 +0000 Subject: New script localeztemplateget to extract template from eZ 2.2.x site. --- localeztemplateget | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 localeztemplateget (limited to 'localeztemplateget') 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 +# +# $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\"" -- cgit v1.2.3