mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
303c0a0ba8
+ improved scripts for mounting volumes + increased verbosity of upgrade script
34 lines
904 B
Bash
34 lines
904 B
Bash
#!/usr/bin/env bash
|
|
|
|
yq() {
|
|
docker run --rm -i -v "${PWD}:/workdir" mikefarah/yq:4 "$@"
|
|
}
|
|
|
|
config()
|
|
{
|
|
echo -ne "Checking user... "
|
|
if [[ "$(whoami)" != "root" ]] && ! groups | grep docker
|
|
then
|
|
echo "Please add your current user to the docker group OR run this script as root."
|
|
echo "current user is not allowed to use docker, exiting..."
|
|
exit 1
|
|
fi
|
|
SERVICE="$(yq eval '.services.*.image | select(. == "sleede/fab-manager*") | path | .[-2]' docker-compose.yml)"
|
|
}
|
|
|
|
change_mount()
|
|
{
|
|
if [[ $(yq eval ".services.$SERVICE.volumes.[] | select (. == \"*assets\")" docker-compose.yml) ]]; then
|
|
yq -i eval ".services.$SERVICE.volumes.[] |= select(. == \"*assets\") |= \"\${PWD}/public/packs:/usr/src/app/public/packs\"" docker-compose.yml
|
|
echo "Service volume was replaced for $SERVICE: /assets changed to /packs"
|
|
fi
|
|
}
|
|
|
|
proceed()
|
|
{
|
|
config
|
|
change_mount
|
|
}
|
|
|
|
proceed "$@"
|