1*a02f7094Stb.\" $OpenBSD: pkg_add.1,v 1.168 2024/10/02 09:14:08 tb Exp $ 2a9987ed9Sespie.\" 31144937fSespie.\" Documentation and design originally from FreeBSD. All the code has 41144937fSespie.\" been rewritten since. We keep the documentation's notice: 5a9987ed9Sespie.\" 6a9987ed9Sespie.\" Redistribution and use in source and binary forms, with or without 7a9987ed9Sespie.\" modification, are permitted provided that the following conditions 8a9987ed9Sespie.\" are met: 9a9987ed9Sespie.\" 1. Redistributions of source code must retain the above copyright 10a9987ed9Sespie.\" notice, this list of conditions and the following disclaimer. 11a9987ed9Sespie.\" 2. Redistributions in binary form must reproduce the above copyright 12a9987ed9Sespie.\" notice, this list of conditions and the following disclaimer in the 13a9987ed9Sespie.\" documentation and/or other materials provided with the distribution. 14a9987ed9Sespie.\" 15a9987ed9Sespie.\" Jordan K. Hubbard 16a9987ed9Sespie.\" 17a9987ed9Sespie.\" 18*a02f7094Stb.Dd $Mdocdate: October 2 2024 $ 19a9987ed9Sespie.Dt PKG_ADD 1 20a9987ed9Sespie.Os 21a9987ed9Sespie.Sh NAME 22a9987ed9Sespie.Nm pkg_add 23ad944985Sespie.Nd install or update software packages 24a9987ed9Sespie.Sh SYNOPSIS 25a9987ed9Sespie.Nm pkg_add 262468670bSjmc.Bk -words 27e57394d3Sespie.Op Fl acIimnqrsUuVvxz 28a56049e0Sespie.Op Fl A Ar arch 2957ec6696Sespie.Op Fl B Ar pkg-destdir 30321b69d2Sschwarze.Op Fl D Ar name Ns Op = Ns Ar value 31e95d9ee4Sespie.Op Fl L Ar localbase 3289296dccSjmc.Op Fl l Ar file 33a56049e0Sespie.Op Fl P Ar type 34e5e86501Sespie.Op Ar pkg-name ... 352468670bSjmc.Ek 36a9987ed9Sespie.Sh DESCRIPTION 37a9987ed9SespieThe 38a9987ed9Sespie.Nm 39f76cbc48Sespiecommand is used to install or update 40f76cbc48Sespie.Xr packages 7 41f76cbc48Sespiecreated from the 4288b728deSespie.Xr ports 7 4388b728deSespietree. 44a9987ed9Sespie.Bd -filled -offset indent 45a9987ed9Sespie.Em Note : 46f76cbc48SespieSystem distribution files, e.g., base71.tgz, comp71.tgz, are 47a9987ed9Sespie.Em not 48a9987ed9Sespiepackages and may not be installed using 4929b4d7a9Sjmc.Nm . 50a9987ed9Sespie.Ed 51a9987ed9Sespie.Pp 5288b728deSespieBy default, 5380a407d2Sespie.Nm 5488b728deSespierejects unsigned packages unless they come from a trusted source 5580a407d2Sespie.Po 5688b728deSespie.Ev TRUSTED_PKG_PATH 5780a407d2Sespie.Pc 5888b728deSespieor option 59bd3a5667Sbentley.Fl D Cm unsigned 6088b728deSespieis used. 6180a407d2Sespie.Pp 62f76cbc48SespieIf a package is signed: 6388b728deSespie.Bl -bullet 6488b728deSespie.It 6588b728deSespie.Nm 6688b728deSespiechecks that its signature is valid and that the signature was 6788b728deSespieemitted by a valid signing key, as stored in 6888b728deSespie.Pa /etc/signify/*-pkg.pub , 6988b728deSespie.It 7088b728deSespie.Nm 7188b728deSespieverifies that the compressed package data matches the signature, before 72f76cbc48Sespieit decompresses and unpacks files 73f76cbc48Sespie.Po 74f76cbc48Sespiesee 75f76cbc48Sespie.Xr signify 1 76f76cbc48Sespiein 77f76cbc48Sespie.Fl z 78f76cbc48Sespiemode 79f76cbc48Sespie.Pc . 8088b728deSespie.El 8136f1943bSespie.Pp 82de512720Sespie.Nm 8388b728deSespiecan be used to 8488b728deSespie.Bl -bullet 8588b728deSespie.It 8688b728deSespieInstall new packages. 8788b728deSespieThis is the normal mode. 8888b728deSespieThe 8988b728deSespie.Ar pkg-name ... 9088b728deSespiespecified on the command line are new package names to install. 9188b728deSespie.It 9288b728deSespieUpdate installed packages, using option 9388b728deSespie.Fl u . 9488b728deSespieOptional 9588b728deSespie.Ar pkg-name ... 9688b728deSespiemay be specified on the command line, as names of packages already installed 9788b728deSespieon the machine, to be updated to new versions along with their dependencies. 9888b728deSespieIf no name is specified, all the packages will be updated. 9988b728deSespie.It 10088b728deSespieInstall new packages in a hurry, updating their dependencies first, 10188b728deSespieusing option 10288b728deSespie.Fl U . 10388b728deSespieThe 10488b728deSespie.Ar pkg-name ... 10588b728deSespiespecified on the command line are new packages that may require updating 10688b728deSespiedependencies first. 10788b728deSespieIt is recommended to keep all packages in-synch 10888b728deSespiewith 10988b728deSespie.Fl u 11088b728deSespiewhenever possible, but 11188b728deSespie.Fl U 11288b728deSespiecan be much faster. 11388b728deSespie.It 11488b728deSespieReplace existing packages with explicit other versions, using option 11588b728deSespie.Fl r . 11688b728deSespieThe 11788b728deSespie.Ar pkg-name ... 11888b728deSespiespecified on the command line are new packages that should replace 11988b728deSespiealready installed packages, with other versions or flavors. 12088b728deSespie.El 121de512720Sespie.Pp 12223fef8b1Sespie.Nm 12323fef8b1Sespierelies on the file system information being consistent. 12423fef8b1SespieIn case of a system crash, 12523fef8b1Sespie.Pa /var/db/pkg 12623fef8b1Sespiemay become corrupted. 12723fef8b1SespieUse 12823fef8b1Sespie.Xr pkg_check 8 12923fef8b1Sespieto repair things. 13023fef8b1Sespie.Pp 13188b728deSespieDetails of packing-list internals are documented in 13288b728deSespie.Xr pkg_create 1 . 13387317f7eSespie.Pp 13418c57845Sespie.Nm 13588b728deSespiewill 13688b728deSespie.Xr syslog 3 13788b728deSespieinstallations and updates by default. 13880a407d2Sespie.Pp 139060a7505SespieEach package name may be specified as a filename (which normally consists of the 140a9987ed9Sespiepackage name itself plus the 141060a7505Sespie.Dq .tgz 142f2815d4eSstevensuffix) or a URL referring to FTP, HTTP, HTTPS, or SCP locations. 143a9987ed9SespieIf the given package names are not found in the current working directory, 144a9987ed9Sespie.Nm 145ad2fa668Sjuanfrawill search for them in each directory (local or remote) named by the 14618c57845Sespie.Ev TRUSTED_PKG_PATH 14718c57845Sespieenvironment variable, 14818c57845Sespiethen the 149a9987ed9Sespie.Ev PKG_PATH 150a9987ed9Sespieenvironment variable. 15104fb63e9SespieThe special url 15204fb63e9Sespie.Sq installpath 15304fb63e9Sespierefers to the contents of 15404fb63e9Sespie.Xr installurl 5 . 15518c57845SespieIf neither 15618c57845Sespie.Ev TRUSTED_PKG_PATH 15718c57845Sespienor 158ad2fa668Sjuanfra.Ev PKG_PATH 15918c57845Sespieare defined, 160ad2fa668Sjuanfra.Nm 16104fb63e9Sespiewill use 16204fb63e9Sespie.Sq ./:installpath 16304fb63e9Sespieas a default. 164a9987ed9Sespie.Pp 16580a407d2Sespie.Nm 16680a407d2Sespiealso understands 16780a407d2Sespie.Sq stems , 16880a407d2Sespiethat is, package names without any version specification. 16980a407d2SespieFor instance, with 1702fbdc314Sespie.Sq Nm Ar kdelibs , 17180a407d2Sespie.Nm 17218c57845Sespiewill look in the current directory 17318c57845Sespie.Po 17418c57845Sespieor the 17518c57845Sespie.Ev PKG_PATH 17618c57845Sespie.Pc 17718c57845Sespiefor a 1782fbdc314Sespie.Ar kdelibs 1792fbdc314Sespiepackage. 18080a407d2Sespie.Pp 18180a407d2Sespie.Nm 182f4cb3c7fSespiemay ask questions in interactive mode, or error out otherwise. 183f4cb3c7fSespieInteractive mode is the default on a tty, see 184f4cb3c7fSespieoptions 185f4cb3c7fSespie.Fl I/i . 186f4cb3c7fSespie.Pp 187f4cb3c7fSespieFor instance 188f76cbc48Sespie.Sq Nm Ar vim 189ad944985Sespieis ambiguous as it matches 190f76cbc48Sespie.Ar vim-*-no_x11 , 191f76cbc48Sespie.Ar vim-*-gtk3 , 192f76cbc48Sespieand a few other flavors. 19380a407d2Sespie.Pp 194a3664d7eSespieTo avoid ambiguities, 195a3664d7eSespie.Nm 196a3664d7eSespiesupports 197a3664d7eSespie.Sq stems with flavors , 198a3664d7eSespiethat is, a stem separated from flavors with a double dash. 199a3664d7eSespieFor instance, the previous ambiguity could be resolved by using 200f76cbc48Sespie.Sq Nm Ar vim--no_x11 2010db915daSlandry(matches only the no_x11 flavor) 202a3664d7eSespieor 203f76cbc48Sespie.Sq Nm Ar vim--gtk3 204f76cbc48Sespie(matches only the gtk3 flavor). 205ad944985Sespie.Pp 2065c50b308SespieThere is also an ambiguity related to ports with multiple branches. 2075c50b308SespieFor instance 2085c50b308Sespie.Sq Nm Ar python 2095c50b308Sespieis ambiguous, as there are several versions of python in the ports tree. 2105c50b308SespieSo is 2115c50b308Sespie.Sq Nm Ar postfix . 2125c50b308SespieThe special form 2135c50b308Sespie.Sq Ar pkgname Ns % Ns Ar branch 2145c50b308Sespiecan be used to restrict matches to a branch matching the 2155c50b308Sespie.Xr pkgpath 7 . 2165c50b308Sespie.Pp 2175c50b308SespieThe above ambiguities can be resolved using 2185c50b308Sespie.Sq Nm Ar postfix Ns % Ns Ar stable 2195c50b308Sespieand 220f76cbc48Sespie.Sq Nm Ar python Ns % Ns Ar 3.9 , 2215c50b308Sespierespectively. 2225c50b308Sespie.Pp 223c8bb85afSschwarzeAll paths recognize certain special sequences, 224c8bb85afSschwarzewhich are expanded as follows: 225c8bb85afSschwarze.Bl -tag -width "%m" 226c8bb85afSschwarze.It %a 227f5485e73SschwarzeThe package architecture as returned by 228f5485e73Sschwarze.Xr arch 1 229f5485e73Sschwarze.Fl s . 230c8bb85afSschwarze.It %v 231f5485e73SschwarzeThe operating system version in the format 232f5485e73Sschwarze.Dq digit dot digit . 233c8bb85afSschwarze.It %c 234c8bb85afSschwarzeExpands to the string 235c8bb85afSschwarze.Qq snapshots 236c8bb85afSschwarzewhen running a -current or -beta kernel, or if the command line option 237bb051d67Sespie.Fl D Cm snap | Fl D Cm snapshot 238c8bb85afSschwarzeis specified. 239c8bb85afSschwarzeOtherwise, %c expands to %v, which selects a release version. 240c8bb85afSschwarze.It %m 241c8bb85afSschwarzeThe full mirror path, 242c8bb85afSschwarze.Qq /pub/OpenBSD/%c/packages/%a/ . 243c8bb85afSschwarze.El 244e57394d3Sespie.Pp 245c8bb85afSschwarzeIf the resulting path contains 246c8bb85afSschwarze.Qq %c/packages 247c8bb85afSschwarzeand %c is not 248c8bb85afSschwarze.Qq snapshots , 249c8bb85afSschwarzethen a second directory is also searched, which is constructed by replacing 250c8bb85afSschwarze.Qq packages 251c8bb85afSschwarzewith 252c8bb85afSschwarze.Qq packages-stable . 253ad944985Sespie.Pp 254ad944985SespieThe following examples are valid: 255ad944985Sespie.Bd -literal -offset indent 256ad944985Sespiepkg_add -v http://ftp.openbsd.org/%m/rsync-- 257ad944985Sespiepkg_add -v http://ftp.openbsd.org/%m/m4 2585c50b308Sespiepkg_add -v scp://login@host/usr/ports/packages/%a/all/tcl%8.5 259ad944985Sespie.Ed 260a3664d7eSespie.Pp 26178a84262SespieIf the environment variable 26278a84262Sespie.Ev PKG_CACHE 263dbad22dfSespieis set to a directory name, every package retrieved from a distant location 264dbad22dfSespiewill also be copied here. 26578a84262Sespie.Pp 2667d2e2b80SespieIf the environment variable 2677d2e2b80Sespie.Ev DEBUG_PKG_CACHE 2687d2e2b80Sespieis set to a directory name, debug packages matching installed/updated packages 2697d2e2b80Sespiewill be downloaded to that directory 2707d2e2b80Sespie.Po 2717d2e2b80Sespiethis is to avoid 2727d2e2b80Sespie.Sq shearing , 2737d2e2b80Sespieas later on, you might wish to debug software, but the snapshots will have 2747d2e2b80Sespiemoved on and the debug packages no longer match your installation 2757d2e2b80Sespie.Pc . 2767d2e2b80SespieThis only applies to debug packages that are not currently installed/updated. 2777d2e2b80Sespie.Pp 278acb899f4SespieSome packages may depend on other packages. 279acb899f4SespieWhen resolving dependencies 280acb899f4Sespie.Nm 281acb899f4Sespiewill first look at already installed packages, then match 28280a407d2Sespiedependencies with the list of packages left to install, then ask the 28380a407d2Sespieuser's opinion in interactive mode, 28480a407d2Sespiethen install default packages that satisfy the dependencies. 285acb899f4Sespie.Pp 286a9987ed9Sespie.Sy Warning : 287f76cbc48SespieSince 288a9987ed9Sespie.Nm 289f76cbc48Sespiemay execute scripts or programs contained within a package file, 290a9987ed9Sespieyour system may be susceptible to 291a9987ed9Sespie.Dq trojan horses 292a9987ed9Sespieor other subtle attacks from miscreants who create dangerous packages. 293a9987ed9SespieBe sure the specified package(s) are from trusted sources. 294a9987ed9Sespie.Pp 295a9987ed9SespieThe options are as follows: 296acb899f4Sespie.Bl -tag -width keyword 297bc4c08b2Sjmc.It Fl A Ar arch 298bc4c08b2SjmcAssume 299bc4c08b2Sjmc.Ar arch 300bc4c08b2Sjmcas current machine architecture for any package tests. 301f1c572eaSespie.It Fl a 30229b4d7a9SjmcAutomated package installation; do not record packages as installed manually. 3035c1cbecfSespie.It Fl aa 3045c1cbecfSespieForce already installed packages to be tagged as installed automatically. 305bc4c08b2Sjmc.It Fl B Ar pkg-destdir 306bc4c08b2SjmcSet 307bc4c08b2Sjmc.Ar pkg-destdir 308bc4c08b2Sjmcas the prefix to prepend to any object extracted from the package. 3097b2d8b10Sespie.It Fl c 3107b2d8b10SespieWhile replacing packages, delete extra configuration file in the old package, 3117b2d8b10Sespiementioned as 3127b2d8b10Sespie.Dl @extra file 3137b2d8b10Sespiein the packing-list. 314321b69d2Sschwarze.It Fl D Ar name Ns Op = Ns Ar value 315acb899f4SespieForce installation of the package. 3167e222564Sespie.Ar name 3177e222564Sespieis a keyword that states what failsafe 318acb899f4Sespieshould be waived. 3197e222564SespieRecognized keywords include: 320bc4c08b2Sjmc.Pp 321bc4c08b2Sjmc.Bl -tag -width "updatedependsXX" -compact 322bd3a5667Sbentley.It Cm allversions 3237ee0afc1SjmcDo not trim older p* variants of packages for updates. 324bd3a5667Sbentley.It Cm arch 3257ee0afc1SjmcArchitecture recorded in package may not match. 326bd3a5667Sbentley.It Cm checksum 327e1a8a488SjmcVerify checksums before deleting or tying old files. 328bd3a5667Sbentley.It Cm dontmerge 3297ee0afc1SjmcBy default, if dependencies are too strict, 330e1beaa94Sespie.Nm 331f9e71213Sespiewill merge updates together to make sure everything stays in sync. 332bd3a5667Sbentley.Fl D Ns Cm dontmerge 333e1beaa94Sespiedisables that behavior. 334bd3a5667Sbentley.It Cm donttie 3357ee0afc1SjmcBy default, 3360306571fSespie.Nm 3370306571fSespiewill try to find new files in old packages by comparing the stored sha256, 3380306571fSespieand tie the entries together to avoid extracting files needlessly. 339bd3a5667Sbentley.Fl D Ns Cm donttie 3400306571fSespiedisables that behavior. 341bd3a5667Sbentley.It Cm downgrade 3427ee0afc1SjmcDon't filter out package versions older than what's currently installed. 343bd3a5667Sbentley.It Cm installed 3447ee0afc1SjmcIn update mode, reinstall an existing package with the same update signature. 345bd3a5667Sbentley.It Cm nonroot 3467ee0afc1SjmcInstall even if not running as root. 347bd3a5667Sbentley.It Cm repair 3487ee0afc1SjmcAttempt to repair installed packages with missing registration data. 349bd3a5667Sbentley.It Cm scripts 3507ee0afc1SjmcExternal scripts may fail. 351bd3a5667Sbentley.It Cm SIGNER 3527ee0afc1SjmcList of trusted signers, separated by commas. 3537ca3ff7cSespieCorresponds to list of public keys under 3547ca3ff7cSespie.Pa /etc/signify 355271229fbSespiewe want to trust. 356271229fbSespieDefaults to any key matching 357f76cbc48Sespie.Sq *pkg . 358bb051d67Sespie.It Cm snap | Cm snapshot 359e57394d3SespieForce 360e57394d3Sespie.Sq %c 361e57394d3Sespieand 362e57394d3Sespie.Sq %m 363e57394d3Sespieto expand to 364e57394d3Sespie.Sq snapshots , 365e57394d3Sespieeven on a release kernel. 366bd3a5667Sbentley.It Cm unsigned 36710f1e7eaSespieAllow the installation of unsigned packages without warnings/errors. 36810f1e7eaSespieBut see 36910f1e7eaSespie.Ev TRUSTED_PKG_PATH , 37010f1e7eaSespiewhich is more discriminating. 371bd3a5667Sbentley.It Cm updatedepends 372f76cbc48SespieForce update even if dependencies no longer match. 373dfae7728Sespie.El 37456f05edeSespie.It Fl I 37556f05edeSespieForce non-interactive mode. 37656f05edeSespieDefault is to be interactive when run from a tty. 3779b5ce663Sespie.It Fl i 37856f05edeSespieForce interactive mode, even if not run from a tty. 3799b5ce663Sespie.Nm 3809b5ce663Sespiemay ask questions to the user if faced with difficult decisions. 381e95d9ee4Sespie.It Fl L Ar localbase 382e95d9ee4SespieInstall a package under 383e95d9ee4Sespie.Ar localbase . 384e95d9ee4SespieBy default, 385e95d9ee4Sespie.Ar localbase 386e95d9ee4Sespieequals 387e95d9ee4Sespie.Pa /usr/local , 388e95d9ee4Sespieand specifying it is not necessary. 389e95d9ee4SespieHowever, packages can be created using a different 390e95d9ee4Sespie.Ar localbase 391e95d9ee4Sespie.Po 392e95d9ee4Sespiesee 393e95d9ee4Sespie.Xr pkg_create 1 394e95d9ee4Sespie.Pc , 395e95d9ee4Sespieand those packages can only be installed by using the same 396e95d9ee4Sespie.Ar localbase . 397e95d9ee4SespieSee 398e95d9ee4Sespie.Xr bsd.port.mk 5 399e95d9ee4Sespiefor a description of 400e95d9ee4Sespie.Ev LOCALBASE . 40189296dccSjmc.It Fl l Ar file 40289296dccSjmcInstalls packages from the raw output of 40389296dccSjmc.Xr pkg_info 1 , 40489296dccSjmcas saved in 40589296dccSjmc.Ar file . 406504871c3SespieGenerally, to reproduce an installation from machine to machine, 407504871c3Sespieuse 408504871c3Sespie.Li pkg_info -mz \*(Gtinstalled_list 409504871c3Sespieon the source machine and 410504871c3Sespie.Li pkg_add -l installed_list 411504871c3Sespieon the destination machine. 41269dc3962Sespie.It Fl m 41369dc3962SespieCauses 41469dc3962Sespie.Nm 41569dc3962Sespieto always display the progress meter in cases it would not do so by default. 416bc4c08b2Sjmc.It Fl n 417bc4c08b2SjmcDon't actually install a package, just report the steps that 418bc4c08b2Sjmcwould be taken if it was. 419dbad22dfSespieWill still copy packages to 420dbad22dfSespie.Ev PKG_CACHE 421dbad22dfSespieif applicable. 422bec7ad74Sespie.It Fl P Ar ftp 423bec7ad74SespieCheck that package can be distributed on ftp. 424bef549c8Sespie.It Fl qq 425bef549c8SespieDo not bother with checksums for configuration files. 426bc4c08b2Sjmc.It Fl r 427e70b9019SjmcReplace existing packages. 428abbdbb27Sespie.It Fl s 429abbdbb27SespieDon't actually install packages, skip as many steps as needed and report 430abbdbb27Sespieonly the disk size changes that would happen. 431abbdbb27SespieSimilar to 432abbdbb27Sespie.Fl n , 433abbdbb27Sespieexcept it also skips fetching full packages and stops at getting the 434abbdbb27Sespieinformation it needs. 4353fa466a1Sjmc.It Fl U 4363fa466a1SjmcUpdate dependencies if required before installing the new package(s). 4377e8fdcacSespie.It Fl u 438d7bfc211SespieUpdate the given installed 439bf06eee7Sespie.Ar pkgname(s) , 440bf06eee7Sespieand anything it depends upon. 441e70b9019SjmcIf no 4427e8fdcacSespie.Ar pkgname 4437e8fdcacSespieis given, 4447e8fdcacSespie.Nm 445bf06eee7Sespiewill update all installed packages. 4467e8fdcacSespieThis relies on 4477e8fdcacSespie.Ev PKG_PATH 4487e8fdcacSespieto figure out the new package names. 449e57394d3Sespie.It Fl V 450f76cbc48SespieDisplays the number of packages done/total number of packages. 451bc4c08b2Sjmc.It Fl v 452bc4c08b2SjmcTurn on verbose output. 453bc4c08b2SjmcSeveral 454bc4c08b2Sjmc.Fl v 455bc4c08b2Sjmcturn on more verbose output. 456abbdbb27SespieBy default, 457abbdbb27Sespie.Nm 458abbdbb27Sespieis almost completely silent, but it reacts to keyboard status requests 459abbdbb27Sespie.Po 460abbdbb27Sespiesee 461abbdbb27Sespie.Xr stty 1 462abbdbb27Sespie.Pc . 463abbdbb27Sespie.Fl v 464abbdbb27Sespieturns on basic messages, 465abbdbb27Sespie.Fl vv 466abbdbb27Sespieadds relevant system operations, 467abbdbb27Sespie.Fl vvv 468abbdbb27Sespieshows most internal computations apart from individual file/directory 469abbdbb27Sespieadditions, 470abbdbb27Sespie.Fl vvvv 471abbdbb27Sespiealso shows dependencies adjustments, and 472abbdbb27Sespie.Fl vvvvv 473abbdbb27Sespieshows everything. 474bc4c08b2Sjmc.It Fl x 47555c7b459SjmcDisable progress meter. 47621c4a320Sespie.It Fl z 47721c4a320SespieFuzzy package addition: 47821c4a320Sespie.Nm 479f76cbc48Sespiewill do its best to match package names passed on the command line, 48021c4a320Sespieeven if the versions don't match and it will proceed even if 48121c4a320Sespiesome packages can't be found. 48289296dccSjmc.El 483a9987ed9Sespie.Pp 484a9987ed9SespieBy default, when adding packages via FTP, the 485a9987ed9Sespie.Xr ftp 1 486a9987ed9Sespieprogram operates in 487a9987ed9Sespie.Dq passive 488a9987ed9Sespiemode. 489a9987ed9SespieIf you wish to use active mode instead, set the 490a9987ed9Sespie.Ev FTPMODE 491a9987ed9Sespieenvironment variable to 49229b4d7a9Sjmc.Dq active . 493a9987ed9SespieIf 494a9987ed9Sespie.Nm 495a9987ed9Sespieconsistently fails to fetch a package from a site known to work, 496a9987ed9Sespieit may be because the site does not support 49729b4d7a9Sjmcpassive mode FTP correctly. 498a9987ed9SespieThis is very rare since 499a9987ed9Sespie.Nm 50029b4d7a9Sjmcwill try active mode FTP if the server refuses a passive mode 501a9987ed9Sespieconnection. 5028ab71c19Sespie.Ss Manual installation 5038ab71c19Sespie.Nm 5048ab71c19Sespiedifferentiates between packages specified on the command line, and packages 5058ab71c19Sespieinstalled automatically because of inter-dependencies: 5061e2e22ccSespiethe first kind will be tagged as 5078ab71c19Sespie.Sq installed manually . 5088ab71c19SespieThe 5098ab71c19Sespie.Fl a 5108ab71c19Sespieoption is used internally by the 5118ab71c19Sespie.Xr ports 7 5128ab71c19Sespieinfrastructure 5138ab71c19Sespieand 5148ab71c19Sespie.Xr dpb 1 5158ab71c19Sespieto handle dependencies. 5168ab71c19Sespie.Pp 5178ab71c19SespieIt is also possible to tweak the 5188ab71c19Sespie.Sq installed manually 5198ab71c19Sespiestatus of a package after the fact. 5208ab71c19SespieRunning 5218ab71c19Sespie.Nm 5228ab71c19Sespieon an already installed package will tag it as 5238ab71c19Sespie.Sq installed manually , 5248ab71c19Sespieeven if it was already there as a dependency of something else, 5258ab71c19Sespieand doubling the 5268ab71c19Sespie.Fl a 5278ab71c19Sespieoption will remove the 5288ab71c19Sespie.Sq installed manually 5298ab71c19Sespietag from installed packages. 5308ab71c19Sespie.Pp 5318ab71c19Sespie.Xr pkg_info 1 5328ab71c19Sespiecan be used to show only manually-installed packages, and 5338ab71c19Sespie.Xr pkg_delete 1 5341e2e22ccSespiecan be used to remove dependencies when they are no longer needed. 535a9987ed9Sespie.Ss Technical details 536a9987ed9Sespie.Nm 537e5a45836Sespiedeals with 538e5a45836Sespie.Sq updatesets 539e5a45836Sespieinternally. 540e5a45836SespieAn updateset is a collection of old package(s) to delete, and new package(s) 541e5a45836Sespieto install, as an atomic operation. 542e5a45836SespieUnder normal circumstances, an updateset contains at most one old package 543e5a45836Sespieand one new package, but some situations may require 544e5a45836Sespie.Nm 545d741b6bcSespieto perform several installations/deletions at once. 546e5a45836Sespie.Pp 547e5a45836SespieFor each new package in an updateset, 548e5a45836Sespie.Nm 549e5a45836Sespieextracts the package's 550379cdfacSespie.Dq packing information 551f76cbc48Sespie(the packing-list and description mostly) 552f76cbc48Sespieinto a special staging directory under 5534c6ebb50Stb.Pa /tmp 554a9987ed9Sespie(or 555a9987ed9Sespie.Ev PKG_TMPDIR 55675764a4dSsthenif set) 557a9987ed9Sespieand then runs through the following sequence to fully extract the contents 558a9987ed9Sespieof the package: 559a9987ed9Sespie.Bl -enum 560a9987ed9Sespie.It 561a9987ed9SespieA check is made to determine if the package is already recorded as installed. 562a9987ed9SespieIf it is, 563e5a45836Sespiethe installation is terminated. 564a9987ed9Sespie.It 565a9987ed9SespieA check is made to determine if the package conflicts (from 5662b672abbSlandry.Cm @conflict 56729b4d7a9Sjmcdirectives; see 568a9987ed9Sespie.Xr pkg_create 1 ) 569c0f6f032Sespiewith a package already recorded as installed. 570e5a45836SespieIn non-replacement mode, its installation is terminated. 571a9987ed9Sespie.It 57251a178ecSespieFor packages tagged with architecture constraints, 57351a178ecSespie.Nm 57451a178ecSespieverifies that the current machine architecture agrees with the constraints. 57551a178ecSespie.It 576a9987ed9SespieAll package dependencies (from 577f528e339Sespie.Cm @depend 578379cdfacSespieand 579f528e339Sespie.Cm @wantlib 58029b4d7a9Sjmcdirectives; see 581a9987ed9Sespie.Xr pkg_create 1 ) 582424c7411Sespieare read from the packing-list. 583e3715e9fSjmcIf any of these dependencies are not currently fulfilled, 584acb899f4Sespiean attempt is made to find a package that meets them and install it, 585e5a45836Sespielooking first in the current updateset, then in the list of packages 586e5a45836Sespieto install passed to 587acb899f4Sespie.Nm ; 588379cdfacSespieif no adequate package can be found and installed, 589a9987ed9Sespiethe installation is terminated. 590a9987ed9Sespie.It 591acb899f4Sespie.Nm 592acb899f4Sespiechecks for collisions with installed file names, read-only file systems, 593acb899f4Sespieand enough space to store files. 594acb899f4Sespie.It 595424c7411SespieThe packing-list is used as a guide for extracting 596379cdfacSespiefiles from the package into their final locations. 597a9987ed9Sespie.It 59861051699SespieAfter installation is complete, a copy of all package files 599f4cb3c7fSespiesuch as the packing-list, extra messages, or 600f4cb3c7fSespiethe description file is made into 601a9987ed9Sespie.Pa /var/db/pkg/<pkg-name> 602a9987ed9Sespiefor subsequent possible use by 60361051699Sespie.Xr pkg_delete 1 60461051699Sespieand 60561051699Sespie.Xr pkg_info 1 . 606a9987ed9SespieAny package dependencies are recorded in the other packages' 607a9987ed9Sespie.Pa /var/db/pkg/<other-pkg>/+REQUIRED_BY 608a9987ed9Sespiefile 609a9987ed9Sespie(if the environment variable 610a9987ed9Sespie.Ev PKG_DBDIR 611a9987ed9Sespieis set, this overrides the 612a9987ed9Sespie.Pa /var/db/pkg/ 613a9987ed9Sespiepath shown above). 614a9987ed9Sespie.It 615a9987ed9SespieFinally, the staging area is deleted and the program terminates. 616a9987ed9Sespie.El 617a9987ed9Sespie.Pp 618acb899f4SespieNote that it is safe to interrupt 619acb899f4Sespie.Nm pkg_add 620acb899f4Sespiethrough 621acb899f4Sespie.Dv SIGINT , 62278a84262Sespie.Dv SIGHUP , 62378a84262Sespieand other signals, as it will safely record an interrupted install as 6243571b10fSespie.Pa partial-<pkgname>[.n] . 62578a84262Sespie.Pp 62678a84262SespieWhen replacing packages, the procedure is slightly different. 62778a84262Sespie.Bl -enum 62878a84262Sespie.It 62978a84262SespieA check is made to determine if a similar package is already installed. 6308c91635fSespieIf so, its full update signature is computed, which contains all the 6318c91635fSespienecessary dependency information along with the actual package version. 6328c91635fSespieIf that signature is identical to that of the new package, no replacement 633bd3a5667Sbentleyis performed (unless 634bd3a5667Sbentley.Fl D Cm installed 635bd3a5667Sbentleyis specified). 63678a84262Sespie.It 637e5a45836SespieA check is made to determine what old package(s) the new package(s) should 638e5a45836Sespiereplace, using conflicts. 639e5a45836Sespie.Nm 640e5a45836Sespiewill attempt to update those packages. 641e5a45836SespieIf they update to the new package(s), nothing needs to be done. 642d741b6bcSespieIf they're part of the list of updatesets to install, the corresponding 643d741b6bcSespieupdatesets will be merged. 644e5a45836SespieOtherwise, 645e5a45836Sespie.Nm 646e5a45836Sespiewill add them to the current updateset, and rerun update to find suitable 647f76cbc48Sespieupdates to those packages. 64878a84262Sespie.It 649e5a45836SespieA check is made to determine whether the old packages will be deleted without 650e5a45836Sespieissue, and whether the new packages will install correctly. 651f76cbc48SespieThis includes verifying 652bd3a5667Sbentleythat the new package still matches dependencies (unless 653bd3a5667Sbentley.Fl D Cm updatedepends ) . 65478a84262Sespie.It 65578a84262SespieShared libraries deserve special treatment: each shared library from the old 656e5a45836Sespiepackages that does no longer exist in the new packages, but that is required 65778a84262Sespiefrom a wantlib of another package is kept along in a stub package named 65878a84262Sespie.Pa \&.libs-<pkgname> . 65978a84262Sespie.It 660f76cbc48Sespie.Nm 661f76cbc48Sespieuses sha256 checksums to avoid extracting too much: if a file from an 662f76cbc48Sespieold package didn't change, it will be reused verbatim, and the extraction 663f76cbc48Sespiewill often finish early. 664f76cbc48Sespie.It 665e5a45836SespieThe new packages are extracted to the filesystem, using temporary filenames 66678a84262Sespieof the form 66778a84262Sespie.Pa pkg.XXXXXXX 668f76cbc48Sespieif necessary to avoid conflicts with the old packages. 66978a84262SespieThe packing-list is amended to record these names as @temp annotations, 67078a84262Sespiein cases the installation fails. 67178a84262Sespie.It 672d741b6bcSespieThe old packages are deleted as usual, except that some packages may still 673e5a45836Sespiedepend on them. 67436f1943bSespieNote also that 67536f1943bSespie.Cm @unexec-delete 67636f1943bSespiecommands are not executed. 67778a84262Sespie.It 678d741b6bcSespieThe new packages are installed as usual, except that the files are already 679e5a45836Sespiepresent and only need to be renamed. 68036f1943bSespieNote also that 68136f1943bSespie.Cm @exec-add 68236f1943bSespiecommands are not executed. 68378a84262Sespie.It 684e5a45836SespieDependencies from the old packages are adjusted to point to the correct new 685d741b6bcSespiepackage. 68678a84262Sespie.El 68747fa19b2Sespie.Pp 68847fa19b2SespieTo update packages in -u mode, 68947fa19b2Sespie.Nm 69047fa19b2Sespieperforms the following steps. 69147fa19b2Sespie.Bl -enum 69247fa19b2Sespie.It 69347fa19b2SespieEach package name is reduced to its stem, and every package name with matching 69447fa19b2Sespiestem available through 69547fa19b2Sespie.Ev PKG_PATH 69647fa19b2Sespieis considered as an update candidate. 69747fa19b2Sespie.It 698e5a45836Sespie.Nm 699e5a45836Sespiesearches for a 700e5a45836Sespie.Sq quirks 701e5a45836Sespiepackage first, which may contain exceptions to these rules. 702e5a45836SespieThis special package contains global information, such as packages that 703e5a45836Sespiecan be deleted because they're now part of base, or stem changes. 704e5a45836Sespie.It 705bd3a5667SbentleyVersion matching occurs: unless 706bd3a5667Sbentley.Fl D Cm downgrade , 707bd3a5667Sbentleyonly packages with newer 708e5a45836Sespieversions will be considered as update candidates. 709d741b6bcSespieNote that version matching is costly, thus 71047fa19b2Sespie.Ev PKG_PATH 71147fa19b2Sespieshould point to a snapshot of packages for a given version of 71247fa19b2Sespie.Ox , 7131d2a3765Sjmcsimilar to the organization on the FTP sites. 71447fa19b2Sespie.It 715959ea27bSespieCandidates are then matched according to their pkgpaths 716959ea27bSespie.Po 717959ea27bSespiesee 718959ea27bSespie.Xr pkgpath 7 719959ea27bSespieand 720959ea27bSespie.Xr pkg_create 1 721959ea27bSespie.Pc 722959ea27bSespiein order to weed out similar packages with distinct options. 72347fa19b2Sespie.It 7248c91635fSespieThe update signature of the candidate is compared to the signature of the 7258c91635fSespiealready installed package: identical signatures mean no update needed. 72647fa19b2Sespie.It 72747fa19b2SespieIf several candidates are left, 72847fa19b2Sespie.Nm 72947fa19b2Sespiewill ask the user in interactive mode, and not perform the update in 73047fa19b2Sespienon-interactive mode. 73147fa19b2Sespie.It 732e5a45836SespieOnce a suitable update candidate has been found, 73347fa19b2Sespie.Nm 734e5a45836Sespiechecks the package dependencies. 735e5a45836SespieIf necessary, it will install or update them first. 736dfb201a9StbOnce all dependencies are up to date, 73747fa19b2Sespie.Nm 738e5a45836Sespiewill update the package. 73947fa19b2Sespie.El 740a9987ed9Sespie.Sh ENVIRONMENT 741c959cce9Sespie.Bl -tag -width PKG_CHECKSUM 7427d2e2b80Sespie.It Ev DEBUG_PKG_CACHE 7437d2e2b80SespieIf set, debug packages matching installed/updated packages will be downloaded 7447d2e2b80Sespieto that directory as well. 74529b4d7a9Sjmc.It Ev FTPMODE 74629b4d7a9SjmcSpecifies whether 74729b4d7a9Sjmc.Xr ftp 1 74829b4d7a9Sjmcshould operate in 74929b4d7a9Sjmc.Dq active 75029b4d7a9Sjmcor 75129b4d7a9Sjmc.Dq passive 75229b4d7a9Sjmcmode. 75329b4d7a9SjmcThe default is 75429b4d7a9Sjmc.Dq passive . 75580a407d2Sespie.It Ev FETCH_CMD 75680a407d2SespieOverride use of 75780a407d2Sespie.Xr ftp 1 . 75880a407d2SespieMust point to a command that understands 75980a407d2Sespie.Li ${FETCH_CMD} -o - url . 760bef549c8Sespie.It Ev PKG_CACHE 761bef549c8SespieIf set, any package retrieved from a distant location will be copied to 762bef549c8Sespiethat directory as well. 763bef549c8Sespie.It Ev PKG_CHECKSUM 764bef549c8SespieIf set, verify files checksums during deletion, exactly like 765bd3a5667Sbentley.Fl D Ns Cm checksum . 766a9987ed9Sespie.It Ev PKG_DBDIR 767a9987ed9SespieWhere to register packages instead of 768a9987ed9Sespie.Pa /var/db/pkg . 769bc4c08b2Sjmc.It Ev PKG_PATH 770bc4c08b2SjmcIf a given package name cannot be found, 771bc4c08b2Sjmcthe directories named by 772bc4c08b2Sjmc.Ev PKG_PATH 773bc4c08b2Sjmcare searched. 774bc4c08b2SjmcIt should contain a series of entries separated by colons. 7755c3fa476SespieEach entry consists of a directory name. 776f2815d4eSstevenURL schemes such as FTP, HTTP, HTTPS, or SCP are also appropriate. 777bc4c08b2SjmcThe current directory may be indicated 778bc4c08b2Sjmcimplicitly by an empty directory name, or explicitly by a single 779bc4c08b2Sjmcperiod 78083728d2bSespie.Pq Ql \&./ . 7813043f72cSespieSpecial sequences 782da533d27Sespie.Sq %a , 7833043f72cSespie.Sq %c , 784da533d27Sespie.Sq %m , 785da533d27Sespie.Sq %v 7860e7957f8Srpewill be expanded. 787a9987ed9Sespie.It Ev PKG_TMPDIR 7880e815632SespieTemporary area where package information files will be extracted, instead of 7894c6ebb50Stb.Pa /tmp . 79018c57845Sespie.It Ev TRUSTED_PKG_PATH 79118c57845SespieSame semantics as 79218c57845Sespie.Ev PKG_PATH , 79318c57845Sespiebut it is searched before 79418c57845Sespie.Ev PKG_PATH 7957cdef8edStband waives any kind of signature checking. 796a9987ed9Sespie.El 7977cf1e51aSschwarze.Sh FILES 7987cf1e51aSschwarze.Bl -tag -width /etc/installurl 7997cf1e51aSschwarze.It Pa /etc/installurl 8007cf1e51aSschwarzedefault mirror server for package download 8017cf1e51aSschwarze.It Pa /etc/signify/*-pkg.pub 8027cf1e51aSschwarzepublic keys for package verification with 8037cf1e51aSschwarze.Xr signify 1 8047cf1e51aSschwarze.It Pa /usr/local/ 8057cf1e51aSschwarzedefault file system to install packages in 8067cf1e51aSschwarze.It Pa /usr/local/share/doc/pkg-readmes/ 8077cf1e51aSschwarze.Ox Ns -specific 8087cf1e51aSschwarzeinformation about individual packages 8097cf1e51aSschwarze.It Pa /var/db/pkg/ 8107cf1e51aSschwarzedatabase of installed 8117cf1e51aSschwarze.Xr packages 7 8127cf1e51aSschwarze.El 813a9987ed9Sespie.Sh SEE ALSO 81429b4d7a9Sjmc.Xr ftp 1 , 815a9987ed9Sespie.Xr pkg_create 1 , 816a9987ed9Sespie.Xr pkg_delete 1 , 817a9987ed9Sespie.Xr pkg_info 1 , 818dd4a0d3bSespie.Xr OpenBSD::Intro 3p , 8196d9ebccbSespie.Xr bsd.port.mk 5 , 820e57394d3Sespie.Xr installurl 5 , 82166375cb9Sjmc.Xr package 5 , 82223fef8b1Sespie.Xr pkg_check 8 823a9987ed9Sespie.Sh AUTHORS 824a9987ed9Sespie.Bl -tag -width indent -compact 82527e95970Sschwarze.It An Jordan Hubbard 826a9987ed9SespieInitial design. 82727e95970Sschwarze.It An Marc Espie 828a9987ed9SespieComplete rewrite. 829a9987ed9Sespie.El 830