introduce a rudimentary (working) form of the topological sort principle.
We can now start SSH with optional syslogging support. Also, if a program is not already present in the /etc/rc.d "profile" (actually, not it has become a collection of profiles) it will be automatically added. This sounds hackish, and it probably is, but also, it might be the best workable solution for now... svn path=/nixpkgs/trunk/; revision=5044
This commit is contained in:
parent
617d06c71c
commit
3d24096431
@ -2,4 +2,10 @@ source $stdenv/setup
|
|||||||
|
|
||||||
ensureDir $out
|
ensureDir $out
|
||||||
|
|
||||||
cp $functions $out/$nicename
|
sed -e "s^@bash\@^$bash^g" \
|
||||||
|
-e "s^@sshd\@^$ssh^g" \
|
||||||
|
-e "s^@initscripts\@^$initscripts^g" \
|
||||||
|
-e "s^@coreutils\@^$coreutils^g" \
|
||||||
|
-e "s^@nixpkgs\@^$nixpkgs^g" \
|
||||||
|
-e "s^@nix\@^$nix^g" \
|
||||||
|
< $functions > $out/$nicename
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{stdenv}:
|
{stdenv, bash, nix}:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "generic-server-script-0.0.1";
|
name = "generic-server-script-0.0.1";
|
||||||
@ -6,4 +6,6 @@ stdenv.mkDerivation {
|
|||||||
nicename = "functions";
|
nicename = "functions";
|
||||||
builder = ./builder.sh ;
|
builder = ./builder.sh ;
|
||||||
functions = [./functions];
|
functions = [./functions];
|
||||||
|
nixpkgs = "/nixpkgs/trunk/pkgs";
|
||||||
|
inherit bash nix;
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,18 @@
|
|||||||
|
|
||||||
STATEDIR=/var/run/nix-services
|
STATEDIR=/var/run/nix-services
|
||||||
RCDIR=/etc/rc.d/
|
RCDIR=/etc/rc.d/
|
||||||
|
NIXPKGS=@nixpkgs@
|
||||||
|
|
||||||
## resolve $deps to real start/stop scripts first
|
## resolve $deps to real start/stop scripts first
|
||||||
|
|
||||||
start_deps() {
|
start_deps() {
|
||||||
for i in $deps; do
|
for i in $deps; do
|
||||||
$i start
|
name=`$i/control name`
|
||||||
|
if ! test -a $RCDIR/$name; then
|
||||||
|
echo "blaat"
|
||||||
|
fi
|
||||||
|
|
||||||
|
$i/control start
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if test $RETVAL != 0; then
|
if test $RETVAL != 0; then
|
||||||
exit $RETVAL
|
exit $RETVAL
|
||||||
@ -23,7 +29,16 @@ start_deps() {
|
|||||||
start_softdeps() {
|
start_softdeps() {
|
||||||
for i in $softdeps; do
|
for i in $softdeps; do
|
||||||
echo $i
|
echo $i
|
||||||
$i start
|
|
||||||
|
name=`$i/control name`
|
||||||
|
if ! test -a "$RCDIR/$name"; then
|
||||||
|
echo $RCDIR/$name $i
|
||||||
|
@nix@/bin/nix-env -p $RCDIR/$name -i $i
|
||||||
|
fi
|
||||||
|
|
||||||
|
$i/control start
|
||||||
|
|
||||||
|
#$i start
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if test $RETVAL != 0; then
|
if test $RETVAL != 0; then
|
||||||
continue
|
continue
|
||||||
@ -34,7 +49,7 @@ start_softdeps() {
|
|||||||
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; then
|
if test -a $STATEDIR/$prog; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
# if not, continue
|
# if not, continue
|
||||||
|
@ -7,6 +7,6 @@ sed -e "s^@bash\@^$bash^g" \
|
|||||||
-e "s^@initscripts\@^$initscripts^g" \
|
-e "s^@initscripts\@^$initscripts^g" \
|
||||||
-e "s^@coreutils\@^$coreutils^g" \
|
-e "s^@coreutils\@^$coreutils^g" \
|
||||||
-e "s^@softdeps\@^$softdeps^g" \
|
-e "s^@softdeps\@^$softdeps^g" \
|
||||||
< $script > $out/$nicename
|
< $script > $out/control
|
||||||
|
|
||||||
chmod +x $out/$nicename
|
chmod +x $out/control
|
||||||
|
@ -109,7 +109,6 @@ stopService()
|
|||||||
{
|
{
|
||||||
echo -n $"Stopping $prog:"
|
echo -n $"Stopping $prog:"
|
||||||
#killproc $SSHD -TERM
|
#killproc $SSHD -TERM
|
||||||
echo "blaat"
|
|
||||||
@coreutils@/bin/kill `@coreutils@/bin/cat /var/run/sshd.pid`
|
@coreutils@/bin/kill `@coreutils@/bin/cat /var/run/sshd.pid`
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
[ "$RETVAL" = 0 ] && @coreutils@/bin/rm -f /var/lock/subsys/sshd
|
[ "$RETVAL" = 0 ] && @coreutils@/bin/rm -f /var/lock/subsys/sshd
|
||||||
|
@ -6,6 +6,6 @@ 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" \
|
-e "s^@initscripts\@^$initscripts^g" \
|
||||||
< $script > $out/$nicename
|
< $script > $out/control
|
||||||
|
|
||||||
chmod +x $out/$nicename
|
chmod +x $out/control
|
||||||
|
@ -54,6 +54,9 @@ case "$1" in
|
|||||||
status)
|
status)
|
||||||
status
|
status
|
||||||
;;
|
;;
|
||||||
|
name)
|
||||||
|
name
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo $"Usage: $0 {start|stop|restart|reload|status}"
|
echo $"Usage: $0 {start|stop|restart|reload|status}"
|
||||||
RETVAL=1
|
RETVAL=1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user