I'm working on creating a package for the UniFi controller software for Fedora/EL7. It has no chance of making it into Fedora but has been blessed by Ubiquity so for now it's packaged as an SRPM which the end user has to build to comply with their license restrictions.
I recently found out it was putting a log file where I didn't want it so I tried adding some logic in %pre to migrate it to the correct location.
Per the Fedora Packaging Guidelines for sciptlets %pre runs BEFORE the updated package is installed but that doesn't appear to be the case...
I took out all my logic and just tried a brute force rm -rf of the old location to get a minimal test case:
%pre
# Migrate UniFi log to the proper directory
#if [ ! -h /var/lib/unifi/logs ]; then
# if [ -f /var/lib/unifi/logs/server.log ]; then
# mv -f /var/lib/unifi/logs/server.log \
# /var/log/unifi/ 2>/dev/null
# fi
# rmdir /var/lib/unifi/logs
rm -rf /var/lib/unifi/logs
#fi
On an attempted upgrade I get the following:
Running transaction
Upgrading : unifi-5.3.8-2.1.fc24.x86_64 1/2
Error unpacking rpm package unifi-5.3.8-2.1.fc24.x86_64
Error unpacking rpm package unifi-5.3.8-2.1.fc24.x86_64
error: unpacking of archive failed on file /var/lib/unifi/logs: cpio: rename
unifi-5.3.8-2.1.fc24.x86_64 was supposed to be installed but is not!
Verifying : unifi-5.3.8-2.1.fc24.x86_64 1/2
unifi-5.3.8-2.fc24.x86_64 was supposed to be removed but is not!
Verifying : unifi-5.3.8-2.fc24.x86_64 2/2
Failed:
unifi.x86_64 5.3.8-2.1.fc24
And in the directory in question I get:
$ ll /var/lib/unifi
total 12
drwxr-xr-x. 6 unifi unifi 4096 Jan 25 08:44 data
drwxr-xr-x. 2 unifi unifi 4096 Jan 25 08:32 logs
lrwxrwxrwx. 1 unifi unifi 15 Jan 25 08:44 'logs;5888ba05' -> ../../log/unifi
drwxr-xr-x. 3 unifi unifi 4096 Jan 25 08:04 work
So it seems to me that %pre did not run.
Am I missing something?
Thanks,
Richard
_______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx