forked from mirrors/nixpkgs
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
|
||||
|
||||
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
|
||||
|
|
|
@ -7,6 +7,6 @@ sed -e "s^@bash\@^$bash^g" \
|
|||
-e "s^@initscripts\@^$initscripts^g" \
|
||||
-e "s^@coreutils\@^$coreutils^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:"
|
||||
#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
|
||||
|
|
|
@ -6,6 +6,6 @@ sed -e "s^@bash\@^$bash^g" \
|
|||
-e "s^@syslog\@^$syslog^g" \
|
||||
-e "s^@nicename\@^$nicename^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
|
||||
;;
|
||||
name)
|
||||
name
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart|reload|status}"
|
||||
RETVAL=1
|
||||
|
|
Loading…
Reference in a new issue