Don't worry about it. If you claim the directory as your own in the %files
section, RPM will handle it for you.
FYI, %{buildroot}
probably won't exist on the target machine.
質問
I'm creating a simple RPM installer, I just have to copy files to a directory structure I create in the %install
process.
The %install
process is fine, I create the following folder /opt/company/application/
with the command mkdir -p %{buildroot}/opt/company/%{name}
and then I proceed to copy the files and subdirectories from my package. I've tried to install it and it works.
The doubt I have comes when uninstalling. I want to remove the folder /opt/company/application/
and I thought you're supposed to use %{buildroot}
anywhere when referencing the install location. Because my understanding is the user might have a different structure and you can't assume that rmdir /opt/company/%{name}/
will work. Using that command in the %postun
section deletes succesfully the directories whereas using rmdir ${buildroot}/opt/company/%{name}
doesn't delete the folders.
My question is, shouldn't you be using ${buildroot}
in the %postun
in order to get the proper install location? If that's not the case, why?
解決
Don't worry about it. If you claim the directory as your own in the %files
section, RPM will handle it for you.
FYI, %{buildroot}
probably won't exist on the target machine.