chmod on subdirectories and files

Richard Siddall richard.siddall at
Thu Aug 20 16:25:06 UTC 2009

George Machitidze wrote:
> Hi Valery,
> Thanks for suggestion...
> So, this is only solution for now, in install section yes?
> Actually I didn't find any other way/workaround...

I've added RPM %files section directives to the lines in a file list.  I 
have no idea whether that works in all current versions of RPM, but it 
has worked on CentOS 4, 5 and SuSE ES 10.

Something like:

> find $RPM_BUILD_ROOT -type f -print | \
> 	sed "s@^$RPM_BUILD_ROOT@%%attr(640,apache,apache) %%config(noreplace) @g" >> %{name}-%{version}-%{release}-filelist
> find $RPM_BUILD_ROOT -type d -print | \
> 	sed "s@^$RPM_BUILD_ROOT@%%attr(711,apache,apache) %%dir @g" >> %{name}-%{version}-%{release}-filelist

and then later:

> %files -f %{name}-%{version}-%{release}-filelist
 > ...other files not caught in the file list...

using "find" to build a file list should help when you have a lot of 
files to package.


	Richard Siddall

More information about the Rpm-list mailing list