Skip to content
MidnightBSDPublic

About

MidnightBSD Package Manager

Resources

Security policy

Stars

7 stars

Watchers

2 watching

Forks

Repository files navigation

mport

MidnightBSD Package Manager

Requirements

Recent versions will run on MidnightBSD 3.0 and higher.

Depends on:

  • sqlite3
  • libarchive
  • bzip2
  • lzma
  • ucl

Depends on included libs: external/tllist

Versions prior to 2.1.0 also depended on

  • libdispatch
  • Blocksruntime

Backward compatibility

The last version that works with MidnightBSD 1.2.8 or lower is mport 2.1.4. (lack of libucl)

There was a breaking change in 2.1.6 in libmport with respect to mport_install and mport_install_primative use.

There was a breaking change in 2.6.0 in libmport which changed the mport_init function to use mportVerbosity rather than a boolean for quiet mode.

mportVerbosity has three values currently: MPORT_VQUIET, MPORT_VNORMAL, MPORT_VVERBOSE

There's also the new mport_verbosity function which translates quiet and verbose flags into the right value.

The last version that works with MidnightBSD 2.x is mport 2.6.5.

Using mport

In addition to the man page, you can also look at the BSD Magazine article on mport in the Feb 2012 issue. https://ia902902.us.archive.org/6/items/bsdmagazine/BSD_02_2012.pdf

Quick and Dirty

Installing a package named xorg:

mport install xorg

Deleting the xorg meta-package:

mport delete xorg

Fetching the latest index

mport index

Upgrading all packages

mport upgrade

Update a specific package (and its dependencies)

mport update xorg

Installing from package file

For example, installing a vim package that is already built locally

/usr/libexec/mport.install /usr/mports/Packages/amd64/All/vim-8.2.3394.mport

Getting info on an installed package

mport info gmake

gmake-4.3_2
Name            : gmake
Version         : 4.3_2
Latest          : 4.3_2
Licenses        : gpl3
Origin          : devel/gmake
Flavor          : 
OS              : 3.0
CPE             : cpe:2.3:a:gnu:make:4.3:::::midnightbsd3:x64:2
PURL            : pkg:mport/midnightbsd/gmake@4.3_2?arch=amd64&osrel=3.0
Locked          : no
Prime           : yes
Provides shlibs : no
Deprecated      : no
Expiration Date : 
Install Date    : Tue Mar 28 17:51:14 2023
Comment         : GNU version of 'make' utility
Options         : 
Type            : Application
Description     :

Security-related commands

mport audit Displays vulnerable packages based on their CPE identifiers using the NVD data provided by https://sec.midnightbsd.org

mport audit -r Prints out vulnerable packages and a list of packages depending on that one.

mport -q audit Prints out vulnerable package name and version with no descriptions or details

mport cpe Lists all CPE info on installed packages

mport verify Runs a checksum on all installed files from packages against data from time of installation to see if files have been modified.

Triggers

Triggers let a package rebuild a shared cache (icon caches, MIME databases, GLib schemas and so on) whenever any package adds or removes files under a directory it cares about. The file format is that of FreeBSD's pkg-triggers(5): a UCL file with path, path_glob and/or path_regexp patterns, a trigger block holding a Lua script, and an optional cleanup block run when the trigger file itself is removed.

path: "/usr/local/share/glib-2.0/schemas"
cleanup: {
	type: lua
	sandbox: false
	script: <<EOS
os.remove("/usr/local/share/glib-2.0/schemas/gschemas.compiled")
EOS
}
trigger: {
	type: lua
	sandbox: false
	script: <<EOS
print("Compiling glib schemas")
pkg.exec({"/usr/local/bin/glib-compile-schemas", "/usr/local/share/glib-2.0/schemas"})
EOS
}

Trigger files are read from the directories named by the triggers_dir setting, by default /usr/share/mport/triggers and /usr/local/share/pkg/triggers (where USES=trigger ports install theirs). A file placed directly in one of those directories is a per-transaction trigger: it runs once at the end of an mport run, after every install, update, upgrade or delete, with the matched directories in the Lua arg table. A file placed in a pre_install, post_install, pre_deinstall or post_deinstall subdirectory is a per-package trigger: it is matched against that package's own files and directories and runs at that phase with the pkg_name, pkg_version and pkg_upgrade globals set; its failure is reported but does not fail the package.

Scripts run in a capsicum sandbox unless the block sets sandbox: false, which is required to use pkg.exec. Triggers can be turned off with mport config set triggers_enable no and the search path changed with mport config set triggers_dir "<dir> <dir>".

Known Bugs

Old versions of mport had a bug that would prevent it working over a serial connection such as during a bhyve installation. A workaround is to ssh into the box to do installs. This is known to impact MidnightBSD 1.2.x and lower. It was fixed.

About

MidnightBSD Package Manager

Resources

Security policy

Stars

7 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages