Author: sandervanderburg
Date: Fri Oct 15 22:33:31 2010
New Revision: 24311
URL: https://svn.nixos.org/websvn/nix/?rev=24311&sc=1
Log:
disnix-ssh-client should also be processed by autoconf so that the path to the
checks script can be found
Added:
disnix/disnix/trunk/scripts/disnix-ssh-client.in
- copied unchanged from r24309,
disnix/disnix/trunk/scripts/disnix-ssh-client
Deleted:
disnix/disnix/trunk/scripts/disnix-ssh-client
Modified:
disnix/disnix/trunk/configure.ac
disnix/disnix/trunk/scripts/Makefile.am
Modified: disnix/disnix/trunk/configure.ac
==============================================================================
--- disnix/disnix/trunk/configure.ac Fri Oct 15 22:14:38 2010 (r24310)
+++ disnix/disnix/trunk/configure.ac Fri Oct 15 22:33:31 2010 (r24311)
@@ -95,6 +95,7 @@
scripts/disnix-instantiate
scripts/disnix-manifest
scripts/disnix-gendist-roundrobin
+scripts/disnix-ssh-client
doc/Makefile
doc/manual/Makefile
])
Modified: disnix/disnix/trunk/scripts/Makefile.am
==============================================================================
--- disnix/disnix/trunk/scripts/Makefile.am Fri Oct 15 22:14:38 2010
(r24310)
+++ disnix/disnix/trunk/scripts/Makefile.am Fri Oct 15 22:33:31 2010
(r24311)
@@ -1,4 +1,4 @@
bin_SCRIPTS = disnix-instantiate disnix-manifest disnix-gendist-roundrobin
disnix-copy-closure disnix-env disnix-ssh-client
pkgdata_SCRIPTS = checks
-EXTRA_DIST = checks disnix-instantiate.in disnix-manifest.in
disnix-gendist-roundrobin.in disnix-copy-closure.in disnix-env.in
disnix-ssh-client
+EXTRA_DIST = checks disnix-instantiate.in disnix-manifest.in
disnix-gendist-roundrobin.in disnix-copy-closure.in disnix-env.in
disnix-ssh-client.in
Copied: disnix/disnix/trunk/scripts/disnix-ssh-client.in (from r24309,
disnix/disnix/trunk/scripts/disnix-ssh-client)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ disnix/disnix/trunk/scripts/disnix-ssh-client.in Fri Oct 15 22:33:31
2010 (r24311, copy of r24309,
disnix/disnix/trunk/scripts/disnix-ssh-client)
@@ -0,0 +1,230 @@
+#!/bin/bash -e
+# Disnix - A distributed application layer for Nix
+# Copyright (C) 2008-2010 Sander van der Burg
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
+
+showUsage()
+{
+ echo "Usage:"
+ echo "$0 {[--target | -t ] hostname[:port] {operation}"
+ echo
+ echo "Operations:"
+ echo " --import [--localfile|--remotefile] derivations"
+ echo " --export [--localfile|--remotefile] derivations"
+ echo " --print-invalid derivations"
+ echo " {-r|--realise} derivations"
+ echo " --set [{-p|--profile} name] derivation"
+ echo " {-q|--query-installed} [{-p|--profile} name]"
+ echo " --query-requisites derivations"
+ echo " --collect-garbage [{-d|--delete-old}]\n"
+ echo " --activate --type type --arguments arguments derivation"
+ echo " --deactivate --type type --arguments arguments derivation"
+ echo " --lock [{-p|--profile} profile]"
+ echo " --unlock [{-p|--profile} profile]"
+ echo " {-h | --help}"
+}
+
+# Autoconf settings
+
+export pref...@prefix@
+
+# Import checks
+
+source @datadir@/@PACKAGE@/checks
+
+# Parse valid argument options
+
+PARAMS=`getopt -n $0 -o rqp:d -l
import,export,print-invalid,realise,set,query-installed,query-requisites,collect-garbage,activate,deactivate,lock,unlock,target:,localfile,remotefile,profile:,delete-old,type:,arguments:,help
-- "$@"`
+
+if [ $? != 0 ]
+then
+ showUsage
+ exit 1
+fi
+
+eval set -- "$PARAMS"
+
+# Evaluate valid options
+
+while [ "$1" != "--" ]
+do
+ case "$1" in
+ --import)
+ operation="import";
+ ;;
+ --export)
+ operation="export";
+ ;;
+ --print-invalid)
+ operation="print-invalid";
+ ;;
+ -r|--realise)
+ operation="realise";
+ ;;
+ --set)
+ operation="set";
+ ;;
+ -q|--query-installed)
+ operation="query-installed";
+ ;;
+ --query-requisites)
+ operation="query-requisites";
+ ;;
+ --collect-garbage)
+ operation="collect-garbage";
+ ;;
+ --activate)
+ operation="activate";
+ path=$2
+ ;;
+ --deactivate)
+ operation="deactivate";
+ path=$2
+ ;;
+ --lock)
+ operation="lock";
+ path=$2
+ ;;
+ --unlock)
+ operation="unlock";
+ path=$2
+ ;;
+ --target)
+ target=$2
+ ;;
+ --localfile)
+ localfile=1
+ ;;
+ --remotefile)
+ remotefile=1
+ ;;
+ -p|--profile)
+ profileArg="--profile $2"
+ ;;
+ -d|--delete-old)
+ deleteOldArg="-d"
+ ;;
+ --type)
+ type=$2
+ ;;
+ --arguments)
+ argsArg="$argsArg --arguments \"$2\""
+ ;;
+ -h|--help)
+ showUsage
+ exit 0
+ ;;
+ esac
+
+ shift
+done
+
+shift
+
+# Validate the given options
+
+checkTarget
+
+targetHostname=${target%%:*}
+targetPort=${target#*:}
+
+if [ "$targetPort" = "$targetHostname" ]
+then
+ targetPort=22
+fi
+
+checkTmpDir
+
+# Execute selected operation
+
+case "$operation" in
+ import)
+ if [ "$localfile" != "1" ] && [ "$remotefile" != "1" ]
+ then
+ echo "ERROR: Either a remote or a localfile must be specified!" >&2
+ exit 1
+ fi
+
+ # A localfile must first be transferred
+ if [ "$localfile" != "" ]
+ then
+ remotefile=`ssh -p $targetPort $SSH_OPTS $targetHostname mktemp -p
$TMPDIR`
+ scp -P $targetPort $SSH_OPTS "$@" $targetHostname:$remotefile
+ fi
+
+ # Import the closure into the Nix store
+ ssh -p $targetPort $SSH_OPTS $targetHostname disnix-client --import
$remotefile
+ ;;
+ export)
+ if [ "$localfile" != "1" ] && [ "$remotefile" != "1" ]
+ then
+ echo "ERROR: Either a remote or a localfile must be specified!" >&2
+ exit 1
+ fi
+
+ closure=`ssh -p $targetPort $SSH_OPTS $targetHostname disnix-client
--export $...@`
+
+ # A remote file must be downloaded afterwards
+ if [ "$remotefile" = "1" ]
+ then
+ localClosure=`mktemp -p $TMPDIR`
+ scp -P $targetPort $SSH_OPTS $targetHostname:$closure $localClosure
+ echo $localClosure
+ fi
+ ;;
+ print-invalid)
+ ssh -p $targetPort $SSH_OPTS $targetHostname disnix-client
--print-invalid "$@"
+ ;;
+ realise)
+ ssh -p $targetPort $SSH_OPTS $targetHostname disnix-client --realise
"$@"
+ ;;
+ set)
+ ssh -p $targetPort $SSH_OPTS $targetHostname disnix-client $profileArg
--set "$@"
+ ;;
+ query-installed)
+ ssh -p $targetPort $SSH_OPTS $targetHostname disnix-client $profileArg
--query-installed "$@"
+ ;;
+ query-requisites)
+ ssh -p $targetPort $SSH_OPTS $targetHostname disnix-client
--query-requisites "$@"
+ ;;
+ collect-garbage)
+ ssh -p $targetPort $SSH_OPTS $targetHostname disnix-client
--collect-garbage $deleteOldArg "$@"
+ ;;
+ activate)
+ if [ "$type" = "" ]
+ then
+ echo "ERROR: A type must be specified!" >&2
+ exit 1
+ fi
+
+ ssh -p $targetPort $SSH_OPTS $targetHostname disnix-client --type $type
$argsArg --activate "$@"
+ ;;
+ deactivate)
+ if [ "$type" = "" ]
+ then
+ echo "ERROR: A type must be specified!" >&2
+ exit 1
+ fi
+
+ ssh -p $targetPort $SSH_OPTS $targetHostname disnix-client --type $type
$argsArg --deactivate "$@"
+ ;;
+ lock)
+ ssh -p $targetPort $SSH_OPTS $targetHostname disnix-client --lock
$profileArg
+ ;;
+ unlock)
+ ssh -p $targetPort $SSH_OPTS $targetHostname disnix-client --unlock
$profileArg
+ ;;
+esac
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits