Re: Files listed twice question

"Michael A. Peters" <[email protected]> Sat, 27 Sep 2008 12:47:52 -0700
Newsgroups gmane.linux.redhat.rpm.general
Message-ID <[email protected]>
Adri=E1n M=E1rques wrote:
> Hi there,
>=20
> I'm an absolute newbie trying to package an application with RPM for th=
e=20
> first time and would like to mark some files as config files.
> The top directory of this aplication has several files and directories,=
=20
> only two of which hold config files. Thus, I'm doing something like thi=
s=20
> in my spec file:
>=20
> %files
> /usr/local/myAppTopDir/

Just a question - any reason in particular why you are using /usr/local=20
instead of /opt ?

/usr/local is suppose to be for applications compiled from source on the=20
machine, /opt is for third party vendor packages (be they rpm or tarball=20
or whatever)

> %config /usr/local/myAppTopDir/configDir1/*
> %config /usr/local/myAppTopDir/configDir2/*
>=20
> Obviously, this generates several 'file listed twice' warnings. However=
,=20
> I queried the generated rpm and didn't find anything wrong with it. All=
=20
> config files where included and correctly marked as config files.
>=20
> So my questions are: can I safely ignore these warnings or listing file=
s=20
> twice like I have causes a problem I'm not seeing now? is there a bette=
r=20
> way to do what I want?

I usually do something like this -

echo "%%defattr(-,root,root,-)" > custom.list
for dir in `find $RPM_BUILD_ROOT/usr/local -type d`; do
   fixed=3D"`echo ${dir} |sed s?"$RPM_BUILD_ROOT"?""?`"
   if [ `echo $fixed |grep -c "configDir"` -eq 0 ]; then
     echo "%%dir $fixed" >> custom.list
   fi
done
for file in `find RPM_BUILD_ROOT/usr/local -type f`; do
etc.

then

%files -f custome.list
%defattr(-,root,root.-)
%config /usr/local/myAppTopDir/configDir1/*
%config /usr/local/myAppTopDir/configDir2/*

If the config files are something the sysadmin is to edit, it's=20
generally a good idea to do

%config(noreplace) instead of just %config

>=20
> I have been looking through the list archives so I know many of you=20
> would advice me to explicitly list all files. I know this would take=20
> care of this particular problem, but I don't want to do that unless I=20
> really have to, since I find globbing significantly more practical in=20
> this case.
>=20
> I thank you already for taking the time to read this.
>=20
> Regards.
>=20
> Adri=E1n.
>=20
> _______________________________________________
> Rpm-list mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/rpm-list