Merge invirt-remote-host and invirt-remote-server into invirt-remote
[invirt/packages/invirt-remote.git] / host / usr / sbin / invirt-remote
diff --git a/host/usr/sbin/invirt-remote b/host/usr/sbin/invirt-remote
new file mode 100755 (executable)
index 0000000..8511f60
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+# invirt-remote TYPE SERVICE [ARGS...]
+#
+# We carry out the remctl command proxied to us by the remote-control server.
+
+TYPE="$1"
+SERVICE="$2"
+shift; shift;
+
+case "$TYPE" in
+    control)
+        # $SERVICE is hostname
+        COMMAND=/usr/sbin/invirt-vmcontrol
+       ;;
+    web)
+        case "$SERVICE" in
+            lvcreate|lvremove|lvrename|lvresize)
+                COMMAND=/usr/sbin/invirt-lvm
+               ;;
+            listvms)
+                COMMAND=/usr/sbin/invirt-listvms
+               ;;
+           info)
+               COMMAND=/usr/sbin/xm
+               ;;
+            vnccert)
+                COMMAND=/usr/bin/invirt-vnc-getcert
+                ;;
+            *)
+                echo "ERROR: invalid subcommand"
+                exit 34
+                ;;
+        esac
+       ;;
+    *)
+        echo "ERROR: invalid command"
+        exit 34
+        ;;
+esac
+
+$COMMAND "$SERVICE" "$@"