Hi,
I am building an nginx part, as part of my snap. I specify my desired install directories (e.g. prefix
, sbin-path
, config file paths, etc) with the autotools-configure-parameters
directive as follows:
nginx:
plugin: autotools
source: http://nginx.org/download/nginx-1.25.3.tar.gz
build-packages:
- libpcre3-dev
- libssl-dev
- pkg-config
autotools-configure-parameters:
- --prefix=/usr/nginx
- --sbin-path=/bin/nginx
- --modules-path=/usr/nginx/modules
- --conf-path=/usr/nginx/conf/nginx.conf
- --error-log-path=/var/log/nginx/error.log
- --http-log-path=/var/log/nginx/access.log
- --pid-path=/var/log/nginx/nginx.pid
- --lock-path=/var/log/nginx/nginx.lock
- --with-http_ssl_module
- --add-module=extras/nginx-rtmp-module
However, when running the snap, nginx looks for the config files at the absolute path /usr/nginx/conf/nginx.conf
for example. Obviously, there is no system-wide nginx installed at /usr
as it is installed in /snap/<snap-name>/current/usr
. I tried using organize
to fix this issue by doing:
nginx:
plugin: autotools
source: http://nginx.org/download/nginx-1.25.3.tar.gz
organize:
snap/<snap-name>/current/usr: usr
snap/<snap-name>/current/bin: bin
snap/<snap-name>/current/var: var
snap/<snap-name>/current/etc: etc
build-packages:
- libpcre3-dev
- libssl-dev
- pkg-config
autotools-configure-parameters:
- --prefix=/snap/<snap-name>/current/usr/nginx
- --sbin-path=/snap/<snap-name>/current/bin/nginx
- --modules-path=/snap/<snap-name>/current/usr/nginx/modules
- --conf-path=/snap/<snap-name>/current/usr/nginx/conf/nginx.conf
- --error-log-path=/snap/<snap-name>/current/var/log/nginx/error.log
- --http-log-path=/snap/<snap-name>/current/var/log/nginx/access.log
- --pid-path=/snap/<snap-name>/current/var/log/nginx/nginx.pid
- --lock-path=/snap/<snap-name>/current/var/log/nginx/nginx.lock
- --with-http_ssl_module
- --add-module=extras/nginx-rtmp-module
Now, the issue with this approach is that the files are installed into the correct directories within the snap, but during runtime nginx tries looking for the files at /snap/<snap-name>/current/...
and does not replace current
with the snap revision, hence not finding them.
What is the proper way of specifying these directories for autotools so that they are correctly accessed during runtime?
Cheers,
Ramin