diff --git a/Makefile b/Makefile index ea8bdef..2799f23 100644 --- a/Makefile +++ b/Makefile @@ -210,6 +210,7 @@ install-common: install qubes-rpc/qvm-move-to-vm.gnome $(DESTDIR)$(LIBDIR)/qubes install qubes-rpc/xdg-icon $(DESTDIR)$(LIBDIR)/qubes install qubes-rpc/{vm-file-editor,qfile-agent,qopen-in-vm} $(DESTDIR)$(LIBDIR)/qubes + install qubes-rpc/qubes-open $(DESTDIR)/usr/bin install qubes-rpc/tar2qfile $(DESTDIR)$(LIBDIR)/qubes # Install qfile-unpacker as SUID - because it will fail to receive files from other vm install -m 4755 qubes-rpc/qfile-unpacker $(DESTDIR)$(LIBDIR)/qubes diff --git a/qubes-rpc/qubes-open b/qubes-rpc/qubes-open new file mode 100644 index 0000000..1c13b42 --- /dev/null +++ b/qubes-rpc/qubes-open @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ -r /etc/profile.d/qubes-session.sh ]; then + . /etc/profile.d/qubes-session.sh +fi + +MIMEINFO_DATABASES="/usr/share/mime:/usr/local/share/mime:$HOME/.local/share/mime:/usr/share/qubes/mime-override" + +exec mimeopen -n --database "$MIMEINFO_DATABASES" "$@" diff --git a/qubes-rpc/vm-file-editor.c b/qubes-rpc/vm-file-editor.c index 34ede27..7ba7bb4 100644 --- a/qubes-rpc/vm-file-editor.c +++ b/qubes-rpc/vm-file-editor.c @@ -11,7 +11,6 @@ #include "dvm2.h" #define USER_HOME "/home/user" -#define MIMEINFO_DATABASES "/usr/share/mime:/usr/local/share/mime:" USER_HOME "/.local/share/mime:/usr/share/qubes/mime-override" #define TMP_LOC "/tmp/qopen/" static const char *cleanup_filename = NULL; @@ -148,8 +147,6 @@ main() struct stat stat_pre, stat_post, session_stat; char *filename = get_filename(); int child, status, log_fd, null_fd; - char var[1024], val[4096]; - FILE *env_file; FILE *waiter_pidfile; copy_file_by_name(filename); @@ -196,12 +193,6 @@ main() dup2(null_fd, 0); close(null_fd); - env_file = fopen("/tmp/qubes-session-env", "r"); - while(fscanf(env_file, "%1024[^=]=%4096[^\n]\n", var, val) == 2) { - setenv(var, val, 1); - } - fclose(env_file); - log_fd = open("/tmp/mimeopen.log", O_CREAT | O_APPEND, 0666); if (log_fd == -1) { perror("open /tmp/mimeopen.log"); @@ -212,8 +203,7 @@ main() setenv("HOME", USER_HOME, 1); setenv("DISPLAY", ":0", 1); - execl("/usr/bin/mimeopen", "mimeopen", "-n", - "--database", MIMEINFO_DATABASES, filename, (char*)NULL); + execl("/usr/bin/qubes-open", "qubes-open", filename, (char*)NULL); perror("execl"); exit(1); default: diff --git a/rpm_spec/core-vm.spec b/rpm_spec/core-vm.spec index 75568a2..065efe1 100644 --- a/rpm_spec/core-vm.spec +++ b/rpm_spec/core-vm.spec @@ -379,6 +379,7 @@ rm -f %{name}-%{version} /usr/bin/qvm-mru-entry /usr/bin/xenstore-watch-qubes /usr/bin/qubes-desktop-run +/usr/bin/qubes-open /usr/bin/qrexec-fork-server /usr/bin/qrexec-client-vm /usr/bin/qubes-session-autostart