From ffb8b0a09ac4aa300bc229e82f5ba130d465d68f Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Fri, 22 Jun 2012 21:59:15 +0200 Subject: [PATCH] vm: RPC service for NTP time sync (#603) --- qubes_rpc/qubes.SyncNtpClock | 1 + qubes_rpc/sync-ntp-clock | 12 ++++++++++++ rpm_spec/core-vm.spec | 6 +++++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 qubes_rpc/qubes.SyncNtpClock create mode 100755 qubes_rpc/sync-ntp-clock diff --git a/qubes_rpc/qubes.SyncNtpClock b/qubes_rpc/qubes.SyncNtpClock new file mode 100644 index 0000000..087a421 --- /dev/null +++ b/qubes_rpc/qubes.SyncNtpClock @@ -0,0 +1 @@ +/usr/lib/qubes/sync-ntp-clock diff --git a/qubes_rpc/sync-ntp-clock b/qubes_rpc/sync-ntp-clock new file mode 100755 index 0000000..f5dfa1b --- /dev/null +++ b/qubes_rpc/sync-ntp-clock @@ -0,0 +1,12 @@ +#!/bin/sh + +if [ -x /usr/libexec/ntpdate-wrapper ]; then + /usr/libexec/ntpdate-wrapper +elif [ -x /etc/init.d/ntpdate ]; then + /etc/init.d/ntpdate restart +elif [ -x /usr/sbin/ntpdate ]; then + /usr/sbin/ntpdate pool.ntp.org +else + echo "No ntpdate installed, giving up." + exit 1 +fi diff --git a/rpm_spec/core-vm.spec b/rpm_spec/core-vm.spec index 1fef666..df49f4e 100644 --- a/rpm_spec/core-vm.spec +++ b/rpm_spec/core-vm.spec @@ -38,6 +38,7 @@ Requires: NetworkManager >= 0.8.1-1 Requires: /usr/bin/mimeopen Requires: ethtool Requires: tinyproxy +Requires: ntpdate Provides: qubes-core-vm Obsoletes: qubes-core-commonvm Obsoletes: qubes-core-appvm @@ -149,10 +150,11 @@ install qubes_rpc/qvm-copy-to-vm.kde $RPM_BUILD_ROOT/usr/lib/qubes install qubes_rpc/qvm-copy-to-vm.gnome $RPM_BUILD_ROOT/usr/lib/qubes install qubes_rpc/{vm-file-editor,qfile-agent,qopen-in-vm,qfile-unpacker} $RPM_BUILD_ROOT/usr/lib/qubes install qubes_rpc/{vm-shell,qrun-in-vm} $RPM_BUILD_ROOT/usr/lib/qubes +install qubes_rpc/sync-ntp-clock $RPM_BUILD_ROOT/usr/lib/qubes install -d $RPM_BUILD_ROOT/%{kde_service_dir} install -m 0644 qubes_rpc/{qvm-copy.desktop,qvm-dvm.desktop} $RPM_BUILD_ROOT/%{kde_service_dir} install -d $RPM_BUILD_ROOT/etc/qubes_rpc -install -m 0644 qubes_rpc/{qubes.Filecopy,qubes.OpenInVM,qubes.VMShell} $RPM_BUILD_ROOT/etc/qubes_rpc +install -m 0644 qubes_rpc/{qubes.Filecopy,qubes.OpenInVM,qubes.VMShell,qubes.SyncNtpClock} $RPM_BUILD_ROOT/etc/qubes_rpc install qrexec/qrexec_agent $RPM_BUILD_ROOT/usr/lib/qubes install qrexec/qrexec_client_vm $RPM_BUILD_ROOT/usr/lib/qubes @@ -352,6 +354,7 @@ rm -rf $RPM_BUILD_ROOT /etc/qubes_rpc/qubes.Filecopy /etc/qubes_rpc/qubes.OpenInVM /etc/qubes_rpc/qubes.VMShell +/etc/qubes_rpc/qubes.SyncNtpClock /etc/sudoers.d/qubes /etc/sysconfig/iptables /etc/sysconfig/modules/qubes_core.modules @@ -375,6 +378,7 @@ rm -rf $RPM_BUILD_ROOT /usr/lib/qubes/block_add_change /usr/lib/qubes/block_cleanup /usr/lib/qubes/block_remove +/usr/lib/qubes/sync-ntp-clock /usr/lib/qubes/meminfo-writer /usr/lib/qubes/network-manager-prepare-conf-dir /usr/lib/qubes/qfile-agent