1eaaa3
#!/bin/bash
1eaaa3
# 
1eaaa3
# Author: Honza Horak <hhorak@redhat.com>
1eaaa3
# Date: 2011/11/25
1eaaa3
# Package: ypserv
1eaaa3
#
1eaaa3
# This script is part of ypserv package.
1eaaa3
# We need to pass all environment variables set in /etc/sysconfig/yppasswdd 
1eaaa3
# to rpc.yppasswdd daemon, but only if they are not empty. However, this 
1eaaa3
# simple logic is not supported by systemd. 
1eaaa3
# This script wraps the main binary, prepares YPPASSWDD_ARGS variable 
1eaaa3
# to include all necessary variables (ETCDIR, PASSWDFILE and SHADOWFILE)
1eaaa3
# and passes this variable to daemon. 
1eaaa3
# The script ensures, that the rpc.yppasswdd arguments are not used in case 
1eaaa3
# the appropriate environment variables are empty.
1eaaa3
1eaaa3
if [ "$ETCDIR" ]; then
1eaaa3
  YPPASSWDD_ARGS="$YPPASSWDD_ARGS -D $ETCDIR"
1eaaa3
fi
1eaaa3
1eaaa3
if [ "$PASSWDFILE" ]; then
1eaaa3
  YPPASSWDD_ARGS="$YPPASSWDD_ARGS -p $PASSWDFILE"
1eaaa3
fi
1eaaa3
1eaaa3
if [ "$SHADOWFILE" ]; then
1eaaa3
  YPPASSWDD_ARGS="$YPPASSWDD_ARGS -s $SHADOWFILE"
1eaaa3
fi
1eaaa3
1eaaa3
exec /usr/sbin/rpc.yppasswdd -f $YPPASSWDD_ARGS
1eaaa3