Skip to content

Commit

Permalink
add initscript
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.code.sf.net/p/ntlmaps/code/trunk@960 4414eb6b-45f7-0310-abf5-9c8861e1d96f
  • Loading branch information
mdomsch committed Apr 13, 2009
1 parent 3438932 commit e6f23a4
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 2 deletions.
99 changes: 99 additions & 0 deletions init/ntlmaps
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/bin/sh
#
# ntlmaps - NTLM Authentication Proxy
#
# chkconfig: - 98 10
# description: Proxy software that allows you \
# to authenticate via a Microsoft Proxy Server \
# using the proprietary NTLM protocol.
#
### BEGIN INIT INFO
# Provides: ntlmaps
# Required-Start: $local_fs $network $named
# Required-Stop: $local_fs $network
# Short-Description: start and stop ntlmaps daemon
# Description: Proxy software that allows you to authenticate via a
# Microsoft Proxy Server using the proprietary NTLM
# protocol.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

exec="/usr/bin/ntlmaps"
prog="ntlmaps"
lockfile=/var/lock/subsys/$prog

start() {
[ -x $exec ] || exit 5
echo -n $"Starting $prog: "
daemon $exec > /dev/null 2>&1 &
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}

stop() {
echo -n $"Stopping $prog: "
killproc ${prog}
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}

restart() {
stop
start
}

reload() {
restart
}

force_reload() {
restart
}

rh_status() {
# run checks to determine if the service is running or use generic status
status $prog
}

rh_status_q() {
rh_status >/dev/null 2>&1
}


case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?
17 changes: 16 additions & 1 deletion packaging/ntlmaps.spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Source0: http://downloads.sourceforge.net/ntlmaps/%{name}-%{version}.tar.
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: python-devel >= 1.5.2, dos2unix
BuildArch: noarch
Requires(post): chkconfig
Requires(preun): chkconfig
# This is for /sbin/service
Requires(preun): initscripts

%description
NTLM Authorization Proxy Server is a proxy software that allows you to
Expand Down Expand Up @@ -44,9 +48,20 @@ rm -rf $RPM_BUILD_ROOT
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/server.cfg
%{_bindir}/%{name}*
%{_sysconfdir}/rc.d/init.d/%{name}

%post
/sbin/chkconfig --add %{name}

%preun
if [ $1 = 0 ] ; then
/sbin/service %{name} stop >/dev/null 2>&1
/sbin/chkconfig --del %{name}
fi


%changelog
* Mon Feb 23 2009 Matt Domsch <[email protected]> - 1.0-1
* Mon Apr 13 2009 Matt Domsch <[email protected]> - 1.0-1
- minor cleanups.
- finally a 1.0 release!

Expand Down
3 changes: 2 additions & 1 deletion packaging/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
url='http://ntlmaps.sourceforge.net/',
packages=['ntlmaps'],
scripts=['scripts/ntlmaps', 'scripts/ntlmaps-hashes'],
data_files=[(serverCfgDir, ['server.cfg'])],
data_files=[(serverCfgDir, ['server.cfg']),
('/etc/rc.d/init.d', ['init/ntlmaps'])],
options = {"py2exe": {"packages": ["encodings", "win32console"],
"optimize": 2}},
)

0 comments on commit e6f23a4

Please sign in to comment.