0

I know how to ghost a FILE of a rpm, in its spec file :

%install
touch $RPM_BUILD_ROOT%/path/file
...
%files
%ghost /path/file

But if I do the same method for a DIRECTORY, it doesn't work :

%install
mkdir -p $RPM_BUILD_ROOT%/path/folder
...
%files
%ghost /path/folder

Has anyone ever tried it ?

Thx very much !

Karl

Karl V
  • 1
  • 1
  • 1

2 Answers2

0

In fact, I discovered that this method works IF the directory is empty. So, but if the directory is not empty ??

Karl V
  • 1
  • 1
  • 1
  • Why would you want to do that? You can simply own that directory. If you are uninstalling package and there are some data (not owned by this package) then the directory is preserved. – msuchy Jan 21 '16 at 11:13
  • In fact, when we ghost a file, it is automatically removed when the package is removed. BUT, when we ghost a directory, it is not removed when the directory is not empty. And I would like it is removed too. – Karl V Jan 26 '16 at 08:08
  • um... I guess you'd have to ghost all the files in it too? – Ajax Jun 27 '18 at 17:11
0

I know this question is old, but I just ran into this and the solution is remove the folder during the pre-uninstall and this might help people in the future.

%install
touch $RPM_BUILD_ROOT%/path/file
...
%files
%ghost /path/folder

%preun
rm -rf /path/folder
State
  • 1
  • 2
  • 2