diff --git a/Annex/FileMatcher.hs b/Annex/FileMatcher.hs index 5167a5e025..fa46e64b1d 100644 --- a/Annex/FileMatcher.hs +++ b/Annex/FileMatcher.hs @@ -33,6 +33,7 @@ import Git.CheckAttr (unspecifiedAttr) #ifdef WITH_MAGICMIME import Magic +import Utility.Env #endif import Data.Either @@ -131,7 +132,12 @@ mkLargeFilesParser = do #ifdef WITH_MAGICMIME magicmime <- liftIO $ catchMaybeIO $ do m <- magicOpen [MagicMimeType] - liftIO $ magicLoadDefault m + liftIO $ do + md <- getEnv "GIT_ANNEX_DIR" + case md of + Nothing -> magicLoadDefault m + Just d -> magicLoad m + (d "magic" "magic.mgc") return m #endif let parse = parseToken $ commonTokens diff --git a/Makefile b/Makefile index d8894966f3..cdf443632a 100644 --- a/Makefile +++ b/Makefile @@ -147,6 +147,8 @@ linuxstandalone-nobuild: Build/Standalone Build/LinuxMkLibs install -d "$(LINUXSTANDALONE_DEST)/git-core" (cd "$(shell git --exec-path)" && tar c .) | (cd "$(LINUXSTANDALONE_DEST)"/git-core && tar x) install -d "$(LINUXSTANDALONE_DEST)/templates" + install -d "$(LINUXSTANDALONE_DEST)/magic" + cp /usr/share/file/magic.mgc "$(LINUXSTANDALONE_DEST)/magic" ./Build/LinuxMkLibs "$(LINUXSTANDALONE_DEST)" @@ -199,6 +201,12 @@ osxapp: Build/Standalone Build/OSXMkLibs (cd "$(shell git --exec-path)" && tar c .) | (cd "$(OSXAPP_BASE)" && tar x) install -d "$(OSXAPP_BASE)/templates" + install -d "$(OSXAPP_BASE)/magic" + if [ -e "$(OSX_MAGIC_FILE)" ]; then \ + cp "$(OSX_MAGIC_FILE)" "$(OSXAPP_BASE)/magic/magic.mgc"; \ + else \ + echo "** OSX_MAGIC_FILE not set; not including it" >&2; \ + endif # OSX looks in man dir nearby the bin $(MAKE) install-mans DESTDIR="$(OSXAPP_BASE)/.." SHAREDIR="" PREFIX="" diff --git a/debian/changelog b/debian/changelog index 0184c13fff..f59df474fc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,7 @@ git-annex (6.20160218) UNRELEASED; urgency=medium so any system gpg will be preferred over it. * Avoid crashing when built with MagicMime support, but when the magic database cannot be loaded. + * Include magic database in the linux and OSX standalone builds. -- Joey Hess Thu, 18 Feb 2016 13:09:21 -0400 diff --git a/standalone/licences.gz b/standalone/licences.gz index e85b038fb0..b126f88c0e 100644 Binary files a/standalone/licences.gz and b/standalone/licences.gz differ diff --git a/standalone/osx/git-annex.app/Contents/MacOS/runshell b/standalone/osx/git-annex.app/Contents/MacOS/runshell index 56fc77f38f..17c95698c7 100755 --- a/standalone/osx/git-annex.app/Contents/MacOS/runshell +++ b/standalone/osx/git-annex.app/Contents/MacOS/runshell @@ -77,7 +77,11 @@ export ORIG_GIT_TEMPLATE_DIR GIT_TEMPLATE_DIR="$bundle/templates" export GIT_TEMPLATE_DIR -# Indicate which variables were exported above. +GIT_ANNEX_DIR="$bundle" +export GIT_ANNEX_DIR + +# Indicate which variables were exported above and should be cleaned +# when running non-bundled programs. GIT_ANNEX_STANDLONE_ENV="PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR" export GIT_ANNEX_STANDLONE_ENV