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:
@@ -2,4 +2,10 @@ source $stdenv/setup
|
||||
|
||||
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 {
|
||||
name = "generic-server-script-0.0.1";
|
||||
@@ -6,4 +6,6 @@ stdenv.mkDerivation {
|
||||
nicename = "functions";
|
||||
builder = ./builder.sh ;
|
||||
functions = [./functions];
|
||||
nixpkgs = "/nixpkgs/trunk/pkgs";
|
||||
inherit bash nix;
|
||||
}
|
||||
|
||||
@@ -7,12 +7,18 @@
|
||||
|
||||
STATEDIR=/var/run/nix-services
|
||||
RCDIR=/etc/rc.d/
|
||||
NIXPKGS=@nixpkgs@
|
||||
|
||||
## resolve $deps to real start/stop scripts first
|
||||
|
||||
start_deps() {
|
||||
for i in $deps; do
|
||||
$i start
|
||||
name=`$i/control name`
|
||||
if ! test -a $RCDIR/$name; then
|
||||
echo "blaat"
|
||||
fi
|
||||
|
||||
$i/control start
|
||||
RETVAL=$?
|
||||
if test $RETVAL != 0; then
|
||||
exit $RETVAL
|
||||
@@ -23,7 +29,16 @@ start_deps() {
|
||||
start_softdeps() {
|
||||
for i in $softdeps; do
|
||||
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=$?
|
||||
if test $RETVAL != 0; then
|
||||
continue
|
||||
@@ -34,7 +49,7 @@ start_softdeps() {
|
||||
start() {
|
||||
# are we already running?
|
||||
# if so, exit with code 0
|
||||
if test -a $STATDIR/$prog; then
|
||||
if test -a $STATEDIR/$prog; then
|
||||
exit 0
|
||||
fi
|
||||
# if not, continue
|
||||
|
||||
Reference in New Issue
Block a user