-
Notifications
You must be signed in to change notification settings - Fork 8
Arcmc
arcmc is a panel plugin for browsing, creating, testing and extracting
archives. It uses libarchive for the formats libarchive understands and can
delegate other formats to command-line programs through extfs helpers.
- Press
Ctrl+PgDnon an archive to open it in an arcmc panel. - Press
Enteron the common built-in archive formats. TheirOpenassociations are supplied by the systemmagic.ini. - Press
F3on a common archive to view its catalogue as text. - Inside an arcmc panel, use
Enterto descend into directories or nested archives. A regular non-archive file is sent to the viewer. - Standard panel copy and delete operations work inside the archive when the selected backend supports them.
- The plugin menu contains Open archive, Create archive, Extract archive(s), Test archive(s) and Archiver settings.
-
Shift+F1creates an archive from the current or tagged entries by default. The key is configurable.
Long operations show progress, throughput and estimated time and can be
cancelled. Extraction rejects absolute paths and .. path components, so an
archive entry cannot escape the selected destination.
sequenceDiagram
actor User
participant Panel as File panel
participant Magic as magic.ini
participant Plugins as Plugin registry
participant Arcmc as arcmc
User->>Panel: Enter or Ctrl+PgDn
alt Enter
Panel->>Magic: Find Open rule
Magic-->>Panel: arcmc:open
else Ctrl+PgDn
Panel->>Magic: Find explicit rule
alt arcmc rule exists
Magic-->>Panel: arcmc:open
else No rule
Panel->>Plugins: Try Open operations by filename
Plugins-->>Panel: arcmc:open
end
end
Panel->>Arcmc: Open file or stream
alt Archive accepted
Arcmc-->>Panel: Activate archive panel
else Not an archive
Arcmc-->>Panel: Not supported
end
Ctrl+PgDn can therefore use a suffix added to arcmc.ini at runtime; adding
another format does not require rebuilding mc or generating a system
magic.ini rule. Enter remains controlled by magic.ini, so adding a custom
suffix does not unexpectedly change the normal Enter action.
libarchive handles ZIP, 7z, TAR variants and CPIO for reading and writing. It also reads formats such as ISO, XAR and CAB. ZIP aliases include JAR, WAR and EAR. The exact availability depends on the libarchive build.
The external registry includes defaults for RAR, ARJ, ACE, ARC, ALZ, ZOO, HA,
WIM, LHA/LZH, DEB, RPM and Inno Setup installers. These entries describe
external programs and helpers; the corresponding tools still have to be
installed. The Archiver settings dialog shows built-in and external
formats, lets you enable or disable them, selects built-in/external backends
where both exist, and marks a missing tool with !.
The plugin stores its settings in the Midnight Commander user configuration directory, normally:
${XDG_CONFIG_HOME:-$HOME/.config}/mc6/arcmc.ini
The user magic.ini, when needed, is in the same directory. The two files
have different jobs:
-
arcmc.inidefines archive formats, programs, helper names and enabled state. -
magic.inichooses which action invokes a handler for Enter, F3 or an explicit Ctrl+PgDn association.
Restart mc after editing arcmc.ini; the external registry is loaded when the
plugin is registered.
The create-archive shortcut is stored separately from format definitions:
[arcmc]
hotkey_create=shift-f1Use none to disable the shortcut.
The following example registers .foo:
[arcmc-ext]
FOO=true
[arcmc-ext-params-FOO]
extension=.foo
pack_bin=foo-archive
pack_args=create
unpack_bin=foo-archive
unpack_args=extract
test_bin=foo-archive
test_args=test
extfs_helper=ufoo
list_file_arg=@%sFOO is an arbitrary case-insensitive name. Unknown formats must define
extension; the leading dot is optional. Names cannot contain =, [ or
], control characters, or leading/trailing whitespace. mc writes names back
in canonical uppercase form.
Suffix matching is case-insensitive. If suffixes overlap, the longest suffix
wins. A missing key in [arcmc-ext] means enabled. An enabled suffix is
offered to Ctrl+PgDn only when at least one configured binary is in PATH; an
entry that names only an extfs helper is accepted as helper-only.
| Key | Purpose |
|---|---|
extension |
Filename suffix. ext is accepted as a compatibility alias. |
pack_bin |
Program used to create or update an archive. |
pack_args |
Arguments after pack_bin and before the archive name. |
unpack_bin |
Program used for bulk or selective extraction. |
unpack_args |
Arguments after unpack_bin and before the archive name. |
test_bin |
Program used by Test archive(s). |
test_args |
Arguments after test_bin and before the archive name. |
extfs_helper |
Helper used to list the archive and access individual entries. |
list_file_arg |
printf-style file-list argument, for example @%s, used when a command would exceed 128 KiB. |
Missing command keys disable the corresponding operation. An empty value
clears a built-in default. The *_args values are trusted shell command
fragments, not argument arrays or placeholder templates. Commands are formed
as follows:
pack_bin pack_args archive files...
unpack_bin unpack_args archive [destination]
test_bin test_args archive
For selective extraction, arcmc changes to the destination directory and runs
unpack_bin unpack_args archive files....
The helpers shipped in
src/vfs/extfs/helpers/
implement the extfs command protocol. arcmc reuses this protocol as an adapter
for external archivers. It executes the helper directly and does not open
or mount an extfs VFS path such as archive/uzip://.
flowchart LR
A[arcmc panel] -->|list| B[extfs helper]
A -->|view or copy| C[copyout]
A -->|add| D[copyin]
A -->|delete| E[rm]
B --> F[External archive tool]
C --> F
D --> F
E --> F
For extfs_helper=ufoo, arcmc searches for an executable ufoo in this
order:
${XDG_DATA_HOME:-$HOME/.local/share}/mc6/extfs.d/- the system
extfs.ddirectory below mc's configured library-executable directory, commonly/usr/libexec/mc/extfs.d/
The helper interface used by arcmc is:
ufoo list archive.foo
ufoo copyout archive.foo path/inside/archive destination
ufoo copyin archive.foo path/inside/archive source
ufoo rm archive.foo path/inside/archive
list is required for browsing a format libarchive cannot read, and its
output must use the modified ls -l format from the
extfs helper documentation.
copyout is required to view or copy files. copyin and rm are optional and
enable adding and deleting entries.
Install a user helper as an executable file:
install -Dm755 ufoo "${XDG_DATA_HOME:-$HOME/.local/share}/mc6/extfs.d/ufoo"An external helper needs a local filesystem path for the archive. It cannot browse an archive supplied only as a non-local stream by another panel plugin. If the source plugin can provide a local copy, arcmc can use that copy.
No magic.ini rule is required for Ctrl+PgDn. To make Enter open .foo with
arcmc too, add this user rule:
[arcmc.foo]
Regex=\\.foo$
RegexIgnoreCase=true
Open=%plugin{arcmc:open}Keep the rule out if Enter should continue using the viewer or another handler.
Inno Setup support is registered by default and is equivalent to:
[arcmc-ext]
INO=true
[arcmc-ext-params-INO]
extension=.exe
test_bin=innoextract
test_args=--test --silent
extfs_helper=uinnoThe installed uinno helper uses innoextract for list and copyout, so
innoextract must be available in PATH. Stand on an installer and press
Ctrl+PgDn. A non-Inno .exe is rejected quietly and remains a normal file;
Enter is not reassigned for .exe.
- Confirm that the arcmc panel plugin is enabled and restart mc after changing
arcmc.ini. - Check external binaries with
command -v program-name. - Check that a user helper is executable and in the correct
extfs.ddirectory. - Run
ufoo list archive.fooin a shell. A nonzero exit status or malformed listing means arcmc cannot build the panel. - Use
Ctrl+PgDnfor a runtime-added suffix. Enter needs the separatemagic.inirule shown above. - If browsing works but adding or deleting does not, the helper probably lacks
copyinorrm; those commands are optional.