All Projects → neutralinsomniac → obsdpkgup

neutralinsomniac / obsdpkgup

Licence: MIT license
Very simple (and *fast*) tool to check for OpenBSD package updates

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects

Labels

Projects that are alternatives of or similar to obsdpkgup

Mg
Micro (GNU) Emacs-like text editor ❤️ public-domain
Stars: ✭ 117 (+680%)
Mutual labels:  openbsd
Objfw
[Official Mirror] A portable framework for the Objective-C language.
Stars: ✭ 161 (+973.33%)
Mutual labels:  openbsd
Awesome Bsd
A collection of awesome BSD related stuff
Stars: ✭ 236 (+1473.33%)
Mutual labels:  openbsd
Glaucus
An independent Linux® distribution built from scratch
Stars: ✭ 130 (+766.67%)
Mutual labels:  openbsd
Src
Public git conversion mirror of OpenBSD's official CVS src repository. Pull requests not accepted - send diffs to the tech@ mailing list.
Stars: ✭ 2,213 (+14653.33%)
Mutual labels:  openbsd
Punes
Nintendo Entertaiment System emulator and NSF/NSFe Music Player (Linux, FreeBSD, OpenBSD and Windows)
Stars: ✭ 217 (+1346.67%)
Mutual labels:  openbsd
Libtuntap
The portable Tun/Tap devices configuration utility
Stars: ✭ 107 (+613.33%)
Mutual labels:  openbsd
cloud-agent
cloud-agent for OpenBSD 🕵️‍♀️
Stars: ✭ 43 (+186.67%)
Mutual labels:  openbsd
Durden
Desktop Environment for Arcan
Stars: ✭ 158 (+953.33%)
Mutual labels:  openbsd
Awesome Openbsd
A curated list of awesome OpenBSD resources
Stars: ✭ 228 (+1420%)
Mutual labels:  openbsd
Battstat
🔋 CLI battery status indicator for macOS, Linux, and OpenBSD ⚡
Stars: ✭ 132 (+780%)
Mutual labels:  openbsd
Aws Openbsd
AWS OpenBSD image builder (AMI) and cloud-init replacement
Stars: ✭ 144 (+860%)
Mutual labels:  openbsd
Openbsd Wip
OpenBSD work in progress ports
Stars: ✭ 220 (+1366.67%)
Mutual labels:  openbsd
Signify
OpenBSD tool to signs and verify signatures on files. Portable version.
Stars: ✭ 122 (+713.33%)
Mutual labels:  openbsd
Poetic-License
Limerick Open License in the spirit of OpenBSD, ISC, BSD0, and MIT Licenses
Stars: ✭ 36 (+140%)
Mutual labels:  openbsd
Fisy Fuzz
This is the full file system fuzzing framework that I presented at the Hack in the Box 2020 Lockdown Edition conference in April.
Stars: ✭ 110 (+633.33%)
Mutual labels:  openbsd
Purritobin
ultra fast, minimalistic, encrypted command line paste-bin
Stars: ✭ 171 (+1040%)
Mutual labels:  openbsd
bf256
Brainfuck compiler under 256 bytes in size.
Stars: ✭ 21 (+40%)
Mutual labels:  openbsd
httpd-plus
Add-ons for the OpenBSD web server
Stars: ✭ 32 (+113.33%)
Mutual labels:  openbsd
Gnb
GNB is open source de-centralized VPN to achieve layer3 network via p2p with the ultimate capability of NAT Traversal.GNB是一个开源的去中心化的具有极致内网穿透能力的通过P2P进行三层网络交换的VPN。
Stars: ✭ 225 (+1400%)
Mutual labels:  openbsd

obsdpkgup

x1$ time obsdpkgup
up to date
    0m01.69s real     0m00.51s user     0m00.25s system

Pre-requisites

  • Go: pkg_add go

Installation

go install github.com/neutralinsomniac/obsdpkgup/cmd/obsdpkgup@latest

Usage

Check for upgrades using signatures:

(see The Same-Version Rebuild Problem):

PKGUP_URL=https://pintobyte.com/pkgup/ obsdpkgup

Force checking snapshot directory for upgrades:

obsdpkgup -s

Run and apply found package upgrades:

obsdpkgup |doas sh

Cron mode (don't output anything when packages are up-to-date):

obsdpkgup -c

Rationale

OpenBSD's package tools are great. They've been battle-tested and designed to correctly handle package installation/upgrades even in the face of uncertain mirror conditions. They suffer from one problem however: with no central package index, in order to calculate an upgrade, the signature of every installed package must be checked against its signature on the configured mirror. This process can take anywhere from 1 to over 30 minutes to complete and uses a non-trivial amount of bandwidth, even if no updates are actually available. A simple solution to this would be to run package upgrades overnight through cron or some other mechanism, but not all OpenBSD machines are always-on computers, laptops being the prime example of this.

obsdpkgup attempts to solve the slow pkg_add -u dilemma while maintaining the consistency safeguards built into the pkgtools.

Theory of Operation

The lack of a central-index in the packaging system is an intentional decision. When an upgrade is requested while a mirror is in a partially-synced state, any central index may inevitably be out-of-sync with the state of the files present. If this index is solely relied on as a source of truth, then Bad Things can happen when an upgrade is attempted.

Because a central index may not accurately reflect the current state of a mirror, obsdpkgup uses its own index to seed a pkg_add -u call with a subset of packages it thinks have upgrades (with version numbers removed, to allow for flexibility in the mirror state). This prevents pkg_add from having to check every installed package individually, and instead enables it to check a much smaller list of potential upgrade candidates. This way, pkg_add will either do what it would've done with a full pkg_add -u call anyway (but with a much smaller list of packages to check), or in the case of a de-synced index, maybe report that a subset of the package candidate(s) are up-to-date, which will have no adverse effect on the system.

The Same-Version Rebuild Problem

Or, why can't we just compare version numbers in the mirror index?

Currently, the only index-like file available for obsdpkgup to check is a mirror's index.txt file. This file contains the external-facing version numbers of the packages available on the mirror, but does not reveal the internal openbsd-specific version that can be incremented in certain situations. When packages are rebuilt, and their external-facing versions aren't incremented, obsdpkgup can't tell that an upgrade occurred. Thus, a new index file format was created that contains a hash of a package's "signature" (the same thing that the pkgtools themselves check) and stores it in a secondary index file (called index.pkgup.gz). This file can be easily generated in an existing mirror directory with the generate_pkgup_from_current_dir.sh script, or generated externally to a mirror with the generate_pkgup_from_mirror.sh script.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].