fix some brainfarts
svn path=/nixpkgs/trunk/; revision=5021
This commit is contained in:
parent
742c1ef85e
commit
6562861ba4
5
pkgs/servers/server-scripts/generic/builder.sh
Normal file
5
pkgs/servers/server-scripts/generic/builder.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
source $stdenv/setup
|
||||||
|
|
||||||
|
ensureDir $out
|
||||||
|
|
||||||
|
cp $functions $out/$nicename
|
9
pkgs/servers/server-scripts/generic/default.nix
Normal file
9
pkgs/servers/server-scripts/generic/default.nix
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{stdenv}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "generic-server-script-0.0.1";
|
||||||
|
server = "generic";
|
||||||
|
nicename = "functions";
|
||||||
|
builder = ./builder.sh ;
|
||||||
|
functions = [./functions];
|
||||||
|
}
|
@ -11,31 +11,36 @@ RCDIR=/etc/rc.d/
|
|||||||
## resolve $deps to real start/stop scripts first
|
## resolve $deps to real start/stop scripts first
|
||||||
|
|
||||||
start_deps() {
|
start_deps() {
|
||||||
for i in $deps
|
for i in $deps; do
|
||||||
$i start
|
$i start
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if test $RETVAL != 0; then
|
if test $RETVAL != 0; then
|
||||||
exit $RETVAL
|
exit $RETVAL
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
start_softdeps() {
|
start_softdeps() {
|
||||||
for i in $softdeps
|
for i in $softdeps; do
|
||||||
$i start
|
$i start
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if test $RETVAL != 0; then
|
if test $RETVAL != 0; then
|
||||||
continue
|
continue
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
# are we already running?
|
# are we already running?
|
||||||
# if so, exit with code 0
|
# if so, exit with code 0
|
||||||
if test -a $STATDIR/$prog = 1; then
|
if test -a $STATDIR/$prog; then
|
||||||
exit 0
|
exit 0
|
||||||
|
fi
|
||||||
# if not, continue
|
# if not, continue
|
||||||
# launch all hard dependencies
|
# launch all hard dependencies
|
||||||
start_deps
|
#start_deps
|
||||||
# launch all preferred dependencies
|
# launch all preferred dependencies
|
||||||
start_softdeps
|
#start_softdeps
|
||||||
# launch our own program
|
# launch our own program
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,6 +48,7 @@ stop() {
|
|||||||
# are we running? If so, then stop, otherwise, do nothing...
|
# are we running? If so, then stop, otherwise, do nothing...
|
||||||
if test -a $STATDIR/$prog = 0; then
|
if test -a $STATDIR/$prog = 0; then
|
||||||
exit 0
|
exit 0
|
||||||
|
fi
|
||||||
# stop our own program
|
# stop our own program
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,3 +59,12 @@ register() {
|
|||||||
unregister() {
|
unregister() {
|
||||||
rm $STATEDIR/$prog
|
rm $STATEDIR/$prog
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status() {
|
||||||
|
# are we running? If so, report
|
||||||
|
if test -a $STATDIR/$prog; then
|
||||||
|
echo "running"
|
||||||
|
else
|
||||||
|
echo "stopped"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
@ -5,6 +5,7 @@ ensureDir $out
|
|||||||
sed -e "s^@bash\@^$bash^g" \
|
sed -e "s^@bash\@^$bash^g" \
|
||||||
-e "s^@syslog\@^$syslog^g" \
|
-e "s^@syslog\@^$syslog^g" \
|
||||||
-e "s^@nicename\@^$nicename^g" \
|
-e "s^@nicename\@^$nicename^g" \
|
||||||
|
-e "s^@initscripts\@^$initscripts^g" \
|
||||||
< $script > $out/$nicename
|
< $script > $out/$nicename
|
||||||
|
|
||||||
chmod +x $out/$nicename
|
chmod +x $out/$nicename
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
{stdenv, bash, syslog}:
|
{stdenv, bash, syslog, initscripts}:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "syslog-script-0.0.1";
|
name = "syslog-script-0.0.1";
|
||||||
server = "syslog";
|
server = "syslog";
|
||||||
nicename = "syslog";
|
nicename = "syslog";
|
||||||
builder = ./builder.sh ;
|
builder = ./builder.sh ;
|
||||||
inherit bash syslog;
|
inherit bash syslog initscripts;
|
||||||
script = [./syslog];
|
script = [./syslog];
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
# processname: sshd
|
# processname: sshd
|
||||||
|
|
||||||
# source function library
|
# source function library
|
||||||
#. @initscripts@/etc/rc.d/init.d/functions
|
source @initscripts@/functions
|
||||||
|
|
||||||
# pull in sysconfig settings
|
# pull in sysconfig settings
|
||||||
#[ -f /etc/sysconfig/sshd ] && . /etc/sysconfig/sshd
|
#[ -f /etc/sysconfig/sshd ] && . /etc/sysconfig/sshd
|
||||||
@ -16,23 +16,23 @@
|
|||||||
RETVAL=0
|
RETVAL=0
|
||||||
prog=@nicename@
|
prog=@nicename@
|
||||||
|
|
||||||
start()
|
startService()
|
||||||
{
|
{
|
||||||
# just do networking
|
# just do networking
|
||||||
echo -n $"Starting $prog:"
|
echo -n "Starting $prog:"
|
||||||
@syslog@/usr/sbin/syslogd
|
@syslog@/usr/sbin/syslogd
|
||||||
@syslog@/usr/sbin/klogd
|
@syslog@/usr/sbin/klogd
|
||||||
}
|
}
|
||||||
|
|
||||||
stop()
|
stopService()
|
||||||
{
|
{
|
||||||
echo -n $"Stopping $prog:"
|
echo -n "Stopping $prog:"
|
||||||
}
|
}
|
||||||
|
|
||||||
reload()
|
reloadService()
|
||||||
{
|
{
|
||||||
start
|
|
||||||
stop
|
stop
|
||||||
|
start
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -50,7 +50,7 @@ case "$1" in
|
|||||||
reload
|
reload
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
echo "all OK"
|
status
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo $"Usage: $0 {start|stop|restart|reload|status}"
|
echo $"Usage: $0 {start|stop|restart|reload|status}"
|
||||||
|
Loading…
Reference in New Issue
Block a user