From 83e8262e4706839ef9c98a7ac94286fe8e62d721 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 27 Apr 2006 10:01:59 +0200 Subject: [PATCH] Helper scripts for ccollect 0.4 Migrating to ccollect 0.4 is supported by the helper scripts. --- tools/config-pre-0.4-to-0.4.BUGS | 24 ++++++++++++++++++++++++ tools/config-pre-0.4-to-0.4.sh | 18 ++++++++++++++++++ tools/config-pre-0.4-to-0.4.sub.sh | 21 +++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 tools/config-pre-0.4-to-0.4.BUGS create mode 100755 tools/config-pre-0.4-to-0.4.sh create mode 100755 tools/config-pre-0.4-to-0.4.sub.sh diff --git a/tools/config-pre-0.4-to-0.4.BUGS b/tools/config-pre-0.4-to-0.4.BUGS new file mode 100644 index 0000000..bfa602a --- /dev/null +++ b/tools/config-pre-0.4-to-0.4.BUGS @@ -0,0 +1,24 @@ +The scripts are only for 'standard' configurations. + +If you've multiple directories named 'intervalls', the +scripts will try to replace _all_ instances of intervalls with +"intervals". + +This will fail: + + intervalls/defaults/intervalls/ exists before. + + Then we'll replace the first time: + + intervals/defaults/intervalls/ exists now. + + Then find will fail, as the first directory disappeared. + +Also, if you have a source named 'intervalls' +(why so ever you would want to have something like that) and +a 'intervalls' directory below it, it will rename your source. + +Yes this is a bug. + +No, I do not care about it, this is just a dumb helper script which +should be used once. diff --git a/tools/config-pre-0.4-to-0.4.sh b/tools/config-pre-0.4-to-0.4.sh new file mode 100755 index 0000000..f00ff79 --- /dev/null +++ b/tools/config-pre-0.4-to-0.4.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# Nico Schottelius +# Do Apr 27 09:13:26 CEST 2006 +# + +if [ $# -ne 1 ]; then + echo "$0: ccollect-configuration directory" + echo "" + echo " Fix pre 0.4 configuration directories to match 0.4 style" + echo "" + exit 23 +fi + +script=$(echo $0 | sed 's/\.sh/.sub.sh/') + +find "$1" -type d -name intervalls -exec "$script" {} \; + + diff --git a/tools/config-pre-0.4-to-0.4.sub.sh b/tools/config-pre-0.4-to-0.4.sub.sh new file mode 100755 index 0000000..bf76aed --- /dev/null +++ b/tools/config-pre-0.4-to-0.4.sub.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Nico Schottelius +# Do Apr 27 09:13:26 CEST 2006 +# + +master=$(echo $0 | sed 's/\.sub//') + +if [ $# -ne 1 ]; then + echo "$0: DO NOT CALL ME DIRECTLY" + echo "$master calls me for moving" + exit 23 +fi + +# strip trailing / +oldname=$(echo $1 | sed 's,/$,,') + +# replace the last component of the path "intervalls" +newname=$(echo $oldname | sed 's/intervalls$/intervals/') + +echo mv "$oldname" "$newname" +mv "$oldname" "$newname"