git.iko.soy/typeable/nixpkgs
on master help sign in
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

commit3d240964312a30ea2b44fb99b9cc0e28a6d9823c authorArmijn Hemel <armijn@gpl-violations.org> dateWed 15 Mar 2006, 15:51 (21 years ago) parent617d06c
7 files changed+35−10
pkgs/servers/server-scripts/generic/builder.sh+7−1 pkgs/servers/server-scripts/generic/default.nix+3−1 pkgs/servers/server-scripts/generic/functions+18−3 pkgs/servers/ssh-script/builder.sh+2−2 pkgs/servers/ssh-script/sshd−1 pkgs/servers/syslog-script/builder.sh+2−2 pkgs/servers/syslog-script/syslog+3
pkgs/servers/server-scripts/generic/builder.sh+7−1
@@ -2,4 +2,10 @@ source $stdenv/setup
22
33ensureDir $out
44
5−cp $functions $out/$nicename
5+sed -e "s^@bash\@^$bash^g" \
6+ -e "s^@sshd\@^$ssh^g" \
7+ -e "s^@initscripts\@^$initscripts^g" \
8+ -e "s^@coreutils\@^$coreutils^g" \
9+ -e "s^@nixpkgs\@^$nixpkgs^g" \
10+ -e "s^@nix\@^$nix^g" \
11+ < $functions > $out/$nicename
pkgs/servers/server-scripts/generic/default.nix+3−1
@@ -1,4 +1,4 @@
1−{stdenv}:
1+{stdenv, bash, nix}:
22
33stdenv.mkDerivation {
44 name = "generic-server-script-0.0.1";
@@ -6,4 +6,6 @@ stdenv.mkDerivation {
66 nicename = "functions";
77 builder = ./builder.sh ;
88 functions = [./functions];
9+ nixpkgs = "/nixpkgs/trunk/pkgs";
10+ inherit bash nix;
911}
pkgs/servers/server-scripts/generic/functions+18−3
@@ -7,12 +7,18 @@
77
88STATEDIR=/var/run/nix-services
99RCDIR=/etc/rc.d/
10+NIXPKGS=@nixpkgs@
1011
1112## resolve $deps to real start/stop scripts first
1213
1314start_deps() {
1415 for i in $deps; do
15− $i start
16+ name=`$i/control name`
17+ if ! test -a $RCDIR/$name; then
18+ echo "blaat"
19+ fi
20+
21+ $i/control start
1622 RETVAL=$?
1723 if test $RETVAL != 0; then
1824 exit $RETVAL
@@ -23,7 +29,16 @@ start_deps() {
2329start_softdeps() {
2430 for i in $softdeps; do
2531 echo $i
26− $i start
32+
33+ name=`$i/control name`
34+ if ! test -a "$RCDIR/$name"; then
35+ echo $RCDIR/$name $i
36+ @nix@/bin/nix-env -p $RCDIR/$name -i $i
37+ fi
38+
39+ $i/control start
40+
41+ #$i start
2742 RETVAL=$?
2843 if test $RETVAL != 0; then
2944 continue
@@ -34,7 +49,7 @@ start_softdeps() {
3449start() {
3550 # are we already running?
3651 # if so, exit with code 0
37− if test -a $STATDIR/$prog; then
52+ if test -a $STATEDIR/$prog; then
3853 exit 0
3954 fi
4055 # if not, continue
pkgs/servers/ssh-script/builder.sh+2−2
@@ -7,6 +7,6 @@ sed -e "s^@bash\@^$bash^g" \
77 -e "s^@initscripts\@^$initscripts^g" \
88 -e "s^@coreutils\@^$coreutils^g" \
99 -e "s^@softdeps\@^$softdeps^g" \
10− < $script > $out/$nicename
10+ < $script > $out/control
1111
12−chmod +x $out/$nicename
12+chmod +x $out/control
pkgs/servers/ssh-script/sshd−1
@@ -109,7 +109,6 @@ stopService()
109109{
110110 echo -n $"Stopping $prog:"
111111 #killproc $SSHD -TERM
112− echo "blaat"
113112 @coreutils@/bin/kill `@coreutils@/bin/cat /var/run/sshd.pid`
114113 RETVAL=$?
115114 [ "$RETVAL" = 0 ] && @coreutils@/bin/rm -f /var/lock/subsys/sshd
pkgs/servers/syslog-script/builder.sh+2−2
@@ -6,6 +6,6 @@ sed -e "s^@bash\@^$bash^g" \
66 -e "s^@syslog\@^$syslog^g" \
77 -e "s^@nicename\@^$nicename^g" \
88 -e "s^@initscripts\@^$initscripts^g" \
9− < $script > $out/$nicename
9+ < $script > $out/control
1010
11−chmod +x $out/$nicename
11+chmod +x $out/control
pkgs/servers/syslog-script/syslog+3
@@ -54,6 +54,9 @@ case "$1" in
5454 status)
5555 status
5656 ;;
57+ name)
58+ name
59+ ;;
5760 *)
5861 echo $"Usage: $0 {start|stop|restart|reload|status}"
5962 RETVAL=1