Fix ypbind script in dos format - bash syntax errors

This commit is contained in:
vcrhonek 2009-02-26 14:57:09 +00:00
parent 212b748498
commit 5bbe06bbb0
2 changed files with 102 additions and 98 deletions

194
nis.sh
View File

@ -1,97 +1,97 @@
#!/bin/bash #!/bin/bash
# #
# nis.sh: dhclient-script plugin for NIS settings, # nis.sh: dhclient-script plugin for NIS settings,
# place in /etc/dhcp/dhclient.d and 'chmod +x nis.sh' to enable # place in /etc/dhcp/dhclient.d and 'chmod +x nis.sh' to enable
# #
# Copyright (C) 2008 Red Hat, Inc. # Copyright (C) 2008 Red Hat, Inc.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# Author(s): David Cantrell <dcantrell@redhat.com> # Author(s): David Cantrell <dcantrell@redhat.com>
# #
CONF=/etc/yp.conf CONF=/etc/yp.conf
save_config_file() { save_config_file() {
origfile="${1}" origfile="${1}"
savefile="${SAVEDIR}/${origfile##*/}.predhclient.${interface}" savefile="${SAVEDIR}/${origfile##*/}.predhclient.${interface}"
if [ ! -d ${SAVEDIR} ]; then if [ ! -d ${SAVEDIR} ]; then
mkdir -p ${SAVEDIR} mkdir -p ${SAVEDIR}
fi fi
if [ -e ${origfile} ]; then if [ -e ${origfile} ]; then
mv ${origfile} ${savefile} mv ${origfile} ${savefile}
else else
echo > ${savefile} echo > ${savefile}
fi fi
restorecon ${savefile} >/dev/null 2>&1 restorecon ${savefile} >/dev/null 2>&1
} }
nis_config() { nis_config() {
if [ ! "${PEERNIS}" = "no" ]; then if [ ! "${PEERNIS}" = "no" ]; then
if [ -n "${new_nis_domain}" ]; then if [ -n "${new_nis_domain}" ]; then
domainname "${new_nis_domain}" domainname "${new_nis_domain}"
save_config_file ${CONF} save_config_file ${CONF}
let contents=0 let contents=0
echo '# generated by /sbin/dhclient-script' > ${CONF} echo '# generated by /sbin/dhclient-script' > ${CONF}
if [ -n "${new_nis_servers}" ]; then if [ -n "${new_nis_servers}" ]; then
for i in ${new_nis_servers} ; do for i in ${new_nis_servers} ; do
echo "domain ${new_nis_domain} server ${i}" >> ${CONF} echo "domain ${new_nis_domain} server ${i}" >> ${CONF}
let contents=contents+1 let contents=contents+1
done done
else else
echo "domain ${new_nis_domain} broadcast" >> ${CONF} echo "domain ${new_nis_domain} broadcast" >> ${CONF}
let contents=contents+1 let contents=contents+1
fi fi
if [ ${contents} -gt 0 ]; then if [ ${contents} -gt 0 ]; then
if [ -x /etc/rc.d/init.d/ypbind ] && if [ -x /etc/rc.d/init.d/ypbind ] &&
[ -r /var/run/ypbind.pid ]; then [ -r /var/run/ypbind.pid ]; then
service ypbind restart >/dev/null 2>&1 service ypbind restart >/dev/null 2>&1
fi fi
fi fi
elif [ -n "${new_nis_servers}" ]; then elif [ -n "${new_nis_servers}" ]; then
save_config_file ${CONF} save_config_file ${CONF}
echo '# generated by /sbin/dhclient-script' > ${CONF} echo '# generated by /sbin/dhclient-script' > ${CONF}
let contents=0 let contents=0
for i in ${new_nis_servers} ; do for i in ${new_nis_servers} ; do
echo "ypserver ${i}" >> ${CONF} echo "ypserver ${i}" >> ${CONF}
let contents=contents+1 let contents=contents+1
done done
if [ $contents -gt 0 ]; then if [ $contents -gt 0 ]; then
if [ -x /etc/rc.d/init.d/ypbind ] && if [ -x /etc/rc.d/init.d/ypbind ] &&
[ -r /var/run/ypbind.pid ]; then [ -r /var/run/ypbind.pid ]; then
service ypbind restart >/dev/null 2>&1 service ypbind restart >/dev/null 2>&1
fi fi
fi fi
fi fi
fi fi
} }
nis_restore() { nis_restore() {
if [ ! "${PEERNIS}" = "no" ]; then if [ ! "${PEERNIS}" = "no" ]; then
if [ -f ${SAVEDIR}/${CONF}.predhclient.${interface} ]; then if [ -f ${SAVEDIR}/${CONF}.predhclient.${interface} ]; then
rm -f ${CONF} rm -f ${CONF}
mv -f ${SAVEDIR}/${CONF}.predhclient.${interface} ${CONF} mv -f ${SAVEDIR}/${CONF}.predhclient.${interface} ${CONF}
if [ -x /etc/rc.d/init.d/ypbind ] && [ -r /var/run/ypbind.pid ]; then if [ -x /etc/rc.d/init.d/ypbind ] && [ -r /var/run/ypbind.pid ]; then
service ypbind restart >/dev/null 2>&1 service ypbind restart >/dev/null 2>&1
fi fi
fi fi
fi fi
} }

View File

@ -1,7 +1,7 @@
Summary: The NIS daemon which binds NIS clients to an NIS domain Summary: The NIS daemon which binds NIS clients to an NIS domain
Name: ypbind Name: ypbind
Version: 1.20.4 Version: 1.20.4
Release: 15%{?dist} Release: 16%{?dist}
License: GPLv2 License: GPLv2
Group: System Environment/Daemons Group: System Environment/Daemons
Source0: ftp://ftp.us.kernel.org/pub/linux/utils/net/NIS/ypbind-mt-%{version}.tar.bz2 Source0: ftp://ftp.us.kernel.org/pub/linux/utils/net/NIS/ypbind-mt-%{version}.tar.bz2
@ -97,6 +97,10 @@ fi
%doc README NEWS %doc README NEWS
%changelog %changelog
* Thu Feb 26 2009 Vitezslav Crhonek <vcrhonek@redhat.com> - 3:1.20.4-16
- Fix ypbind script in dos format - bash syntax errors
Resolves: #486722
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3:1.20.4-15 * Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3:1.20.4-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild