1

rpmlint output:

E: use-tmp-in-%postun

Spec file:

%postun
rm -r /var/aci /tmp/aci_tmp 2> /dev/null

Also, I cant remove package

How I can remove directory in /tmp after or before uninstalling this package?

PHPoenX
  • 366
  • 3
  • 10

2 Answers2

2

always try to avoid %post and %postun scripts if possible. You could make those aci files or folders belong to your package.

let's suppose for the sake of the example that /var/aci is a folder and /tmp/aci_tmp is a file. Then you could just:

%install
mkdir -p $PPM_BUILD_ROOT/var/aci

%files
/var/aci
%ghost /var/aci/* # not sure this is necessary...
%ghost /tmp/aci_tmp

the %ghost directives mean: if this file/folder appears, it belongs to me. That also means that they will be removed when you remove the package.

Chris Maes
  • 3,282
  • 3
  • 21
  • 32
0

It is because /tmp is usually mounted as tmpfs. If your package put something there, it will be wiped away during reboot.

Your case is probably fine as you ignore the error.

Thou, better is to use tmpfiles.d(5). I.e., create a file /etc/tmpfiles.d/aci.conf

With some of these lines (not sure if you are creating file or directory):

   #Type Path                                     Mode User Group Age         Argument
   f     /file/to/create                          mode user group -           content
   F     /file/to/create-or-truncate              mode user group -           content
   w     /file/to/write-to                        -    -    -     -           content
   d     /directory/to/create-and-cleanup         mode user group cleanup-age -
   D     /directory/to/create-and-remove          mode user group cleanup-age -
msuchy
  • 1,408
  • 8
  • 6