Closed tdltdl closed 6 months ago
Hi @tdltdl Excellent PR. Thanks a lot for your time to improve the script.
I just have concern in pkg_install api as we like to terminate the installation if any of the dependent package failed to install so for now i have merged your PR and reverted pkg_install function so we can test it locally asap.
just have concern in pkg_install api as we like to terminate the installation if any of the dependent package failed to install so for now i have merged your PR and reverted pkg_install function so we can test it locally asap.
As indicated when using apt install, if any dependency fails to install the exit code will be non-zero and this will be catched by the set -e at the beginning of the bash script. So this is not an issue. You can try is by adding a non-existing package tot he list of packages and see that the script stops. You can test is with this script (run as root):
#!/bin/bash
set -e
echo "I should be the last line you see."
apt install XxxxXxxx
echo "you should not see me."
Of course with this PR merged, you'll also have the last command, return code and so on generate but this is because of the trap error
Improved the script by