qvm-open-in-*: recognize when the parameter is an url

and wrap it in html meta refresh tag, so that it will be opened by
the default browser.
This commit is contained in:
Rafal Wojtczuk 2011-08-29 17:27:48 +02:00
parent 1a24c19702
commit 890030354d
4 changed files with 26 additions and 3 deletions

View File

@ -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"

View File

@ -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"

View File

@ -0,0 +1,17 @@
wrap_in_html_if_url()
{
case "$1" in
*://*)
FILE_ARGUMENT=$(mktemp)
echo -n '<html><meta HTTP-EQUIV="REFRESH" content="0; url=' > $FILE_ARGUMENT
echo -n "$1" >> $FILE_ARGUMENT
echo '"></html>' >> $FILE_ARGUMENT
;;
*)
FILE_ARGUMENT="$1"
;;
esac
}

View File

@ -79,6 +79,7 @@ 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
@ -159,6 +160,7 @@ rm -rf $RPM_BUILD_ROOT
/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