~dveeden/mysql-sandbox/mysql-sandbox

« back to all changes in this revision

Viewing changes to script_templates/process/change_paths.sh

  • Committer: Giuseppe Maxia
  • Date: 2009-05-09 08:04:44 UTC
  • Revision ID: g.maxia@gmail.com-20090509080444-jy8a330el0mt425a
Tags: 3.0
- 3.0.00 GA release
- no code modification. Same codebase as 2.0.99f
- completed cookbook (41 recipes in MySQL::Sandbox::Recipes)
- added script_templates directory (No modification in current version, just preparation for 3.1.xx)
- added drafts directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!_BINBASH_
 
2
__LICENSE__
 
3
if [ "$1" = "" ]
 
4
then
 
5
    OLD_SB_LOCATION=_HOME_DIR_/_SANDBOXDIR_
 
6
else
 
7
    OLD_SB_LOCATION=$1
 
8
fi
 
9
 
 
10
if [ "$2" = "" ]
 
11
then
 
12
    NEW_SB_LOCATION=$PWD
 
13
else
 
14
    NEW_SB_LOCATION=$2
 
15
fi
 
16
 
 
17
if [ $OLD_SB_LOCATION = $NEW_SB_LOCATION ]
 
18
then
 
19
    echo Old location and new location must be different.
 
20
    echo Move the sandbox to the new location and then run this script.
 
21
    exit
 
22
fi
 
23
 
 
24
if [ ! -d "$NEW_SB_LOCATION" ]
 
25
then
 
26
    echo "new location must be a directory"
 
27
    exit
 
28
fi
 
29
 
 
30
PERL_SCRIPT1='BEGIN{$old=shift;$new=shift};'
 
31
PERL_SCRIPT2='s/$old/$new/g' 
 
32
PERL_SCRIPT="$PERL_SCRIPT1 $PERL_SCRIPT2"
 
33
 
 
34
SCRIPTS1="start stop send_kill clear restart my.sandbox.cnf "
 
35
SCRIPTS2="load_grants my use sandbox_env $0"
 
36
SCRIPTS="$SCRIPTS1 $SCRIPTS2"
 
37
 
 
38
for SCRIPT in $SCRIPTS
 
39
do
 
40
    perl -i.bak -pe "$PERL_SCRIPT" $OLD_SB_LOCATION $NEW_SB_LOCATION $SCRIPT
 
41
done
 
42
echo "($PWD) The old scripts have been saved as filename.path.bak"