Re: [OT] how to see if an rpm file will modify config files upon update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Finally I found the culprit.. in other occasions I have searched for it but I was not able to find.
Probably the correct google search combination today ;-)

 
"
The bit that implements %config(noreplace) maps to (from lib/rpmlib.h):
rpmlib.h: RPMFILE_NOREPLACE = (1 << 4), /*!< from %%config(noreplace) */
"

One way to check against a file (eg httpd.conf):

QFILE=/etc/httpd/conf/httpd.conf 
BITSET=$(rpm -q --qf '[%{filenames}: %{fileflags}\n]' -f $QFILE | grep "^${QFILE}:" | cut -d ":" -f 2) 
RESULT=$(echo $(($BITSET & 16))) 
if [ $RESULT -eq 16 ]; then echo "NO replace"; else  echo "REPLACE"; fi

For example in RH EL 6.5 with httpd-2.2.22-25.ep6.el6.x86_64  that has in its source rpm a line such as

%config %{_sysconfdir}/httpd/conf/httpd.conf

$ echo $QFILE 
/etc/httpd/conf/httpd.conf

$ echo $BITSET 
1

$ echo $RESULT 
0

$ if [ $RESULT -eq 16 ]; then echo "NO replace"; else  echo "REPLACE"; fi
REPLACE

While in Fedora 20 with httpd-2.4.9-2.fc20.x86_64 that comes instead in source rpm with:

%config(noreplace) %{_sysconfdir}/httpd/conf/httpd.conf

[g.cecchi@ope46 ~]$ QFILE=/etc/httpd/conf/httpd.conf 
[g.cecchi@ope46 ~]$ BITSET=$(rpm -q --qf '[%{filenames}: %{fileflags}\n]' -f $QFILE | grep "^${QFILE}:" | cut -d ":" -f 2) 
[g.cecchi@ope46 ~]$ RESULT=$(echo $(($BITSET & 16))) 

[g.cecchi@ope46 ~]$ if [ $RESULT -eq 16 ]; then echo "NO replace"; else  echo "REPLACE"; fi
NO replace

[g.cecchi@ope46 ~]$ echo $QFILE
/etc/httpd/conf/httpd.conf
[g.cecchi@ope46 ~]$ echo $BITSET
17
[g.cecchi@ope46 ~]$ echo $RESULT
16

And the thing works querying both the package and the rpm file (eg using in this last case
rpm -q --qf '[%{filenames}: %{fileflags}\n]' -p httpd-2.2.22-25.ep6.el6.x86_64.rpm | grep "^${QFILE}:" | cut -d ":" -f 2
)

Thanks anyway,
Gianluca
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux