Hello Zhou Zheng Sheng, I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/15313 to review the following change. Change subject: agent: Build and install ovirt guest agent on Ubuntu ...................................................................... agent: Build and install ovirt guest agent on Ubuntu Change-Id: I7a694bf1f7ff4230bac305dd571899265ef63950 Signed-off-by: Zhou Zheng Sheng <zhshz...@linux.vnet.ibm.com> Signed-off-by: Vinzenz Feenstra <vfeen...@redhat.com> --- M Makefile.am M ovirt-guest-agent/hibernate M ovirt-guest-agent/ovirt-guest-agent A ovirt-guest-agent/ovirt-guest-agent.upstart.conf A ubuntuInstall.sh 5 files changed, 76 insertions(+), 6 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-guest-agent refs/changes/13/15313/1 diff --git a/Makefile.am b/Makefile.am index fd3c37e..b40a370 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,8 +56,8 @@ install-exec-hook: $(MKDIR_P) $(DESTDIR)/$(pkgdatadir) - $(LN_S) $(bindir)/consolehelper $(DESTDIR)/$(pkgdatadir)/ovirt-locksession - $(LN_S) $(bindir)/consolehelper $(DESTDIR)/$(pkgdatadir)/ovirt-shutdown - $(LN_S) $(bindir)/consolehelper $(DESTDIR)/$(pkgdatadir)/ovirt-hibernate - $(INSTALL) -d $(DESTDIR)/$(localstatedir)/lock/subsys/ovirt-guest-agent + $(LN_S) -f $(bindir)/consolehelper $(DESTDIR)/$(pkgdatadir)/ovirt-locksession + $(LN_S) -f $(bindir)/consolehelper $(DESTDIR)/$(pkgdatadir)/ovirt-shutdown + $(LN_S) -f $(bindir)/consolehelper $(DESTDIR)/$(pkgdatadir)/ovirt-hibernate + $(INSTALL) -d $(DESTDIR)/$(localstatedir)/lock/ovirt-guest-agent $(INSTALL) -d $(DESTDIR)/$(localstatedir)/log/ovirt-guest-agent diff --git a/ovirt-guest-agent/hibernate b/ovirt-guest-agent/hibernate index 74f4e72..03d09a0 100644 --- a/ovirt-guest-agent/hibernate +++ b/ovirt-guest-agent/hibernate @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash usage() { echo "usage: $0 disk|mem" diff --git a/ovirt-guest-agent/ovirt-guest-agent b/ovirt-guest-agent/ovirt-guest-agent index 5528516..f9e51b0 100644 --- a/ovirt-guest-agent/ovirt-guest-agent +++ b/ovirt-guest-agent/ovirt-guest-agent @@ -13,7 +13,7 @@ agentd=/usr/share/ovirt-guest-agent/ovirt-guest-agent.py prog=ovirt-guest-agent -lockfile=/var/lock/subsys/${prog} +lockfile=/var/lock/${prog} pidfile=/var/run/${prog}.pid RETVAL=0 diff --git a/ovirt-guest-agent/ovirt-guest-agent.upstart.conf b/ovirt-guest-agent/ovirt-guest-agent.upstart.conf new file mode 100644 index 0000000..48ab46f --- /dev/null +++ b/ovirt-guest-agent/ovirt-guest-agent.upstart.conf @@ -0,0 +1,29 @@ +# ovirt-guest-agent - oVirt guest agent +# + +description "oVirt guest agent" + +start on runlevel [2345] +stop on runlevel [!2345] + +# Do not setuid ovirtagent, because pre-start needs root permission to touch +# file under /run. If we setuid ovirtagent, pre-start will be run as +# ovirtagent, and fail to touch and chown, then cause the ovirt-guest-agent +# service fail to start. +# setuid ovirtagent +# setgid ovirtagent +chdir /usr/share/ovirt-guest-agent/ + +console log + +pre-start script + touch /run/ovirt-guest-agent.pid + chown ovirtagent:ovirtagent /run/ovirt-guest-agent.pid + chown ovirtagent:ovirtagent -R /var/log/ovirt-guest-agent +end script + +exec sudo -u ovirtagent -g ovirtagent python /usr/share/ovirt-guest-agent/ovirt-guest-agent.py + +post-stop script + rm -f /run/ovirt-guest-agent.pid +end script diff --git a/ubuntuInstall.sh b/ubuntuInstall.sh new file mode 100755 index 0000000..abc2322 --- /dev/null +++ b/ubuntuInstall.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +echo "Dependencies: make gcc libtool autoconf libpam-dev pep8 usermode python-ethtool python-dev python-dbus" +echo "Please resolve the dependencies manually by apt-get install them, then run this script to build and install ovirt guest agent." +echo "[Press ENTER to continue]" +read + +[ -e Makefile ] && make clean +[ -e Makefile.in ] && make distclean + +set -e +./autogen.sh +./configure --with-sso=no --prefix=/usr --sysconfdir=/etc --localstatedir=/var +make +set +e + +sudo stop ovirt-guest-agent >/dev/null 2>&1 + +sudo make install + +getent group ovirtagent >/dev/null || sudo groupadd -r -g 175 ovirtagent +getent passwd ovirtagent > /dev/null || \ + sudo /usr/sbin/useradd -u 175 -g 175 -o -r ovirtagent \ + -c "oVirt Guest Agent" -d /usr/share/ovirt-guest-agent -s /sbin/nologin + +# get rid of the error +# org.freedesktop.DBus.Error.AccessDenied: Connection ":1.88" is not allowed to own the service +sudo adduser ovirtagent netdev >/dev/null 2>&1 + +sudo udevadm control --reload-rules +sudo udevadm trigger --subsystem-match="virtio-ports" \ + --attr-match="name=com.redhat.rhevm.vdsm" +sudo udevadm settle +sudo install -D -m 0644 -o root -g root ovirt-guest-agent/ovirt-guest-agent.upstart.conf /etc/init/ovirt-guest-agent.conf + +sudo chmod +x /usr/share/ovirt-guest-agent/hibernate +sudo chmod +x /usr/share/ovirt-guest-agent/LockActiveSession.{py,pyc} + +sudo start ovirt-guest-agent + +exit 0 -- To view, visit http://gerrit.ovirt.org/15313 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7a694bf1f7ff4230bac305dd571899265ef63950 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-guest-agent Gerrit-Branch: master Gerrit-Owner: Vinzenz Feenstra <vfeen...@redhat.com> Gerrit-Reviewer: Zhou Zheng Sheng <zhshz...@linux.vnet.ibm.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches