Module: check_mk
Branch: master
Commit: 461df8a12f552bea900487eac210d263287a4cd6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=461df8a12f552b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Dec 16 15:08:15 2011 +0100
Fixed the migration script from 1.1.12 wato to 1.1.13 wato
---
doc/helpers/wato-migrate-1.2.0.sh | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/doc/helpers/wato-migrate-1.2.0.sh b/doc/helpers/wato-migrate-1.2.0.sh
index 305d5d9..4578a80 100755
--- a/doc/helpers/wato-migrate-1.2.0.sh
+++ b/doc/helpers/wato-migrate-1.2.0.sh
@@ -46,12 +46,20 @@ then
echo "-----------------------------------------"
fi
+echo
find * -name "*.mk.wato" | while read line
do
- thedir=${line%/*}
- thefile=${line##*/}
- echo "Moving $thefile in $thedir..."
- newdir="wato/${thefile%.mk.wato}"
+ tmpline=/$line
+ thedir=${tmpline%/*}
+ thedir=${thedir:1}
+ thefile=${tmpline##*/}
+ if [ -z "$thedir" ]; then
+ newdir=wato/${thefile//.mk.wato}
+ else
+ newdir=wato/$thedir/${thefile//.mk.wato}
+ fi
+
+ echo "Migrating hostlist $thefile to folder $newdir..."
mkdir -vp "$newdir"
mv -v "$line" "$newdir/.wato"
mv -v "${line%.wato}" "$newdir/hosts.mk"
@@ -60,10 +68,11 @@ done
# No move also the empty WATO directories
find * -name ".wato" | while read line
do
- if [ ${line:0:7} = ./wato/ ] ; then continue ; fi
+ # Skip files in wato/ directory (already migrated)
+ if [ ${line:0:5} = wato/ ] ; then continue ; fi
thedir=${line%/*}
thefile=${line##*/}
- echo "Moving empty directory $thedir..."
+ echo "Moving empty directory $thedir to wato/$thedir..."
mkdir -p "wato/$thedir"
mv -v $line "wato/$thedir"
rmdir -v "$thedir" 2>/dev/null || true