FreeBSD pkg versioning

Panagiotis Atmatzidis atma at convalesco.org
Wed Apr 5 12:15:01 UTC 2017


Hi,

I need to create FreeBSD packages of a commercial command line
application. I am using "pkg-create". I have created two versions,
however "pkg" doesn't handle the updates. First I checked the versioning
scheme to make sure "pkg" understands:

--------
root at fbsd11:~ # pkg version -t 3.0.1879 3.99.2311
<
--------

"pkg" understands which version is newer, apparently. However:

--------
root at fbsd11:~ # ls myapp*
myapp-3.0.1879.tgz      myapp-3.99.2311.tgz

root at fbsd11:~ # pkg add myapp-3.0.1879.tgz
Installing myapp-3.0.1879...
Extracting myapp-3.0.1879: 100%

root at fbsd11:~ # pkg add myapp-3.99.2311.tgz
Installing myapp-3.99.2311...
the most recent version of myapp-3.0.1879 is already installed
--------

I am creating a PLIST file which contains commands to be executed along
with a list of files to be packed and a manifest which look like this:

--------
$ cat pkg/+MANIFEST
name: myapp
version: 3.0.1879
origin: sysutils/myapp
users: [myapp]
groups: [myapp]
comment: "descriptive comment"
categories: [sysutils]
prefix: /opt/myapp
arch: amd64
www: https://myapp.com
maintainer: support at myapp.org
licenselogic: single
licenses: [commercial]
desc: "long description"

$ head -n 6 pkg/PLIST
@owner myapp
@group myapp
echo "@preexec sh -c 'if ! finger myapp|grep -iq login; then pw useradd
-n myapp -c myapp -s /usr/sbin/nologin -d /opt/myapp;fi'" >> $plist
@postexec cp /opt/myapp/share/myapp/init/myapp /etc/rc.d/myapp
@postexec chown -R myapp:myapp /opt/myapp
bin/myapp
--------

The same script creates the manifest for the newer version, so only the
${version} variable changes. 
My first problem is how to make pkg run upgrades smoothly when a new pkg
is out? Please note that our original naming scheme was like:
"myapp-1.2.1234-fbsd11.tgz" because we'd like to specify the major
release version.

Second question that came up is how to handle upgrades for configuration
files. Now, upon installation I place a sample config as
"myapp.conf.sample". The admin needs to configure the app anyway, as
defaults will not match anyone's use case, so I figured that it's not a
big deal renaming the file. Is there a better way? For example there is
a "%config(noreplace)" for RPMs and a similar flag for DEBs. I didn't
see any mention about special handling of configuration files in
pkg-create manual page.

Thanks!

-- 
Panagiotis (atmosx) Atmatzidis

email:  atma at convalesco.org
URL:    http://www.convalesco.org
GnuPG ID: 0x1A7BFEC5
gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5

"Everyone thinks of changing the world, but no one thinks of changing
himself.” - Leo Tolstoy


More information about the freebsd-pkg mailing list