Package libnss-mymachines: Scripts

Post install

if [ -f /etc/nsswitch.conf ] ; then
        grep -E -q '^hosts:.* mymachines' /etc/nsswitch.conf ||
        sed -i.rpmorig -r -e '
                s/^(hosts):([ \t]*)(\s+)/\1:\2 mymachines\3/
                ' /etc/nsswitch.conf >/dev/null 2>&1 || :

# Cleanup. sinse v246 nss-mymachines: drop support for UID/GID resolving
        grep -v -E -q '^(passwd|group):.* mymachines' /etc/nsswitch.conf ||
        sed -i.rpmorig -r -e '
                /^(passwd|group):/ !b
                s/[[:blank:]]+mymachines\>//
                ' /etc/nsswitch.conf >/dev/null 2>&1 || :
fi
update_chrooted all
Post uninstall

if [ "$1" = "0" ]; then
        if [ -f /etc/nsswitch.conf ] ; then
                sed -i.rpmorig -e '
                        /^hosts:/ !b
                        s/[[:blank:]]\+mymachines\>//
                        ' /etc/nsswitch.conf >/dev/null 2>&1 || :

        fi
fi

update_chrooted all