diff --git a/appvm/qrun-in-vm b/appvm/qrun-in-vm new file mode 100755 index 0000000..6b2e1bb --- /dev/null +++ b/appvm/qrun-in-vm @@ -0,0 +1,4 @@ +#!/bin/sh +# pass aguments to the remote stdin, shovel back the remote output +echo "$@" +exec /bin/cat >&$SAVED_FD_1 diff --git a/appvm/qubes.VMShell b/appvm/qubes.VMShell new file mode 100644 index 0000000..7ca3b5e --- /dev/null +++ b/appvm/qubes.VMShell @@ -0,0 +1 @@ +/usr/lib/qubes/vm-shell \ No newline at end of file diff --git a/appvm/qubes.VMShell.policy b/appvm/qubes.VMShell.policy new file mode 100644 index 0000000..4121733 --- /dev/null +++ b/appvm/qubes.VMShell.policy @@ -0,0 +1,7 @@ +## Note that policy parsing stops at the first match, +## so adding anything below "$anyvm $anyvm action" line will have no effect + +## Please use a single # to start your custom comments + +$anyvm $dispvm allow +$anyvm $anyvm ask diff --git a/appvm/qvm-open-in-dvm2 b/appvm/qvm-open-in-dvm2 index 25e8904..2e04aaf 100755 --- a/appvm/qvm-open-in-dvm2 +++ b/appvm/qvm-open-in-dvm2 @@ -25,4 +25,7 @@ if ! [ $# = 1 ] ; then exit 1 fi -exec /usr/lib/qubes/qrexec_client_vm '$dispvm' qubes.OpenInVM "/usr/lib/qubes/qopen-in-vm" "$1" +. /usr/lib/qubes/wrap_in_html_if_url.sh +wrap_in_html_if_url "$1" + +exec /usr/lib/qubes/qrexec_client_vm '$dispvm' qubes.OpenInVM "/usr/lib/qubes/qopen-in-vm" "$FILE_ARGUMENT" diff --git a/appvm/qvm-open-in-vm b/appvm/qvm-open-in-vm index ffd087e..5751270 100755 --- a/appvm/qvm-open-in-vm +++ b/appvm/qvm-open-in-vm @@ -24,5 +24,6 @@ if ! [ $# = 2 ] ; then echo "Usage: $0 vmname filename" exit 1 fi - -exec /usr/lib/qubes/qrexec_client_vm "$1" qubes.OpenInVM "/usr/lib/qubes/qopen-in-vm" "$2" +. /usr/lib/qubes/wrap_in_html_if_url.sh +wrap_in_html_if_url "$2" +exec /usr/lib/qubes/qrexec_client_vm "$1" qubes.OpenInVM "/usr/lib/qubes/qopen-in-vm" "$FILE_ARGUMENT" diff --git a/appvm/qvm-run b/appvm/qvm-run new file mode 100755 index 0000000..54e296f --- /dev/null +++ b/appvm/qvm-run @@ -0,0 +1,32 @@ +#!/bin/bash +# +# The Qubes OS Project, http://www.qubes-os.org +# +# Copyright (C) 2010 Rafal Wojtczuk +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# + +if [ $# -lt 2 ] ; then + echo "Usage: $0 vmname command arguments" + exit 1 +fi +VMNAME=$1 +shift +if [ $VMNAME = "--dispvm" ] ; then + VMNAME='$dispvm' +fi +exec /usr/lib/qubes/qrexec_client_vm $VMNAME qubes.VMShell "/usr/lib/qubes/qrun-in-vm" "$@" diff --git a/appvm/vm-shell b/appvm/vm-shell new file mode 100755 index 0000000..d06e398 --- /dev/null +++ b/appvm/vm-shell @@ -0,0 +1,3 @@ +#!/bin/sh +# just ignore the cmdline argument (the remote vm name) +exec /bin/bash diff --git a/appvm/wrap_in_html_if_url.sh b/appvm/wrap_in_html_if_url.sh new file mode 100644 index 0000000..12d9225 --- /dev/null +++ b/appvm/wrap_in_html_if_url.sh @@ -0,0 +1,17 @@ +wrap_in_html_if_url() +{ + case "$1" in + *://*) + FILE_ARGUMENT=$(mktemp) + + echo -n '> $FILE_ARGUMENT + echo '">' >> $FILE_ARGUMENT + ;; + *) + FILE_ARGUMENT="$1" + ;; + esac +} + + \ No newline at end of file diff --git a/rpm_spec/core-appvm.spec b/rpm_spec/core-appvm.spec index 5822770..5b26f83 100644 --- a/rpm_spec/core-appvm.spec +++ b/rpm_spec/core-appvm.spec @@ -77,13 +77,16 @@ mkdir -p $RPM_BUILD_ROOT/usr/bin cp qubes_timestamp qvm-open-in-dvm2 $RPM_BUILD_ROOT/usr/bin cp qvm-open-in-vm $RPM_BUILD_ROOT/usr/bin cp qvm-copy-to-vm $RPM_BUILD_ROOT/usr/bin +cp qvm-run $RPM_BUILD_ROOT/usr/bin mkdir -p $RPM_BUILD_ROOT/usr/lib/qubes +cp wrap_in_html_if_url.sh $RPM_BUILD_ROOT/usr/lib/qubes cp qvm-copy-to-vm2.kde $RPM_BUILD_ROOT/usr/lib/qubes cp qvm-copy-to-vm2.gnome $RPM_BUILD_ROOT/usr/lib/qubes cp ../qrexec/qrexec_agent $RPM_BUILD_ROOT/usr/lib/qubes cp ../qrexec/qrexec_client_vm $RPM_BUILD_ROOT/usr/lib/qubes cp ../qrexec/qubes_rpc_multiplexer $RPM_BUILD_ROOT/usr/lib/qubes cp vm-file-editor qfile-agent qopen-in-vm qfile-unpacker $RPM_BUILD_ROOT/usr/lib/qubes +cp vm-shell qrun-in-vm $RPM_BUILD_ROOT/usr/lib/qubes cp ../common/meminfo-writer $RPM_BUILD_ROOT/usr/lib/qubes mkdir -p $RPM_BUILD_ROOT/%{kde_service_dir} cp qvm-copy.desktop qvm-dvm.desktop $RPM_BUILD_ROOT/%{kde_service_dir} @@ -91,6 +94,7 @@ mkdir -p $RPM_BUILD_ROOT/mnt/removable mkdir -p $RPM_BUILD_ROOT/etc/qubes_rpc cp qubes.Filecopy $RPM_BUILD_ROOT/etc/qubes_rpc cp qubes.OpenInVM $RPM_BUILD_ROOT/etc/qubes_rpc +cp qubes.VMShell $RPM_BUILD_ROOT/etc/qubes_rpc mkdir -p $RPM_BUILD_ROOT/var/lib/qubes/dom0-updates mkdir -p $RPM_BUILD_ROOT/etc/X11 @@ -143,6 +147,7 @@ rm -rf $RPM_BUILD_ROOT /usr/lib/qubes/qvm-copy-to-vm2.gnome /usr/bin/qvm-open-in-dvm2 /usr/bin/qvm-open-in-vm +/usr/bin/qvm-run /usr/lib/qubes/meminfo-writer /usr/lib/qubes/vm-file-editor %{kde_service_dir}/qvm-copy.desktop @@ -153,10 +158,14 @@ rm -rf $RPM_BUILD_ROOT /usr/lib/qubes/qfile-agent /usr/lib/qubes/qopen-in-vm /usr/lib/qubes/qfile-unpacker +/usr/lib/qubes/vm-shell +/usr/lib/qubes/qrun-in-vm +/usr/lib/qubes/wrap_in_html_if_url.sh %dir /mnt/removable %dir /etc/qubes_rpc /etc/qubes_rpc/qubes.Filecopy /etc/qubes_rpc/qubes.OpenInVM +/etc/qubes_rpc/qubes.VMShell /usr/bin/qubes_timestamp %dir /home_volatile %attr(700,user,user) /home_volatile/user