Installing an empty directory with RPM
Asked Answered
W

2

18

In my install section of my rpm Spec file I have a bunch of mkdir's to create the directories I need. The ones that don't have any files installed in them get pruned out in the end and don't end up getting created. How can I ensure that the empty directories get created when it is all said and done?

Wichman answered 22/7, 2010 at 12:26 Comment(0)
C
26

In your %files section:

%files
%dir /my/directory/name
Catarina answered 25/7, 2010 at 4:16 Comment(2)
m1tk4- will the created directory be removed when the rpm is being uninstalled?Recitativo
@OmerDagan Yes.Sarong
M
2

A complete example of creating an empty directory and setting its permissions.

%define _log_dir /var/log/my_package_name

%install
mkdir -p %{buildroot}/%{_log_dir}

%files
%dir %attr(755,owner_name,group_name) %{_log_dir}
Matt answered 15/3, 2023 at 3:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.