1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00
fab-manager/scripts/use-relative-paths.sh

31 lines
803 B
Bash
Executable File

#!/usr/bin/env bash
# This script changes the paths in the docker-compose.yml file to use relative paths
# Previously, we were using ${PWD} to get the path to the current directory, but this
# caused issues when running a script from a different directory with "docker-compose -f".
config()
{
echo "Checking docker-compose file... "
FABMANAGER_PATH=$(pwd)
if [ ! -w "$FABMANAGER_PATH/docker-compose.yml" ]; then
echo "Fab-manager's docker-compose.yml file not found or not writable."
echo "Please run this script from the installation folder, and as a user having write access on docker-compose.yml"
exit 1
fi
}
rename()
{
echo "Renaming paths... "
sed -i.bak "s/\${PWD}/\./g" "$FABMANAGER_PATH/docker-compose.yml"
}
proceed()
{
config
rename
}
proceed "$@"