Replace single bracket [ ] with double bracket [[ ]] for all test
conditionals in the main scripts.
Benefits of [[ over [:
- No need to quote variables (though we still do for consistency)
- Supports regex matching with =~
- Supports pattern matching with == and !=
- && and || work inside [[ ]] without escaping
- More predictable behavior with empty strings
- Is a bash keyword, not an external command
Note: posbox scripts are left unchanged as they appear to be
third-party code imported into the repository.
Properly quote all variable expansions to prevent word splitting and
glob expansion issues:
- Quote $POSTGRES_SERVICE_NAME in docker exec command
- Quote $REPERTOIRE in directory test
- Remove unnecessary $ inside arithmetic expressions (($VAR -> VAR))
Unquoted variables can cause unexpected behavior when values contain
spaces or special characters. In arithmetic contexts, $ is unnecessary
and can mask errors with set -u.
Add proper argument validation at the start of upgrade.sh:
- Check that exactly 4 arguments are provided
- Display a helpful usage message with argument descriptions
- Include a concrete example command
This prevents cryptic errors when the script is called incorrectly
and provides clear guidance on expected parameters. With set -u enabled,
accessing unset positional parameters would cause an unclear error message.
Enable bash strict mode in all shell scripts to catch errors early:
- set -e: Exit immediately if a command exits with non-zero status
- set -u: Treat unset variables as an error
- set -o pipefail: Return value of a pipeline is the status of the last
command to exit with non-zero status
This prevents silent failures and makes debugging easier by failing fast
when something goes wrong instead of continuing with potentially corrupted
state.
uninstall of add-ons is way too complicated due to dependencies.
the scripts now just list the add-ons that are installed in the
origin database, but not available in the final Odoo docker image.
- only try to uninstall already installed add-ons
- display the final list of add-ons to remove (dependencies included)
- ask final confirmation
- remove useless temporary files
- clean code