@@ -6,17 +6,19 @@ install_source() {
66 # install from source
77 # https://www.darwinsys.com/file/
88 # https://github.com/file/file/blob/FILE5_45/INSTALL#L51
9- version=" file-5.45" &&
10- tmpfile=" $( mktemp) " &&
11- curl -sSLo " ${tmpfile} " " https://astron.com/pub/file/${version} .tar.gz" &&
12- tar xvf " ${tmpfile} " &&
13- cd " ${version} " &&
14- ./configure &&
15- make &&
16- make install &&
17- make installcheck &&
18- cd .. &&
19- rm -r " ${version} "
9+ (
10+ version=" file-5.45" &&
11+ tmpfile=" $( mktemp) " &&
12+ curl -sSLo " ${tmpfile} " " https://astron.com/pub/file/${version} .tar.gz" &&
13+ tar xvf " ${tmpfile} " &&
14+ cd " ${version} " &&
15+ ./configure &&
16+ make &&
17+ make install &&
18+ make installcheck &&
19+ cd .. &&
20+ rm -r " ${version} "
21+ ) || ( cd .. && false )
2022}
2123
2224install_precompiled () {
@@ -37,6 +39,7 @@ install_precompiled() {
3739 else
3840 # windows (no install, just download into current working directory)
3941 # could also consider install using `pacman`: https://packages.msys2.org/base/mingw-w64-file
42+ # which would require an update of copy_libmagic below to account for new magic.mgc paths
4043 python << EOF
4144import platform, sysconfig, io, zipfile, urllib.request
4245assert platform.system() == "Windows"
@@ -56,7 +59,7 @@ copy_libmagic() {
5659 # this python command relies on current working directory containing `./magic/loader.py`
5760 libmagic_path=" $( python -c ' from magic.loader import load_lib; print(load_lib()._name)' ) " &&
5861 cp " ${libmagic_path} " " magic" &&
59- # only on linux: additionally copy compiled db into magic dir (prefer the one installed by install_source)
62+ # only on linux/macos : additionally copy compiled db into magic dir (prefer the one installed by install_source)
6063 ( ( cp " /usr/local/share/misc/magic.mgc" " magic" || cp " /usr/share/misc/magic.mgc" " magic" ) || true ) &&
6164 # check what was copied
6265 ls -ltra magic
0 commit comments