Package: explosive.fuse
IntroductionThis package,explosive.fuse, provides a command-line tool,explode, for mounting of archive files (such as zip) to a directory
usingFUSE, enabling access to individual file entries within the
compressed archives as normal files directly without the typical
intermediate step of decompression to some temporary location, i.e. all
file decompression is done dynamically, on demand.  This library is
constructed with modularity in mind to enable customization, such as how
the file entries within the archives are to be presented at the mounted
location, and that the helper classes and functions within can be reused
elsewhere.Currently, the following archive formats are supported:zip (builtin packagezipfile)rar (require third-party packageunrar)Archive formats that require third-party packages are not enabled by
default.  To enable, please install the packages as specified, and more
information about them can be accessed via the links provided above.InstallationIf all system level dependencies are satisfied, the installation
process is simply a singlepipcall, like so:$ pip install explosive.fuseThis can be done either at the system level (i.e. usingsudo) to
make this available for all users on the system, or inside a virtualenv
for just a single user.System level dependenciesExplosiveFUSE requires the FUSE kernel module for your operating system
and its user space tools be available, and Python 2.7/3.3+/PyPy.First off, install the FUSE kernel module and user space tools if they
are not already installed.LinuxArch Linux:$ sudo pacman -S fuseDebian/Ubuntu:$ sudo apt-get install fuseGentoo (also, please refer to itswiki entry on FUSE):$ sudo emerge --ask sys-fs/fuseRedHat/CentOS/Fedora:$ sudo yum install fuseOS XThis has been somewhat tested through the experimental build features
provided by Travis-CI, with dependencies installed viaHomebrew.
For installation of Homebrew, please refer to instructions outlined athttp://brew.sh/.Once that’s done, the packages forFUSE for OS Xandpyenv(which
provides Python version management) can be installed using the following
commands:$ brew update
$ brew install caskroom/cask/osxfuse
$ brew install pyenv
$ pyenv install 3.5.2  # or your desired version of Python
$ pyenv global 3.5.2
$ pyenv rehashOther installation methodsThis may be installed into the default user specific library directory
(typically~/.local) using the following command:$ pip install --user explosive.fuseThe executable will then be available at~/.local/bin/explode.Or be installed in a virtualenv, too:$ virtualenv ~/.venv
$ source ~/.venv/bin/activate
$ pip install explosive.fuseNaturally, installation from source can be done, and providedgitis
installed, the latest development version can be done like so:$ pip install git+https://github.com/metatoaster/explosive.fuse#egg=explosive.fuseAlternatively, manual usage ofgitandpython setup.py developwill work also.UsageSimply invokingexplodefrom the shell this help message will be
presented:usage: explode [-h] [-l <strategy>] [--layout-info] [-d] [-f] [-m]
               [--manager-dir [MANAGER_DIR]] [--overwrite] [--omit-arcname]
               [-V]
               dir archives [archives ...]In the most simple form the command can simply be invoked like so:$ mkdir /tmp/mnt
$ explode /tmp/mnt demo1.zipThis will mount the contents ofdemo1.zipto/tmp/mnt.  To
verify that this worked, a simplelscan be used:$ ls -l /tmp/mnt/
total 0
-r--r--r-- 1 user user 33 Oct 26 23:19 file1
-r--r--r-- 1 user user 33 Oct 26 23:19 file2
-r--r--r-- 1 user user 33 Oct 26 23:19 file3
-r--r--r-- 1 user user 33 Oct 26 23:19 file4
-r--r--r-- 1 user user 33 Oct 26 23:19 file5
-r--r--r-- 1 user user 33 Oct 26 23:19 file6Files are presented as being owned by the user that created this mount
point.  For specifics on access permissions, please consult the fuse
user manual (i.e.man fuse).To unmount, simply call:$ fusermount -u /tmp/mnt/Or terminate the process if it was ran in the foreground.It is possible to explode multiple archives onto the target directory:$ explode /tmp/mnt demo1.zip demo2.zipBy default, a new layout strategy will be used, which will include the
name of the source archive file.  This can be verified:$ ls -l /tmp/mnt/
total 0
dr-xr-xr-x 2 user user 0 Oct 26 23:22 demo1.zip
dr-xr-xr-x 2 user user 0 Oct 26 23:22 demo2.zipLayout StrategiesThe way the file entries are laid out in the resulting filesystem can be
modified by the use of a layout strategy.  This is specified using the-lor the--layoutflag.  Naturally, the final result is also
influenced by the usage of the--overwriteand the--omit-arcnameflags and the arguments associated with each of the
strategies (which are specified by appending:, followed by the
value of each positional argument(s)).  Detailed information on every
available strategies are available by callingexplode--layout-info,
but for completeness sake the following strategies are provided by a
default installation:codepageDecode the filename entries into unicode from the specified
codepage.  Example:-lcodepage:shift_jiswill decode filenames
that look likeé▒é±é╔é┐é═intoこんにちは.defaultPresent file entries as they were within their respective directory
structures to the root of its source archive.flattenFlattens the directory structure to the root of the mount point by
replacing all path separators for each file entries with the_character by default. This character can be specified by using the
argument syntax (e.g. use-lflatten:-will replace all path
separators with the-character.)junkJunk paths, keep only directories counting from root up to the level
specified for a positive keep number, otherwise junking all but the
absolute number of keep levels previous to the basename of the
filename for a negative keep number. Default is to keep no
directories. Useful value is1if it is desirable to keep the
source archive name as a container directory (i.e.-ljunk:1) if--omit-arcnameis not used.An important note: by default, the basename of the archive file will be
prepended to each of its file entries before being filtered through the
layout strategy, unless the--omit-arcnameflag is used.Flags for fine-tuning filesystem behavior--debugPrint debug messages to stdout.--foregroundRun in foreground.-m,--managerEnable the symlink manager directory.  This option exposes all the
archive files under the management directory (defined by the--manager-dirflag, default is.managerunder the root of
the mount point) as symlinks.  Creating symlinks to valid archive
files will add the file entries in them to the filesystem, and
removing the symlinks will remove its associated entries from the
filesystem.--omit-arcnameSometimes it may be desirable to omit the name of the source archive
files from the generated paths.For example, if we have multiple archive files with namesSNS_001.zipup toSNS_100.zip, and inside there we simply
have files like01.jpgup to20.jpglying at the root level,
activating the--omit-arcnameflag flag will result in only 20
files fromSNS_001.ziparchive being accessible as by default as
that was the first file specified to be loaded.-s,--splitext-arcnameSometimes it may be desirable to split the filename extenxion out of
the name of the source archive files from the generated paths.--overwriteUseful when there are multiple file entries of the same name from
multiple archives and only the latest one is desired, this flag will
“overwrite” any existing entries the mapping process may encounter.TroubleshootingError messagesMounting shows the following error message:fusermount: failed to open /etc/fuse.conf: Permission deniedThis can be safely ignored, or alternatively have your system’s
administrator grant you read access to that file by putting your account
into thefuseuser group or equivalent on your system, or change the
permission to that file to world readable, as that file does not contain
any sensitive information under typical usage.Other issuesIf you encountered any other problems using this software please file an
issue using theissue trackerfor this project.LicenseThis work is licensed underGNU Generic Public License, version 3.Changelog0.5 (2018-07-13)Support for dropping of the file name extension (mostly to improve the
presentation of filename sorting for certain file managers); may be
toggled through the-sor--splitext-arcnameflag.Be able to extract zip files that do not have a.zipfile name
extension, as this is now the default fallback to better support the
exploding of common file formats that make use ofzip, e.g.odtordocx.0.4 (2016-08-20)RAR archive format support added using the packageunrar.0.3 (2015-12-12)Mappings now use absolute path to ensure this works in daemon mode.New layout strategy: codepage can be used to remap non-unicode name
encodings to unicode.File ownership now shown as being owned by the user that started the
mount process.Symlink management support added; this is enabled using the-mflag, optionally with--manager-dirto explicitly change where
that lies.  This allows loading and unloading of files via the adding
and removing of symlinks in the management directory.Decreased memory consumption and performance from reads as inflate
is called only on demand.  This however requires single-thread mode
for the mean time.0.2 (2015-10-31)Removed specialized archive layout strategies (i.e. the zip* ones)By default, basename of archive will be prepended to the path for each
file entries.  This behavior can directly be disabled using the--omit-arcnameflag.  (Naturally, a layout strategy can still
modify that path, likejunk.All pathmaker callables are now actually factories that produce the
actual pathmaker.  They can now take arguments to influence how the
produced pathmaker behaves.  The arguments can be entered using the
extended-lor--layoutsyntax.  Details documented in--layout-info.Implemented the--overwriteflag, allowing newer entries to
“overwrite” existing ones.A number of other internal API changes.0.1 (2015-10-26)Initial release with just basic zip file support.File extraction is naive, such that the entire contents of a single
given file entry will be extracted to memory per read.