Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Apr 2017 15:15:00 +0300
From:      Panagiotis Atmatzidis <atma@convalesco.org>
To:        freebsd-pkg@freebsd.org
Subject:   FreeBSD pkg versioning
Message-ID:  <1491394500.3816517.934922544.712A7743@webmail.messagingengine.com>

next in thread | raw e-mail | index | archive | help

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@fbsd11:~ # pkg version -t 3.0.1879 3.99.2311
<
--------

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

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

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

root@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@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@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1491394500.3816517.934922544.712A7743>