From da5b330991996004ff963b07610d8141edc50c02 Mon Sep 17 00:00:00 2001 From: ddelange <14880945+ddelange@users.noreply.github.com> Date: Wed, 29 May 2024 00:04:14 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Frank Dana --- add_libmagic.sh | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/add_libmagic.sh b/add_libmagic.sh index af447b3..7b6038f 100755 --- a/add_libmagic.sh +++ b/add_libmagic.sh @@ -6,19 +6,17 @@ install_source() { # install from source # https://www.darwinsys.com/file/ # https://github.com/file/file/blob/FILE5_45/INSTALL#L51 - version="file-5.45" - ( - tmpfile="$(mktemp)" && - curl -sSLo "${tmpfile}" "https://astron.com/pub/file/${version}.tar.gz" && - tar xvf "${tmpfile}" && - cd "${version}" && - ./configure && - make && - make install && - make installcheck && - cd .. && - rm -r "${version}" - ) || (cd .. && rm -r "${version}" && false) + version="file-5.45" && + tmpfile="$(mktemp)" && + curl -sSLo "${tmpfile}" "https://astron.com/pub/file/${version}.tar.gz" && + tar xvf "${tmpfile}" && + cd "${version}" && + ./configure && + make && + make install && + make installcheck && + cd .. && + rm -r "${version}" } install_precompiled() { @@ -34,8 +32,8 @@ install_precompiled() { apt-get install -y libmagic1 elif [ -n "$(which apk)" ]; then apk add --update libmagic - elif [ -n "$(which yum)" ]; then - yum install file-libs + elif [ -n "$(which dnf)" ]; then + dnf --setopt install_weak_deps=false -y install file-libs else # windows (no install, just download into current working directory) # could also consider install using `pacman`: https://packages.msys2.org/base/mingw-w64-file