Created
November 18, 2015 17:33
-
-
Save dudymas/90d7acc4174ea1803add to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "$(which jq)" == "" ]]; then | |
echo Please install jq \(i.e. brew install jq \)... | |
echo jq is used to parse configs. | |
exit 1 | |
fi | |
function repoint-config { | |
MACHINE_CONFIG=$1 | |
NEW_STORE=${2:-$PWD} | |
OLD_STORE=$(jq -r '.HostOptions.AuthOptions.StorePath' < $MACHINE_CONFIG) | |
echo Updating $MACHINE_CONFIG | |
echo Moving $OLD_STORE to $NEW_STORE | |
sed -i '' "s^$OLD_STORE^$NEW_STORE^g" $MACHINE_CONFIG | |
} | |
function repoint-configs { | |
MACHINE_STORAGE_PATH=${MACHINE_STORAGE_PATH:-$PWD} | |
for config in $MACHINE_STORAGE_PATH/machines/*/config.json ; do | |
repoint-config $config $MACHINE_STORAGE_PATH | |
done | |
} | |
repoint-configs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment