From: <bms...@us...> - 2007-04-08 14:08:01
|
Revision: 2484 http://svn.sourceforge.net/morphix/?rev=2484&view=rev Author: bmsleight Date: 2007-04-08 07:07:58 -0700 (Sun, 08 Apr 2007) Log Message: ----------- Prepare template for autobuilding Added Paths: ----------- trunk/mmaker/utils/local-prepare-templates.sh Added: trunk/mmaker/utils/local-prepare-templates.sh =================================================================== --- trunk/mmaker/utils/local-prepare-templates.sh (rev 0) +++ trunk/mmaker/utils/local-prepare-templates.sh 2007-04-08 14:07:58 UTC (rev 2484) @@ -0,0 +1,84 @@ +#!/bin/bash +# +# Copyleft (c) 2007 Brendan M. Sleight # +# <bmsleight@barwap._REMOVE_SPAM_TRAP.com> # +# # +# This script is licensed under the GNU GPL v2 or later. # +# # +# On Debian systems, this license can be obtained via # +# /usr/share/common-licenses/GPL # +# + +get_global_variables() +{ +MORPHIX_TEMPLATES_URI="https://morphix.svn.sourceforge.net/svnroot/morphix/trunk/mmaker/templates/" +TMP_DIR=/tmp/morphix-lpt.$$ +TMP_FILE=/tmp/morphix-lpt.$$.tmp +} + +clean_up() +{ +rm $TMP_DIR -Rf 2>/dev/null +rm $TMP_FILE 2>/dev/null +} + +get_templates() +{ +svn co $MORPHIX_TEMPLATES_URI $TMP_DIR +} + +replace_debian_repo() +{ +echo "Replace ftp.debian.org in $1 with $NEW_DEBIAN_REPO" +sed s_ftp.debian.org_"$NEW_DEBIAN_REPO"_g $TMP_DIR/$1 >$TMP_FILE +mv $TMP_FILE $TMP_DIR/$1 +} + +replace_release() +{ +if [ -z "$RELEASE" ]; then + echo "No change of release type for $1" +else + echo "Replace <suite>foobar</suite> in $1 with $RELEASE" + FINDS="^.*<suite>.*$" + REPLACES=" <suite>$RELEASE</suite>" + sed s_"$FINDS"_"$REPLACES"_ $TMP_DIR/$1 >$TMP_FILE + mv $TMP_FILE $TMP_DIR/$1 +fi +} + + +while getopts d:t:r: opt +do + case "$opt" in + d) NEW_DEBIAN_REPO="$OPTARG";; + t) LOCAL_TEMPLATE_DIR="$OPTARG";; + r) RELEASE="$OPTARG";; + \?) # unknown flag + echo >&2 \ + "Usage: $0 -d master.debian.repository.url -t /local/template/dir [-r release] template1.xml template2.xml .... " + exit 1;; + esac +done +shift `expr $OPTIND - 1` + + +if [ -z "$NEW_DEBIAN_REPO" -o -z "$LOCAL_TEMPLATE_DIR" ]; then + echo "Usage: $0 -d master.debian.repository.url -t /local/template/dir [-r release] template1.xml template2.xml .... " + echo "e.g. $0 -d ftp.si.debian.org -t /home/bms/build-templates/ -r sid morphix-livekiosk.xml morphix-kse.xml morphix-gnome.xml " + echo + echo "The above example will download three templates form the morphix repository. " + echo "For each template replace ftp.debian.com with ftp.si.debian.org, set <suite>sid</suite> and place in /home/bms/build-templates/ " + echo "Ready for running the local_autobuild.sh on /home/bms/build-templates/" + exit +fi + +get_global_variables +get_templates +for TEMPLATE in $* +do + replace_debian_repo $TEMPLATE + replace_release $TEMPLATE + mv $TMP_DIR/$TEMPLATE $LOCAL_TEMPLATE_DIR/$TEMPLATE +done +clean_up Property changes on: trunk/mmaker/utils/local-prepare-templates.sh ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |