new nmb init script
bump up release
This commit is contained in:
parent
3ce7b6efd7
commit
21b7b94a56
116
nmb.init
Normal file
116
nmb.init
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# chkconfig: - 91 35
|
||||||
|
# description: Starts and stops the Samba smbd and nmbd daemons \
|
||||||
|
# used to provide SMB network services.
|
||||||
|
#
|
||||||
|
# pidfile: /var/run/samba/nmbd.pid
|
||||||
|
# config: /etc/samba/smb.conf
|
||||||
|
|
||||||
|
|
||||||
|
# Source function library.
|
||||||
|
if [ -f /etc/init.d/functions ] ; then
|
||||||
|
. /etc/init.d/functions
|
||||||
|
elif [ -f /etc/rc.d/init.d/functions ] ; then
|
||||||
|
. /etc/rc.d/init.d/functions
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Avoid using root's TMPDIR
|
||||||
|
unset TMPDIR
|
||||||
|
|
||||||
|
# Source networking configuration.
|
||||||
|
. /etc/sysconfig/network
|
||||||
|
|
||||||
|
if [ -f /etc/sysconfig/samba ]; then
|
||||||
|
. /etc/sysconfig/samba
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check that networking is up.
|
||||||
|
[ ${NETWORKING} = "no" ] && exit 0
|
||||||
|
|
||||||
|
# Check that smb.conf exists.
|
||||||
|
[ -f /etc/samba/smb.conf ] || exit 0
|
||||||
|
|
||||||
|
RETVAL=0
|
||||||
|
|
||||||
|
|
||||||
|
start() {
|
||||||
|
KIND="NMB"
|
||||||
|
echo -n $"Starting $KIND services: "
|
||||||
|
daemon nmbd $NMBDOPTIONS
|
||||||
|
RETVAL=$?
|
||||||
|
echo
|
||||||
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/nmb || \
|
||||||
|
RETVAL=1
|
||||||
|
return $RETVAL
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
KIND="NMB"
|
||||||
|
echo -n $"Shutting down $KIND services: "
|
||||||
|
killproc nmbd
|
||||||
|
RETVAL=$?
|
||||||
|
echo
|
||||||
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/nmb
|
||||||
|
return $RETVAL
|
||||||
|
}
|
||||||
|
|
||||||
|
restart() {
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
echo -n $"Reloading smb.conf file: "
|
||||||
|
killproc smbd -HUP
|
||||||
|
RETVAL=$?
|
||||||
|
echo
|
||||||
|
return $RETVAL
|
||||||
|
}
|
||||||
|
|
||||||
|
rhstatus() {
|
||||||
|
status nmbd
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Allow status as non-root.
|
||||||
|
if [ "$1" = status ]; then
|
||||||
|
rhstatus
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check that we can write to it... so non-root users stop here
|
||||||
|
[ -w /etc/samba/smb.conf ] || exit 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
restart
|
||||||
|
;;
|
||||||
|
reload)
|
||||||
|
reload
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
rhstatus
|
||||||
|
;;
|
||||||
|
condrestart)
|
||||||
|
[ -f /var/lock/subsys/nmb ] && restart || :
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit $?
|
25
samba.spec
25
samba.spec
@ -3,7 +3,7 @@
|
|||||||
Summary: The Samba SMB server.
|
Summary: The Samba SMB server.
|
||||||
Name: samba
|
Name: samba
|
||||||
Version: 3.0.24
|
Version: 3.0.24
|
||||||
Release: 6%{?dist}
|
Release: 7%{?dist}
|
||||||
Epoch: 0
|
Epoch: 0
|
||||||
License: GNU GPL Version 2
|
License: GNU GPL Version 2
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
@ -23,6 +23,7 @@ Source6: samba.pamd
|
|||||||
Source7: smbprint
|
Source7: smbprint
|
||||||
Source8: winbind.init
|
Source8: winbind.init
|
||||||
Source9: smb.conf.default
|
Source9: smb.conf.default
|
||||||
|
Source10: nmb.init
|
||||||
|
|
||||||
# Don't depend on Net::LDAP
|
# Don't depend on Net::LDAP
|
||||||
Source999: filter-requires-samba.sh
|
Source999: filter-requires-samba.sh
|
||||||
@ -153,6 +154,7 @@ cp %{SOURCE6} packaging/Fedora/
|
|||||||
cp %{SOURCE7} packaging/Fedora/
|
cp %{SOURCE7} packaging/Fedora/
|
||||||
cp %{SOURCE8} packaging/Fedora/winbind.init
|
cp %{SOURCE8} packaging/Fedora/winbind.init
|
||||||
cp %{SOURCE9} packaging/Fedora/
|
cp %{SOURCE9} packaging/Fedora/
|
||||||
|
cp %{SOURCE10} packaging/Fedora/
|
||||||
|
|
||||||
# Upstream patches
|
# Upstream patches
|
||||||
#(none)
|
#(none)
|
||||||
@ -274,12 +276,14 @@ install -m755 source/script/mksmbpasswd.sh $RPM_BUILD_ROOT%{_bindir}
|
|||||||
install -m644 packaging/Fedora/smbusers $RPM_BUILD_ROOT/etc/samba/smbusers
|
install -m644 packaging/Fedora/smbusers $RPM_BUILD_ROOT/etc/samba/smbusers
|
||||||
install -m755 packaging/Fedora/smbprint $RPM_BUILD_ROOT%{_bindir}
|
install -m755 packaging/Fedora/smbprint $RPM_BUILD_ROOT%{_bindir}
|
||||||
install -m755 packaging/Fedora/smb.init $RPM_BUILD_ROOT%{_initrddir}/smb
|
install -m755 packaging/Fedora/smb.init $RPM_BUILD_ROOT%{_initrddir}/smb
|
||||||
|
install -m755 packaging/Fedora/nmb.init $RPM_BUILD_ROOT%{_initrddir}/nmb
|
||||||
install -m755 packaging/Fedora/winbind.init $RPM_BUILD_ROOT%{_initrddir}/winbind
|
install -m755 packaging/Fedora/winbind.init $RPM_BUILD_ROOT%{_initrddir}/winbind
|
||||||
#ln -s ../..%{_initrddir}/smb $RPM_BUILD_ROOT%{_sbindir}/samba
|
#ln -s ../..%{_initrddir}/smb $RPM_BUILD_ROOT%{_sbindir}/samba
|
||||||
install -m644 packaging/Fedora/samba.pamd $RPM_BUILD_ROOT/etc/pam.d/samba
|
install -m644 packaging/Fedora/samba.pamd $RPM_BUILD_ROOT/etc/pam.d/samba
|
||||||
install -m644 %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/samba
|
install -m644 %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/samba
|
||||||
echo 127.0.0.1 localhost > $RPM_BUILD_ROOT%{_sysconfdir}/samba/lmhosts
|
echo 127.0.0.1 localhost > $RPM_BUILD_ROOT%{_sysconfdir}/samba/lmhosts
|
||||||
install -m644 examples/LDAP/samba.schema %{_sysconfdir}/openldap/schema/samba.schema
|
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/openldap/schema
|
||||||
|
install -m644 examples/LDAP/samba.schema $RPM_BUILD_ROOT%{_sysconfdir}/openldap/schema/samba.schema
|
||||||
|
|
||||||
# pam_smbpass
|
# pam_smbpass
|
||||||
mkdir -p $RPM_BUILD_ROOT/%{_lib}/security
|
mkdir -p $RPM_BUILD_ROOT/%{_lib}/security
|
||||||
@ -340,8 +344,10 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
#%pre
|
#%pre
|
||||||
%post
|
%post
|
||||||
/sbin/chkconfig --add smb
|
/sbin/chkconfig --add smb
|
||||||
|
/sbin/chkconfig --add nmb
|
||||||
if [ "$1" -ge "1" ]; then
|
if [ "$1" -ge "1" ]; then
|
||||||
%{_initrddir}/smb condrestart >/dev/null 2>&1
|
%{_initrddir}/smb condrestart >/dev/null 2>&1
|
||||||
|
%{_initrddir}/nmb condrestart >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
@ -349,7 +355,9 @@ exit 0
|
|||||||
if [ $1 = 0 ] ; then
|
if [ $1 = 0 ] ; then
|
||||||
#rm -rf /var/log/samba/* /var/lib/samba/*
|
#rm -rf /var/log/samba/* /var/lib/samba/*
|
||||||
%{_initrddir}/smb stop >/dev/null 2>&1
|
%{_initrddir}/smb stop >/dev/null 2>&1
|
||||||
|
%{_initrddir}/nmb stop >/dev/null 2>&1
|
||||||
/sbin/chkconfig --del smb
|
/sbin/chkconfig --del smb
|
||||||
|
/sbin/chkconfig --del nmb
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
@ -399,6 +407,14 @@ if [ $? = 0 ]; then
|
|||||||
touch /var/lock/subsys/smb
|
touch /var/lock/subsys/smb
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f /var/lock/subsys/nmb ]; then
|
||||||
|
%{_initrddir}/nmb stop >/dev/null 2>&1
|
||||||
|
# We need to stop smbd here as we are moving also smbd owned files
|
||||||
|
# but we can't restart it until the new server is installed.
|
||||||
|
# Use a dirty trick to fool condrestart later
|
||||||
|
touch /var/lock/subsys/nmb
|
||||||
|
fi
|
||||||
|
|
||||||
eval ls $NEWPATH/*.tdb >/dev/null 2>&1
|
eval ls $NEWPATH/*.tdb >/dev/null 2>&1
|
||||||
if [ $? = 0 ]; then
|
if [ $? = 0 ]; then
|
||||||
#something strange here, lets backup this stuff and avoid just wiping it
|
#something strange here, lets backup this stuff and avoid just wiping it
|
||||||
@ -444,6 +460,7 @@ exit 0
|
|||||||
%{_bindir}/eventlogadm
|
%{_bindir}/eventlogadm
|
||||||
%config(noreplace) %{_sysconfdir}/samba/smbusers
|
%config(noreplace) %{_sysconfdir}/samba/smbusers
|
||||||
%attr(755,root,root) %config %{_initrddir}/smb
|
%attr(755,root,root) %config %{_initrddir}/smb
|
||||||
|
%attr(755,root,root) %config %{_initrddir}/nmb
|
||||||
%config(noreplace) %{_sysconfdir}/logrotate.d/samba
|
%config(noreplace) %{_sysconfdir}/logrotate.d/samba
|
||||||
%config(noreplace) %{_sysconfdir}/pam.d/samba
|
%config(noreplace) %{_sysconfdir}/pam.d/samba
|
||||||
%{_mandir}/man7/samba.7*
|
%{_mandir}/man7/samba.7*
|
||||||
@ -571,9 +588,11 @@ exit 0
|
|||||||
%{_libdir}/libsmbclient.a
|
%{_libdir}/libsmbclient.a
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Mon Mar 23 2007 Simo Sorce <ssorce@redhat.com>
|
* Mon Mar 23 2007 Simo Sorce <ssorce@redhat.com> 3.0.24-7.fc7
|
||||||
- make winbindd start earlier in the init process, at the same time
|
- make winbindd start earlier in the init process, at the same time
|
||||||
ypbind is usually started as well
|
ypbind is usually started as well
|
||||||
|
- add a sepoarate init script for nmbd called nmb, we need to be able
|
||||||
|
to restart nmbd without dropping al smbd connections unnecessarily
|
||||||
|
|
||||||
* Fri Mar 23 2007 Simo Sorce <ssorce@redhat.com>
|
* Fri Mar 23 2007 Simo Sorce <ssorce@redhat.com>
|
||||||
- add samba.schema to /etc/openldap/schema
|
- add samba.schema to /etc/openldap/schema
|
||||||
|
21
smb.init
21
smb.init
@ -1,11 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# chkconfig: - 91 35
|
# chkconfig: - 91 35
|
||||||
# description: Starts and stops the Samba smbd and nmbd daemons \
|
# description: Starts and stops the Samba smbd daemon \
|
||||||
# used to provide SMB network services.
|
# used to provide SMB network services.
|
||||||
#
|
#
|
||||||
# pidfile: /var/run/samba/smbd.pid
|
# pidfile: /var/run/samba/smbd.pid
|
||||||
# pidfile: /var/run/samba/nmbd.pid
|
|
||||||
# config: /etc/samba/smb.conf
|
# config: /etc/samba/smb.conf
|
||||||
|
|
||||||
|
|
||||||
@ -43,12 +42,7 @@ start() {
|
|||||||
daemon smbd $SMBDOPTIONS
|
daemon smbd $SMBDOPTIONS
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
echo
|
||||||
KIND="NMB"
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/smb || \
|
||||||
echo -n $"Starting $KIND services: "
|
|
||||||
daemon nmbd $NMBDOPTIONS
|
|
||||||
RETVAL2=$?
|
|
||||||
echo
|
|
||||||
[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/smb || \
|
|
||||||
RETVAL=1
|
RETVAL=1
|
||||||
return $RETVAL
|
return $RETVAL
|
||||||
}
|
}
|
||||||
@ -59,12 +53,7 @@ stop() {
|
|||||||
killproc smbd
|
killproc smbd
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
echo
|
||||||
KIND="NMB"
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/smb
|
||||||
echo -n $"Shutting down $KIND services: "
|
|
||||||
killproc nmbd
|
|
||||||
RETVAL2=$?
|
|
||||||
[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && rm -f /var/lock/subsys/smb
|
|
||||||
echo ""
|
|
||||||
return $RETVAL
|
return $RETVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,9 +72,7 @@ reload() {
|
|||||||
|
|
||||||
rhstatus() {
|
rhstatus() {
|
||||||
status smbd
|
status smbd
|
||||||
RETVAL=$?
|
if [ $? -ne 0 ] ; then
|
||||||
status nmbd
|
|
||||||
if [ $? -ne 0 -o $RETVAL -ne 0 ] ; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user