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
This commit is contained in:
Armijn Hemel 2006-03-14 13:44:28 +00:00
parent 8befb633d6
commit 304f3fbe9d
4 changed files with 12 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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];
}

View File

@ -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