Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Nov 2014 16:39:35 -0600
From:      Scot Hetzel <swhetzel@gmail.com>
To:        Moritz Warning <moritzwarning@web.de>
Cc:        FreeBSD Ports <ports@freebsd.org>
Subject:   Re: edit /etc/nsswitch.conf
Message-ID:  <CACdU%2Bf8vR1S3c191L8fBy2-FvTi6aDa4Li_TXxMWt9ArALoA8g@mail.gmail.com>
In-Reply-To: <546FA26B.9030802@web.de>
References:  <546FA26B.9030802@web.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Nov 21, 2014 at 2:36 PM, Moritz Warning <moritzwarning@web.de> wrote:
> Hi,
>
> I try to write a port of an application that needs to edit /etc/nsswitch.conf.
> But I have trouble modifying /etc/nsswitch.conf in pkg-plist (there is where it should be done?).
> Even creating a test file in pkg-plist seem be ignored:
>
> /etc/testfile
> @exec echo 'test' >> /etc/testfile
>
> Any ideas what could be wrong?
>
You probably don't want to do this in the pkg-plist, instead you would
normally do this in pkg-install:


pkg-install
#!/bin/sh

PKG_BATCH=${BATCH:=NO}
PKG_PREFIX=${PKG_PREFIX:=/usr/local}

case $2 in
        POST-INSTALL)
                                      if [ "${PKG_BATCH}" = "NO" ]; then
                                          # Do something to add an
entry to /etc/nsswitch.conf
                                      else
                                          # Display a message
                                          echo "*** We do not modify
/etc/nsswitch.conf automatically in"
                                          echo "*** BATCH mode. Please
modify it yourself."
                                      fi
                                      ;;
        POST-DEINSTALL)
                                      # Do something to remove the
entry that was added to /etc/nsswitch.conf
                                      ;;
esac

It might be better to add a pkg-message to the port that shows how to
modify /etc/nsswitch.conf, instead of having the port modify it.

-- 
DISCLAIMER:

No electrons were maimed while sending this message. Only slightly bruised.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACdU%2Bf8vR1S3c191L8fBy2-FvTi6aDa4Li_TXxMWt9ArALoA8g>