PolaricServer / webapp2

Re-write of client app. Based on OpenLayers 5+
GNU Affero General Public License v3.0
15 stars 4 forks source link

debian: preinst script failure #39

Closed martinhpedersen closed 3 years ago

martinhpedersen commented 3 years ago

The preinst script in polaric-webapp2_1.6.2 depends on a2enmod (from the apache2 package) and some apache2 modules being available on the system. However since debian/control lists apache2 as Depends: (not Pre-Depends), the a2enmod fails on systems where apache2 is not pre-installed.

I believe an easy fix would be to define apache2 as a Pre-Depends in debian/control, but the debian documentation recommends to avoid the situation if possible:

Pre-Depends are also required if the preinst script depends on the named package. It is best to avoid this situation if possible.

martinhpedersen commented 3 years ago

After resolving this issue by manually installing apache2 prior to apt-get install polaric-webapp2, I get the following new error from preinst:

a2ensite aprs.conf
ERROR: Site aprs does not exist!
martinhpedersen commented 3 years ago

I am unable to locate the source of preinst in this repo, but here is the copy I extracted from polaric-webapp2_1.6.2_all.deb:

#!/bin/bash
set -e

case "$1" in
    install|upgrade)
        a2enmod expires > /dev/null 2>&1
        a2enmod deflate > /dev/null 2>&1
        if [[ ! -f "/etc/apache2/sites-enabled/aprs.conf" ]]; then
            a2ensite aprs.conf > /dev/null 2>&1 
        fi

        if [[ ! -d "/var/lib/polaric/mapcache" ]]; then
            mkdir /var/lib/polaric/mapcache
        fi

        chown www-data:polaric /var/lib/polaric/mapcache
        chmod 775 /var/lib/polaric/mapcache
        if ls /var/lib/polaric/mapcache/*.db > /dev/null 2>%1; then
            chown www-data:polaric /var/lib/polaric/mapcache/*.db
            chmod 664 /var/lib/polaric/mapcache/*.db
        fi
    ;;

    *)
        echo "$0 called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac
ohanssen commented 3 years ago

Thanks for the top. I guess the a2enmod and a2ensite in preinst script could just be moved to the postinst script. Before the apache2ctl restart. I checked in the change..

martinhpedersen commented 3 years ago

Sounds good too me 👍 🙂 Thanks!

I'll update this issue once it has been released to verify the fix on my end.

martinhpedersen commented 3 years ago

Quick update: The pre-installation script is still failing in v1.7.

I will need to do some more digging in order to provide you with log output. I'll get back to you as soon as possible 🙂

martinhpedersen commented 3 years ago

That was easier than I thought.

#11 22.48 Selecting previously unselected package polaric-webapp2.
#11 22.48 Preparing to unpack .../113-polaric-webapp2_1.7_all.deb ...
#11 22.49 chown: invalid group: 'www-data:polaric'
#11 22.49 dpkg: error processing archive /tmp/apt-dpkg-install-7iWBtT/113-polaric-webapp2_1.7_all.deb (--unpack):
#11 22.49  new polaric-webapp2 package pre-installation script subprocess returned error exit status 1

So the issue is with the chown this time. Possibly that the group polaric has not yet been created(?).

ohanssen commented 3 years ago

If this is installed for the first time, obviously the group should be created. I'll fix it.

ohanssen commented 3 years ago

This is probably only an issue if you don't install polaric-aprsd first, for example if creating a docker container with only the client.

ohanssen commented 3 years ago

Fixed in 1.7.3