Several installation script errors
The use case is that I want to install docker-compose v2 and then install compose-switch to translate docker-compose v1 commands from an older project.
But on my brand-new Ubuntu 20.04 server, docker-compose v1 is not installed. This causes a problem when using the install script to install compose-switch.
The following line:
https://github.com/docker/compose-switch/blob/2fe0b713c6839e86239e4930b98fe94f3c68f4e2/install_on_linux.sh#L21
will cause a return code of 127 on $? (as docker-compose doesn't exist), which stops the entire script in its tracks due to the set -e on line 3:
https://github.com/docker/compose-switch/blob/2fe0b713c6839e86239e4930b98fe94f3c68f4e2/install_on_linux.sh#L3
If I comment out the set -e then the script can proceed further. But then we encounter another error on line 34:
https://github.com/docker/compose-switch/blob/2fe0b713c6839e86239e4930b98fe94f3c68f4e2/install_on_linux.sh#L34
as the backticks cause the shell to try to execute docker-compose, which doesn't exist.
If I turn the backticks into normal single quotes ' then the script can proceed further and finishes the installation.
The backticks seem like a straightforward fix but I'm not sure what the intention is behind the set -e was -- if anyone could explain that I'd be happy to make a pull request to fix these issues.
OK, it looks like someone else already reported the problem for line 21 and made a PR:
https://github.com/docker/compose-switch/pull/31
I've also made a PR to fix the problem on line 34:
https://github.com/docker/compose-switch/pull/34
Please merge in these PRs and this issue will be solved.
@ndeloof Would you mind taking a look?
Thanks!
PR https://github.com/docker/compose-switch/pull/31 has been merged, and PR https://github.com/docker/compose-switch/pull/34 is no longer relevant, so this issue can now be closed.