Add error suppression on file testing.

This commit is contained in:
awalsh128 2022-11-19 17:40:56 -08:00
parent f076e88841
commit aa86a37b2d
2 changed files with 5 additions and 5 deletions

8
lib.sh
View file

@ -16,8 +16,8 @@ function execute_install_script {
get_install_filepath "${1}" "${package_name}" "${3}") get_install_filepath "${1}" "${package_name}" "${3}")
if test ! -z "${install_script_filepath}"; then if test ! -z "${install_script_filepath}"; then
log "- Executing ${install_script_filepath}..." log "- Executing ${install_script_filepath}..."
# Don't abort on errors; dpkg-trigger will error normally since it is outside # Don't abort on errors; dpkg-trigger will error normally since it is
# its run environment. # outside its run environment.
sudo sh -x ${install_script_filepath} ${4} || true sudo sh -x ${install_script_filepath} ${4} || true
log " done" log " done"
fi fi
@ -90,8 +90,8 @@ function get_package_name_from_cached_filepath {
function get_install_filepath { function get_install_filepath {
# Filename includes arch (e.g. amd64). # Filename includes arch (e.g. amd64).
local filepath="$(\ local filepath="$(\
ls -1 ${1}var/lib/dpkg/info/${2}*.${3} \ ls -1 ${1}var/lib/dpkg/info/${2}*.${3} 2> /dev/null \
| grep -E ${2}'(:.*)?.'${3} | head -1)" | grep -E ${2}'(:.*)?.'${3} | head -1 || true)"
test "${filepath}" && echo "${filepath}" test "${filepath}" && echo "${filepath}"
} }

View file

@ -1,4 +1,4 @@
#!/bin/bash -x #!/bin/bash
# Fail on any error. # Fail on any error.
set -e set -e