Re: [gentoo-dev] How to add a service to /etc/services?

2007-10-07 Thread Mike Frysinger
On Sunday 07 October 2007, Ulrich Mueller wrote:
> I've found the following interesting piece of code in src_install
> of both app-emacs/lookup and net-misc/ndptd:
>
>   if ! $(grep 2010/tcp /etc/services >/dev/null 2>&1) ; then
>   cp /etc/services ${T}/services
>   cat >>${T}/services<<-EOF
>   ndtp2010/tcp# Network 
> Dictionary Transfer Protocol
>   EOF
>   insinto /etc
>   doins ${T}/services
>   fi

these packages need to get shot in the head ... those will cause package 
collisions

> Which leads me to the question: What is the recommended way to add a
> service to /etc/services?

have the port properly registered with IANA and then baselayout will integrate 
the updates

> And shouldn't "getent" (or even "egetent") 
> be used to determine if it already exists?

no, because that implies it's ok having anything other than baselayout or the 
user modify the file
-mike


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-dev] How to add a service to /etc/services?

2007-10-07 Thread Thomas de Grenier de Latour
On 2007/10/07, Ulrich Mueller <[EMAIL PROTECTED]> wrote:

> Which leads me to the question: What is the recommended way to add a
> service to /etc/services? 

FYI, attached is a list of ebuilds which touch /etc/services.  I count 
eight packages, which do it in either src_install, pkg_postinst, or
pkg_config.  Plus a few ones with just some einfos about what should
be done by hand.

Maybe that's worth a small eclass, with a "useradd"-like function?

--
TGL.app-emacs/[EMAIL PROTECTED]
app-emacs/[EMAIL PROTECTED] elisp-site-file-install 
${FILESDIR}/50lookup-gentoo.el
app-emacs/[EMAIL PROTECTED]
app-emacs/[EMAIL PROTECTED]:if ! $(grep 2010/tcp /etc/services >/dev/null 
2>&1) ; then
app-emacs/[EMAIL PROTECTED]:cp /etc/services ${T}/services
app-emacs/[EMAIL PROTECTED] cat >>${T}/services<<-EOF
app-emacs/[EMAIL PROTECTED] ndtp2010/tcp
# Network Dictionary Transfer Protocol
app-emacs/[EMAIL PROTECTED] EOF
...
dev-db/[EMAIL PROTECTED]ln -s /var/log/firebird.log firebird.log
dev-db/[EMAIL PROTECTED]fi
dev-db/[EMAIL PROTECTED]
dev-db/[EMAIL PROTECTED]:   # add gds_db to /etc/services
dev-db/[EMAIL PROTECTED]:   if [ -z "`grep gds_db  /etc/services`" ]
dev-db/[EMAIL PROTECTED]then
dev-db/[EMAIL PROTECTED]:   echo -e "#\n#Service added for gds_db 
(firebird)\n#" >> /etc/services
dev-db/[EMAIL PROTECTED]:   echo "gds_db3050/tcp" >> 
/etc/services
dev-db/[EMAIL PROTECTED]:   einfo "added gds_db to /etc/services"
dev-db/[EMAIL PROTECTED]fi
dev-db/[EMAIL PROTECTED]
dev-db/[EMAIL PROTECTED]# if found /etc/isc4.gdb from previous install, 
backup, and restore as
...
media-gfx/[EMAIL PROTECTED]() {
media-gfx/[EMAIL PROTECTED] # What follows is modified from rpm -qp 
--scripts Maya6_5-6.5-253.i686.rpm
media-gfx/[EMAIL PROTECTED]:cp ${ROOT}/etc/services ${T}/services.maya_save
media-gfx/[EMAIL PROTECTED]:awk '/mi-ray/ { found++; print ; next } {print} 
END {if (0==found) print "mi-ray 7003/tcp" }' ${T}/services.maya_save > 
${ROOT}/etc/services
media-gfx/[EMAIL PROTECTED]
media-gfx/[EMAIL PROTECTED]:cp ${ROOT}/etc/services ${T}/services.maya_save
media-gfx/[EMAIL PROTECTED]:awk '/mi-raysat/ { found++; print ; next } 
{print} END {if (0==found) print "mi-raysat 7103/tcp" }' 
${T}/services.maya_save > ${ROOT}/etc/services
media-gfx/[EMAIL PROTECTED]
media-gfx/[EMAIL PROTECTED] # update the magic file
media-gfx/[EMAIL PROTECTED] if [[ -e ${ROOT}/usr/share/magic ]]; then
...
media-libs/[EMAIL PROTECTED]() {
media-libs/[EMAIL PROTECTED]make DESTDIR=${D} install || die
media-libs/[EMAIL PROTECTED]
media-libs/[EMAIL PROTECTED]:   # Add to /etc/services
media-libs/[EMAIL PROTECTED]:   if ! grep -q ^ladcca /etc/services; then
media-libs/[EMAIL PROTECTED]dodir /etc
media-libs/[EMAIL PROTECTED]insinto /etc
media-libs/[EMAIL PROTECTED]:   doins /etc/services
media-libs/[EMAIL PROTECTED]:   echo -e "\nladcca\t\t14541/tcp\t\t\t# 
LADCCA client/server protocol" >> ${D}/etc/services
media-libs/[EMAIL PROTECTED]fi
media-libs/[EMAIL PROTECTED]
media-libs/[EMAIL PROTECTED]dodoc AUTHORS ChangeLog NEWS README TODO
...
media-libs/[EMAIL PROTECTED]() {
media-libs/[EMAIL PROTECTED]make DESTDIR=${D} install || die
media-libs/[EMAIL PROTECTED]
media-libs/[EMAIL PROTECTED]:   # Add to /etc/services
media-libs/[EMAIL PROTECTED]:   if ! grep -q ^ladcca /etc/services; then
media-libs/[EMAIL PROTECTED]dodir /etc
media-libs/[EMAIL PROTECTED]insinto /etc
media-libs/[EMAIL PROTECTED]:   doins /etc/services
media-libs/[EMAIL PROTECTED]:   echo -e "\nladcca\t\t14541/tcp\t\t\t# 
LADCCA client/server protocol" >> ${D}/etc/services
media-libs/[EMAIL PROTECTED]fi
media-libs/[EMAIL PROTECTED]
media-libs/[EMAIL PROTECTED]dodoc AUTHORS ChangeLog NEWS README TODO
...
media-sound/[EMAIL PROTECTED]() {
media-sound/[EMAIL PROTECTED]   make DESTDIR=${D} install || die
media-sound/[EMAIL PROTECTED]
media-sound/[EMAIL PROTECTED]:  # Add to /etc/services
media-sound/[EMAIL PROTECTED]:  if ! grep -q ^lash /etc/services; then
media-sound/[EMAIL PROTECTED]   dodir /etc
media-sound/[EMAIL PROTECTED]   insinto /etc
media-sound/[EMAIL PROTECTED]:  doins /etc/services
media-sound/[EMAIL PROTECTED]:  echo -e "\nlash\t\t14541/tcp\t\t\t# 
LASH client/server protocol" >> ${D}/etc/services
media-sound/[EMAIL PROTECTED]   fi
media-sound/[EMAIL PROTECTED]
media-sound/[EMAIL PROTECTED]   dodoc AUTHORS ChangeLog NEWS README TODO
...
media-sound/[EMAIL PROTECTED]() {
media-sound/[EMAIL PROTECTED]   make DESTDIR=${D} install || die
media-sound/[EMAIL PROTECTED]
media-sound/[EMAIL PROTECTED]:  # Add to /etc/services
media-sound/[EMAIL PROTECTED]:  if ! grep -q ^lash /etc/services; then
media-sound/[EMAIL PROTECTED]   dodir /etc
media

Re: [gentoo-dev] How to add a service to /etc/services?

2007-10-07 Thread Ulrich Mueller
> On Sun, 7 Oct 2007, Alec Warner wrote:

>> ndtp2010/tcp# Network Dictionary 
>> Transfer Protocol

>> Which leads me to the question: What is the recommended way to add a
>> service to /etc/services? And shouldn't "getent" (or even "egetent")
>> be used to determine if it already exists?

> Ask upstream to add it in a future version?

Hm, I see now that ndtp is registered by IANA and already in
baselayout's /etc/services, but under a different port number:
ndtp2882/tcp# Network Dictionary Transfer 
Protocol
ndtp2882/udp

Since the ndtpd ebuild greps for 2010/tcp (which it doesn't find) it
will add the service a second time ...

Is 2010 an obsolete port number, so that the /etc/services handling
should simply be removed from the net-misc/ndtpd and app-emacs/lookup
ebuilds?

Is anyone actually using ndtpd who can shed some light on the issue?

Ulrich
-- 
[EMAIL PROTECTED] mailing list



Re: [gentoo-dev] How to add a service to /etc/services?

2007-10-07 Thread Alec Warner
On 10/7/07, Ulrich Mueller <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've found the following interesting piece of code in src_install
> of both app-emacs/lookup and net-misc/ndptd:
>
> if ! $(grep 2010/tcp /etc/services >/dev/null 2>&1) ; then
> cp /etc/services ${T}/services
> cat >>${T}/services<<-EOF
> ndtp2010/tcp# Network 
> Dictionary Transfer Protocol
> EOF
> insinto /etc
> doins ${T}/services
> fi
>
> Which leads me to the question: What is the recommended way to add a
> service to /etc/services? And shouldn't "getent" (or even "egetent")
> be used to determine if it already exists?

Ask upstream to add it in a future version?

-Alec
-- 
[EMAIL PROTECTED] mailing list



Re: [gentoo-dev] How to add a service to /etc/services?

2007-10-07 Thread Jan Kundrát
Ulrich Mueller wrote:
>   if ! $(grep 2010/tcp /etc/services >/dev/null 2>&1) ; then
>   cp /etc/services ${T}/services
>   cat >>${T}/services<<-EOF
>   ndtp2010/tcp# Network 
> Dictionary Transfer Protocol
>   EOF
>   insinto /etc
>   doins ${T}/services
>   fi
> 
> Which leads me to the question: What is the recommended way to add a
> service to /etc/services?

Unless I'm mistaken, altering file that is owned by another package
(baselayout in this case) is not a good idea as it would invalidate file
checksum that Portage keeps. Why not add that line to
baselayout-provided file?

Cheers,
-jkt

-- 
cd /local/pub && more beer > /dev/mouth



signature.asc
Description: OpenPGP digital signature


[gentoo-dev] How to add a service to /etc/services?

2007-10-07 Thread Ulrich Mueller
Hi,

I've found the following interesting piece of code in src_install
of both app-emacs/lookup and net-misc/ndptd:

if ! $(grep 2010/tcp /etc/services >/dev/null 2>&1) ; then
cp /etc/services ${T}/services
cat >>${T}/services<<-EOF
ndtp2010/tcp# Network 
Dictionary Transfer Protocol
EOF
insinto /etc
doins ${T}/services
fi

Which leads me to the question: What is the recommended way to add a
service to /etc/services? And shouldn't "getent" (or even "egetent")
be used to determine if it already exists?

Ulrich
-- 
[EMAIL PROTECTED] mailing list