edit /etc/nsswitch.conf

Scot Hetzel swhetzel at gmail.com
Fri Nov 21 22:39:37 UTC 2014


On Fri, Nov 21, 2014 at 2:36 PM, Moritz Warning <moritzwarning at 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.


More information about the freebsd-ports mailing list