From 304f3fbe9dc7aae249981d395ae8b80f60a1d072 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Tue, 14 Mar 2006 13:44:28 +0000 Subject: [PATCH] some small changes...probably the way it is done now (declaring the dependencies, such as "networking" in Nix expressions) is not entirely right, at least, trying to start them from for example this SSH script is not the right way. A cleaner solution is being developed :) svn path=/nixpkgs/trunk/; revision=5034 --- pkgs/servers/server-scripts/generic/functions | 4 +++- pkgs/servers/ssh-script/builder.sh | 1 + pkgs/servers/ssh-script/default.nix | 4 +++- pkgs/servers/ssh-script/sshd | 6 +++++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/server-scripts/generic/functions b/pkgs/servers/server-scripts/generic/functions index 42b13704ae4..6ed24b3d758 100644 --- a/pkgs/servers/server-scripts/generic/functions +++ b/pkgs/servers/server-scripts/generic/functions @@ -22,6 +22,7 @@ start_deps() { start_softdeps() { for i in $softdeps; do + echo $i $i start RETVAL=$? if test $RETVAL != 0; then @@ -40,7 +41,8 @@ start() { # launch all hard dependencies #start_deps # launch all preferred dependencies - #start_softdeps + echo "softdeps" $softdeps + start_softdeps # launch our own program startService # if successful, then register diff --git a/pkgs/servers/ssh-script/builder.sh b/pkgs/servers/ssh-script/builder.sh index 4969616a352..a041a00118c 100644 --- a/pkgs/servers/ssh-script/builder.sh +++ b/pkgs/servers/ssh-script/builder.sh @@ -6,6 +6,7 @@ sed -e "s^@bash\@^$bash^g" \ -e "s^@sshd\@^$ssh^g" \ -e "s^@initscripts\@^$initscripts^g" \ -e "s^@coreutils\@^$coreutils^g" \ + -e "s^@softdeps\@^$softdeps^g" \ < $script > $out/$nicename chmod +x $out/$nicename diff --git a/pkgs/servers/ssh-script/default.nix b/pkgs/servers/ssh-script/default.nix index a681a6b76c4..03897e26b35 100644 --- a/pkgs/servers/ssh-script/default.nix +++ b/pkgs/servers/ssh-script/default.nix @@ -1,10 +1,12 @@ -{stdenv, ssh, bash, initscripts, coreutils, key ? null}: +{stdenv, ssh, bash, initscripts, coreutils, key ? null, syslog ? null, networking}: stdenv.mkDerivation { name = "ssh-script-0.0.1"; nicename = "sshd"; server = "ssh"; builder = ./builder.sh ; + softdeps = [syslog]; + deps = [networking]; inherit bash ssh initscripts coreutils; script = [./sshd]; } diff --git a/pkgs/servers/ssh-script/sshd b/pkgs/servers/ssh-script/sshd index 744bb49abc9..5668f8f9c23 100755 --- a/pkgs/servers/ssh-script/sshd +++ b/pkgs/servers/ssh-script/sshd @@ -21,6 +21,8 @@ source @initscripts@/functions RETVAL=0 prog="sshd" +softdeps="@softdeps@" + # Some functions to make the below more readable KEYGEN=@sshd@/bin/ssh-keygen SSHD=@sshd@/sbin/sshd @@ -106,7 +108,9 @@ startService() stopService() { echo -n $"Stopping $prog:" - killproc $SSHD -TERM + #killproc $SSHD -TERM + echo "blaat" + @coreutils@/bin/kill `@coreutils@/bin/cat /var/run/sshd.pid` RETVAL=$? [ "$RETVAL" = 0 ] && @coreutils@/bin/rm -f /var/lock/subsys/sshd echo