dom0+vm: Trigger appmenus sync after yum transaction (#45), NEW QREXEC COMMAND
After yum transaction (install/upgrade/remove), yum-plugin-post-transaction-actions will execute script which trigger qvm-sync-appmenus in dom0 (through qrexec). THIS INTRODUCE NEW PREDEFINED COMMAND IN QREXEC
This commit is contained in:
parent
4634a6897c
commit
83d211836a
1
common/qubes_trigger_sync_appmenus.action
Normal file
1
common/qubes_trigger_sync_appmenus.action
Normal file
@ -0,0 +1 @@
|
||||
*:any:/usr/lib/qubes/qubes_trigger_sync_appmenus.sh
|
7
common/qubes_trigger_sync_appmenus.sh
Executable file
7
common/qubes_trigger_sync_appmenus.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
UPDATEABLE=`/usr/bin/xenstore-read qubes_vm_updateable`
|
||||
|
||||
if [ "$UPDATEABLE" = "True" ]; then
|
||||
echo -n SYNC > /var/run/qubes/qrexec_agent
|
||||
fi
|
@ -51,7 +51,8 @@ enum {
|
||||
|
||||
enum {
|
||||
QREXEC_EXECUTE_FILE_COPY=0x700,
|
||||
QREXEC_EXECUTE_FILE_COPY_FOR_DISPVM
|
||||
QREXEC_EXECUTE_FILE_COPY_FOR_DISPVM,
|
||||
QREXEC_EXECUTE_APPMENUS_SYNC
|
||||
};
|
||||
|
||||
struct server_header {
|
||||
|
@ -482,6 +482,9 @@ void handle_trigger_io()
|
||||
else if (!strcmp(buf, "DVMR"))
|
||||
s_hdr.client_id =
|
||||
QREXEC_EXECUTE_FILE_COPY_FOR_DISPVM;
|
||||
else if (!strcmp(buf, "SYNC"))
|
||||
s_hdr.client_id =
|
||||
QREXEC_EXECUTE_APPMENUS_SYNC;
|
||||
if (s_hdr.client_id) {
|
||||
s_hdr.type = MSG_AGENT_TO_SERVER_TRIGGER_EXEC;
|
||||
write_all_vchan_ext(&s_hdr, sizeof s_hdr);
|
||||
|
@ -361,6 +361,10 @@ void handle_execute_predefined_command(int req)
|
||||
rcmd = "directly:user:/usr/lib/qubes/qfile-agent-dvm";
|
||||
lcmd = "/usr/lib/qubes/qfile-daemon-dvm";
|
||||
break;
|
||||
case QREXEC_EXECUTE_APPMENUS_SYNC:
|
||||
rcmd = "user:grep -H = /usr/share/applications/*.desktop";
|
||||
lcmd = "/usr/bin/qvm-sync-appmenus";
|
||||
break;
|
||||
default: /* cannot happen, already sanitized */
|
||||
fprintf(stderr, "got trigger exec no %d\n", req);
|
||||
exit(1);
|
||||
@ -402,7 +406,8 @@ void sanitize_message_from_agent(struct server_header *untrusted_header)
|
||||
case MSG_AGENT_TO_SERVER_TRIGGER_EXEC:
|
||||
untrusted_cmd = untrusted_header->client_id;
|
||||
if (untrusted_cmd != QREXEC_EXECUTE_FILE_COPY &&
|
||||
untrusted_cmd != QREXEC_EXECUTE_FILE_COPY_FOR_DISPVM) {
|
||||
untrusted_cmd != QREXEC_EXECUTE_FILE_COPY_FOR_DISPVM &&
|
||||
untrusted_cmd != QREXEC_EXECUTE_APPMENUS_SYNC) {
|
||||
fprintf(stderr,
|
||||
"received MSG_AGENT_TO_SERVER_TRIGGER_EXEC cmd %d ?\n",
|
||||
untrusted_cmd);
|
||||
|
@ -33,6 +33,7 @@ License: GPL
|
||||
URL: http://www.qubes-os.org
|
||||
Requires: /usr/bin/xenstore-read
|
||||
Requires: fedora-release
|
||||
Requires: yum-plugin-post-transaction-actions
|
||||
BuildRequires: xen-devel
|
||||
|
||||
%define _builddir %(pwd)/common
|
||||
@ -78,6 +79,10 @@ mkdir -p $RPM_BUILD_ROOT/etc/udev/rules.d
|
||||
cp qubes_network.rules $RPM_BUILD_ROOT/etc/udev/rules.d/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/lib/qubes/
|
||||
cp setup_ip $RPM_BUILD_ROOT/usr/lib/qubes/
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/yum/post-actions
|
||||
cp qubes_trigger_sync_appmenus.action $RPM_BUILD_ROOT/etc/yum/post-actions/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/lib/qubes
|
||||
cp qubes_trigger_sync_appmenus.sh $RPM_BUILD_ROOT/usr/lib/qubes/
|
||||
|
||||
%triggerin -- initscripts
|
||||
cp /var/lib/qubes/serial.conf /etc/init/serial.conf
|
||||
@ -226,3 +231,5 @@ rm -rf $RPM_BUILD_ROOT
|
||||
/usr/bin/xenstore-watch-qubes
|
||||
/etc/udev/rules.d/qubes_network.rules
|
||||
/usr/lib/qubes/setup_ip
|
||||
/etc/yum/post-actions/qubes_trigger_sync_appmenus.action
|
||||
/usr/lib/qubes/qubes_trigger_sync_appmenus.sh
|
||||
|
Loading…
Reference in New Issue
Block a user